From 96c1dd046d710e9c13629d7dd22721bc8dd93a89 Mon Sep 17 00:00:00 2001 From: Sjoerd Talsma Date: Tue, 28 Jul 2020 14:05:59 +0200 Subject: [PATCH] Bump PlantUML ASL to version 1.2020.15 (#294) Latest PlantUML version 1.2020.15 renders the same diagram as the current 1.2019.8 version that didn't have the IllegalStateException in Bibliothekon.getNodeUid: there no longer is regression for issue #267 This fixes #288 Signed-off-by: Sjoerd Talsma --- src/plantuml-asl/build.xml | 2 +- src/plantuml-asl/skin/debug.skin | 112 +- src/plantuml-asl/skin/plantuml.skin | 190 +++- src/plantuml-asl/skin/strictuml.skin | 6 + .../src/gen/lib/dotgen/cluster__c.java | 9 +- .../src/gen/lib/dotgen/fastgr__c.java | 35 +- .../src/gen/lib/label/index__c.java | 11 +- .../src/net/sourceforge/plantuml/AFile.java | 15 +- .../sourceforge/plantuml/AFileRegular.java | 28 +- .../sourceforge/plantuml/AFileZipEntry.java | 74 +- .../sourceforge/plantuml/AParentFolder.java | 6 +- .../plantuml/AParentFolderRegular.java | 29 +- .../plantuml/AParentFolderZip.java | 13 +- .../sourceforge/plantuml/AbstractPSystem.java | 13 +- .../sourceforge/plantuml/AlignmentParam.java | 6 +- .../plantuml/AnimatedGifEncoder.java | 146 ++- .../net/sourceforge/plantuml/Annotated.java | 6 +- .../sourceforge/plantuml/AnnotatedWorker.java | 69 +- .../net/sourceforge/plantuml/BackSlash.java | 6 +- .../net/sourceforge/plantuml/BaseFile.java | 20 +- .../plantuml/BasicEnsureVisible.java | 6 +- .../net/sourceforge/plantuml/BlockUml.java | 50 +- .../sourceforge/plantuml/BlockUmlBuilder.java | 72 +- .../net/sourceforge/plantuml/CMapData.java | 6 +- .../sourceforge/plantuml/ClipboardLoop.java | 9 +- .../net/sourceforge/plantuml/ColorParam.java | 249 ++--- .../ShadowShape.java => ComponentStyle.java} | 25 +- .../net/sourceforge/plantuml/CornerParam.java | 6 +- .../plantuml/CounterOutputStream.java | 6 +- .../plantuml/DefinitionsContainer.java | 9 +- .../plantuml/Dimension2DDouble.java | 6 +- .../net/sourceforge/plantuml/DirWatcher.java | 6 +- .../net/sourceforge/plantuml/DirWatcher2.java | 10 +- .../net/sourceforge/plantuml/Direction.java | 6 +- .../sourceforge/plantuml/EmbeddedDiagram.java | 19 +- .../plantuml/EmptyImageBuilder.java | 93 +- .../sourceforge/plantuml/EnsureVisible.java | 6 +- .../net/sourceforge/plantuml/ErrorStatus.java | 6 +- .../net/sourceforge/plantuml/ErrorUml.java | 6 +- .../sourceforge/plantuml/ErrorUmlType.java | 6 +- .../net/sourceforge/plantuml/FileFormat.java | 63 +- .../plantuml/FileFormatOption.java | 75 +- .../net/sourceforge/plantuml/FileGroup.java | 6 +- .../sourceforge/plantuml/FileImageData.java | 15 +- .../net/sourceforge/plantuml/FileSystem.java | 90 +- .../net/sourceforge/plantuml/FileUtils.java | 109 +- .../net/sourceforge/plantuml/FileWatcher.java | 6 +- .../net/sourceforge/plantuml/FontParam.java | 29 +- .../sourceforge/plantuml/GeneratedImage.java | 6 +- .../plantuml/GeneratedImageImpl.java | 26 +- .../net/sourceforge/plantuml/Guillemet.java | 6 +- .../net/sourceforge/plantuml/Hideable.java | 6 +- .../net/sourceforge/plantuml/ISkinParam.java | 37 +- .../net/sourceforge/plantuml/ISkinSimple.java | 12 +- .../plantuml/ISourceFileReader.java | 6 +- .../sourceforge/plantuml/ImageSelection.java | 6 +- .../plantuml/LineBreakStrategy.java | 11 +- .../plantuml/LineConfigurable.java | 10 +- .../sourceforge/plantuml/LineLocation.java | 6 +- .../plantuml/LineLocationImpl.java | 6 +- .../net/sourceforge/plantuml/LineParam.java | 7 +- .../src/net/sourceforge/plantuml/Log.java | 22 +- .../plantuml/NamedOutputStream.java | 15 +- .../sourceforge/plantuml/NewpagedDiagram.java | 6 +- .../plantuml/NullOutputStream.java | 6 +- .../src/net/sourceforge/plantuml/Option.java | 58 +- .../net/sourceforge/plantuml/OptionFlags.java | 26 +- .../plantuml/OptionPreprocOutputMode.java | 6 +- .../net/sourceforge/plantuml/OptionPrint.java | 117 +-- .../sourceforge/plantuml/PSystemBuilder.java | 47 +- .../sourceforge/plantuml/PSystemUtils.java | 71 +- .../sourceforge/plantuml/PaddingParam.java | 6 +- .../src/net/sourceforge/plantuml/Pipe.java | 20 +- .../src/net/sourceforge/plantuml/Pragma.java | 14 +- .../net/sourceforge/plantuml/ProgressBar.java | 6 +- .../net/sourceforge/plantuml/Removeable.java | 6 +- .../src/net/sourceforge/plantuml/Run.java | 100 +- .../src/net/sourceforge/plantuml/Scale.java | 6 +- .../net/sourceforge/plantuml/ScaleHeight.java | 6 +- .../sourceforge/plantuml/ScaleMaxHeight.java | 6 +- .../sourceforge/plantuml/ScaleMaxWidth.java | 6 +- .../plantuml/ScaleMaxWidthAndHeight.java | 6 +- .../sourceforge/plantuml/ScaleProtected.java | 6 +- .../net/sourceforge/plantuml/ScaleSimple.java | 6 +- .../net/sourceforge/plantuml/ScaleWidth.java | 6 +- .../plantuml/ScaleWidthAndHeight.java | 6 +- .../sourceforge/plantuml/SignatureUtils.java | 43 +- .../net/sourceforge/plantuml/SingleLine.java | 6 +- .../net/sourceforge/plantuml/SkinParam.java | 255 +++-- .../plantuml/SkinParamBackcolored.java | 34 +- .../SkinParamBackcoloredReference.java | 18 +- .../sourceforge/plantuml/SkinParamColors.java | 20 +- .../plantuml/SkinParamDelegator.java | 64 +- .../plantuml/SkinParamForceColor.java | 14 +- .../plantuml/SkinParamForecolored.java | 14 +- .../plantuml/SkinParamSameClassWidth.java | 6 +- .../sourceforge/plantuml/SkinParamUtils.java | 12 +- .../plantuml/SourceFileReader.java | 33 +- .../plantuml/SourceFileReaderAbstract.java | 32 +- .../plantuml/SourceFileReaderCopyCat.java | 81 ++ ...er2.java => SourceFileReaderHardFile.java} | 20 +- .../plantuml/SourceStringReader.java | 47 +- .../plantuml/SpecificBackcolorable.java | 6 +- .../src/net/sourceforge/plantuml/Splash.java | 11 +- .../net/sourceforge/plantuml/SplitParam.java | 20 +- .../sourceforge/plantuml/SpriteContainer.java | 8 +- .../plantuml/SpriteContainerEmpty.java | 31 +- .../src/net/sourceforge/plantuml/Stdrpt.java | 6 +- .../net/sourceforge/plantuml/StdrptNull.java | 6 +- .../net/sourceforge/plantuml/StdrptPipe0.java | 6 +- .../net/sourceforge/plantuml/StdrptV1.java | 6 +- .../sourceforge/plantuml/StringLocated.java | 44 +- .../net/sourceforge/plantuml/StringUtils.java | 117 +-- .../sourceforge/plantuml/SuggestedFile.java | 36 +- .../net/sourceforge/plantuml/SvgString.java | 13 +- .../plantuml/TikzFontDistortion.java | 6 +- .../sourceforge/plantuml/TitledDiagram.java | 6 +- .../net/sourceforge/plantuml/UmlDiagram.java | 139 +-- .../sourceforge/plantuml/UmlDiagramType.java | 42 +- .../src/net/sourceforge/plantuml/Url.java | 9 +- .../net/sourceforge/plantuml/UrlBuilder.java | 62 +- .../net/sourceforge/plantuml/WithSprite.java | 8 +- .../activitydiagram/ActivityDiagram.java | 71 +- .../ActivityDiagramFactory.java | 14 +- .../activitydiagram/ConditionalContext.java | 9 +- .../activitydiagram/command/CommandElse.java | 6 +- .../command/CommandEndPartition.java | 6 +- .../activitydiagram/command/CommandEndif.java | 6 +- .../activitydiagram/command/CommandIf.java | 9 +- .../command/CommandInnerConcurrent.java | 6 +- .../command/CommandLinkActivity.java | 105 +- .../command/CommandLinkLongActivity.java | 25 +- .../command/CommandPartition.java | 26 +- .../activitydiagram3/ActivityDiagram3.java | 102 +- .../ActivityDiagramFactory3.java | 8 +- .../plantuml/activitydiagram3/Branch.java | 39 +- .../plantuml/activitydiagram3/ForkStyle.java | 6 +- .../activitydiagram3/Instruction.java | 6 +- .../activitydiagram3/InstructionBreak.java | 6 +- .../InstructionCollection.java | 6 +- .../activitydiagram3/InstructionEnd.java | 6 +- .../activitydiagram3/InstructionFork.java | 32 +- .../activitydiagram3/InstructionGoto.java | 6 +- .../activitydiagram3/InstructionGroup.java | 18 +- .../activitydiagram3/InstructionIf.java | 26 +- .../activitydiagram3/InstructionLabel.java | 6 +- .../activitydiagram3/InstructionList.java | 6 +- .../InstructionPartition.java | 6 +- .../activitydiagram3/InstructionRepeat.java | 32 +- .../activitydiagram3/InstructionSimple.java | 6 +- .../activitydiagram3/InstructionSplit.java | 8 +- .../activitydiagram3/InstructionSpot.java | 13 +- .../activitydiagram3/InstructionStart.java | 6 +- .../activitydiagram3/InstructionStop.java | 6 +- .../activitydiagram3/InstructionSwitch.java | 12 +- .../activitydiagram3/InstructionWhile.java | 27 +- .../activitydiagram3/LinkRendering.java | 6 +- .../activitydiagram3/MonoSwimable.java | 6 +- .../activitydiagram3/PositionedNote.java | 6 +- .../plantuml/activitydiagram3/WithNote.java | 6 +- .../command/CommandActivity3.java | 42 +- .../command/CommandActivityLegacy1.java | 6 +- .../command/CommandActivityLong3.java | 13 +- .../command/CommandArrow3.java | 6 +- .../command/CommandArrowLong3.java | 13 +- .../command/CommandBackward3.java | 19 +- .../command/CommandBreak.java | 6 +- .../activitydiagram3/command/CommandCase.java | 6 +- .../command/CommandCircleSpot3.java | 12 +- .../command/CommandElse3.java | 6 +- .../command/CommandElseIf2.java | 10 +- .../command/CommandElseLegacy1.java | 6 +- .../activitydiagram3/command/CommandEnd3.java | 6 +- .../command/CommandEndPartition3.java | 6 +- .../command/CommandEndSwitch.java | 6 +- .../command/CommandEndif3.java | 6 +- .../command/CommandFork3.java | 6 +- .../command/CommandForkAgain3.java | 6 +- .../command/CommandForkEnd3.java | 6 +- .../activitydiagram3/command/CommandGoto.java | 6 +- .../command/CommandGroup3.java | 6 +- .../command/CommandGroupEnd3.java | 6 +- .../activitydiagram3/command/CommandIf2.java | 10 +- .../activitydiagram3/command/CommandIf4.java | 10 +- .../command/CommandIfLegacy1.java | 6 +- .../command/CommandKill3.java | 6 +- .../command/CommandLabel.java | 6 +- .../command/CommandLink3.java | 14 +- .../command/CommandNolink.java | 6 +- .../command/CommandNote3.java | 6 +- .../command/CommandNoteLong3.java | 10 +- .../command/CommandPartition3.java | 44 +- .../command/CommandRepeat3.java | 38 +- .../command/CommandRepeatWhile3.java | 6 +- .../CommandRepeatWhile3Multilines.java | 12 +- .../command/CommandSplit3.java | 6 +- .../command/CommandSplitAgain3.java | 6 +- .../command/CommandSplitEnd3.java | 6 +- .../command/CommandStart3.java | 6 +- .../command/CommandStop3.java | 6 +- .../command/CommandSwimlane.java | 10 +- .../command/CommandSwimlane2.java | 10 +- .../command/CommandSwitch.java | 10 +- .../command/CommandWhile3.java | 10 +- .../command/CommandWhileEnd3.java | 6 +- .../ftile/AbstractConnection.java | 6 +- .../activitydiagram3/ftile/AbstractFtile.java | 11 +- .../activitydiagram3/ftile/Arrows.java | 6 +- .../activitydiagram3/ftile/BoxStyle.java | 50 +- .../activitydiagram3/ftile/CenteredText.java | 54 + .../ftile/CollisionDetector.java | 33 +- .../activitydiagram3/ftile/Connection.java | 6 +- .../ftile/ConnectionCross.java | 6 +- .../ftile/ConnectionTranslatable.java | 6 +- .../activitydiagram3/ftile/Diamond.java | 24 +- .../ftile/EntityImageLegend.java | 16 +- .../activitydiagram3/ftile/Ftile.java | 6 +- .../ftile/FtileAssemblySimple.java | 12 +- .../activitydiagram3/ftile/FtileBreak.java | 6 +- .../ftile/FtileDecorateWelding.java | 6 +- .../activitydiagram3/ftile/FtileEmpty.java | 6 +- .../activitydiagram3/ftile/FtileFactory.java | 24 +- .../ftile/FtileFactoryDelegator.java | 75 +- .../activitydiagram3/ftile/FtileGeometry.java | 10 +- .../ftile/FtileGeometryMerger.java | 6 +- .../activitydiagram3/ftile/FtileGoto.java | 6 +- ...xed.java => FtileHeightFixedCentered.java} | 12 +- .../ftile/FtileHeightFixedMarged.java | 89 ++ .../activitydiagram3/ftile/FtileKilled.java | 6 +- .../activitydiagram3/ftile/FtileLabel.java | 6 +- .../activitydiagram3/ftile/FtileMarged.java | 8 +- .../ftile/FtileMargedRight.java | 6 +- .../ftile/FtileMargedVertically.java | 8 +- ...nWidth.java => FtileMinWidthCentered.java} | 12 +- .../ftile/FtileOverpassing.java | 6 +- .../activitydiagram3/ftile/FtileUtils.java | 6 +- .../ftile/FtileWithConnection.java | 6 +- .../ftile/FtileWithSwimlanes.java | 6 +- .../activitydiagram3/ftile/FtileWithUrl.java | 8 +- .../activitydiagram3/ftile/Genealogy.java | 6 +- .../ftile/GotoInterceptor.java | 6 +- .../activitydiagram3/ftile/LaneDivider.java | 117 +++ .../activitydiagram3/ftile/MergeStrategy.java | 6 +- .../activitydiagram3/ftile/Snake.java | 14 +- .../ftile/SnakeDirection.java | 6 +- .../activitydiagram3/ftile/Swimable.java | 6 +- .../activitydiagram3/ftile/Swimlane.java | 15 +- .../activitydiagram3/ftile/Swimlanes.java | 429 ++++++++ .../activitydiagram3/ftile/SwimlanesA.java | 320 ------ .../activitydiagram3/ftile/SwimlanesB.java | 138 --- .../activitydiagram3/ftile/SwimlanesC.java | 84 -- .../ftile/TextBlockInterceptorUDrawable.java | 6 +- .../ftile/UGraphicInterceptorUDrawable2.java | 18 +- .../activitydiagram3/ftile/WeldingPoint.java | 6 +- .../plantuml/activitydiagram3/ftile/Worm.java | 55 +- .../activitydiagram3/ftile/WormMutation.java | 16 +- .../activitydiagram3/ftile/WormTexted.java | 6 +- .../plantuml/activitydiagram3/ftile/Zad.java | 12 +- .../activitydiagram3/ftile/ZadBuilder.java | 26 +- .../AbstractParallelFtilesBuilder.java | 156 +++ .../vcompact/ConnectionVerticalDown.java | 6 +- .../ftile/vcompact/FloatingNote.java | 27 +- .../FtileFactoryDelegatorAddNote.java | 6 +- .../vcompact/FtileFactoryDelegatorAddUrl.java | 6 +- .../FtileFactoryDelegatorAssembly.java | 6 +- .../FtileFactoryDelegatorCreateGroup.java | 14 +- .../FtileFactoryDelegatorCreateParallel.java | 42 +- .../FtileFactoryDelegatorCreateParallel1.java | 70 -- ...ryDelegatorCreateParallelAddingMargin.java | 68 -- .../vcompact/FtileFactoryDelegatorIf.java | 48 +- .../vcompact/FtileFactoryDelegatorRepeat.java | 77 +- .../vcompact/FtileFactoryDelegatorSwitch.java | 31 +- .../vcompact/FtileFactoryDelegatorWhile.java | 53 +- .../ftile/vcompact/FtileForkInner.java | 10 +- .../vcompact/FtileForkInnerOverlapped.java | 10 +- .../ftile/vcompact/FtileGroup.java | 75 +- .../ftile/vcompact/FtileIfAndStop.java | 55 +- .../ftile/vcompact/FtileIfDown.java | 6 +- .../ftile/vcompact/FtileIfLongHorizontal.java | 158 ++- .../ftile/vcompact/FtileIfLongVertical.java | 25 +- .../ftile/vcompact/FtileNoteAlone.java | 49 +- .../ftile/vcompact/FtileRepeat.java | 34 +- .../ftile/vcompact/FtileSplit1.java | 8 +- .../ftile/vcompact/FtileSwitch.java | 16 +- .../ftile/vcompact/FtileWhile.java | 175 ++- .../ftile/vcompact/FtileWithNoteOpale.java | 53 +- .../ftile/vcompact/FtileWithNotes.java | 54 +- .../ftile/vcompact/ParallelBuilderFork.java | 198 +++- .../ftile/vcompact/ParallelBuilderMerge.java | 68 +- .../ftile/vcompact/ParallelBuilderSplit.java | 367 ++++--- .../ftile/vcompact/ParallelBuilderSplit2.java | 264 ----- .../ftile/vcompact/ParallelFtilesBuilder.java | 126 --- .../vcompact/UGraphicInterceptorGoto.java | 6 +- .../UGraphicInterceptorOneSwimlane.java | 25 +- .../ftile/vcompact/VCompactFactory.java | 86 +- .../vcompact/cond/ConditionalBuilder.java | 80 +- .../vcompact/cond/FtileDimensionMemoize.java | 6 +- .../ftile/vcompact/cond/FtileIfNude.java | 6 +- .../vcompact/cond/FtileIfWithDiamonds.java | 10 +- .../ftile/vcompact/cond/FtileIfWithLinks.java | 6 +- .../ftile/vcompact/cond/FtileSwitchNude.java | 8 +- .../cond/FtileSwitchWithDiamonds.java | 14 +- .../cond/FtileSwitchWithManyLinks.java | 6 +- .../vcompact/cond/FtileSwitchWithOneLink.java | 11 +- .../ftile/vertical/FtileBlackBlock.java | 19 +- .../ftile/vertical/FtileBox.java | 185 +++- .../ftile/vertical/FtileCircleEnd.java | 35 +- .../ftile/vertical/FtileCircleSpot.java | 24 +- .../ftile/vertical/FtileCircleStart.java | 33 +- .../ftile/vertical/FtileCircleStop.java | 39 +- .../ftile/vertical/FtileDecorate.java | 6 +- .../ftile/vertical/FtileDecorateIn.java | 6 +- .../ftile/vertical/FtileDecorateOut.java | 6 +- .../ftile/vertical/FtileDecoratePointOut.java | 6 +- .../ftile/vertical/FtileDiamond.java | 48 +- .../ftile/vertical/FtileDiamondFoo1.java | 20 +- .../ftile/vertical/FtileDiamondInside.java | 47 +- .../ftile/vertical/FtileDiamondInside2.java | 38 +- .../ftile/vertical/FtileDiamondInside3.java | 31 +- .../ftile/vertical/FtileThinSplit.java | 25 +- .../plantuml/anim/AffineTransformation.java | 6 +- .../sourceforge/plantuml/anim/Animation.java | 6 +- .../plantuml/anim/AnimationDecoder.java | 6 +- .../plantuml/anim/AnimationScript.java | 6 +- .../plantuml/ant/CheckZipTask.java | 25 +- .../plantuml/ant/PlantUmlTask.java | 22 +- .../sourceforge/plantuml/api/ApiWarning.java | 6 +- .../sourceforge/plantuml/api/CountRate.java | 6 +- .../plantuml/api/INumberAnalyzed.java | 6 +- .../plantuml/api/ImageDataAbstract.java | 6 +- .../plantuml/api/ImageDataComplex.java | 6 +- .../plantuml/api/ImageDataSimple.java | 6 +- .../sourceforge/plantuml/api/MagicArray.java | 6 +- .../sourceforge/plantuml/api/MyRunnable.java | 6 +- .../sourceforge/plantuml/api/NiceNumber.java | 6 +- .../plantuml/api/NumberAnalyzed.java | 6 +- .../plantuml/api/NumberAnalyzed2.java | 6 +- .../plantuml/api/NumberAnalyzedDated.java | 6 +- .../plantuml/api/PSystemFactory.java | 6 +- .../plantuml/api/PlantumlUtils.java | 6 +- .../plantuml/api/TimeoutExecutor.java | 6 +- .../plantuml/api/mda/option2/MDADiagram.java | 6 +- .../plantuml/api/mda/option2/MDAEntity.java | 6 +- .../plantuml/api/mda/option2/MDAPackage.java | 6 +- .../plantuml/api/mda/option2/MDAUtils.java | 6 +- .../plantuml/api/mda/option3/MDAVisitor.java | 6 +- .../asciiart/AbstractComponentText.java | 10 +- .../plantuml/asciiart/AsciiShape.java | 6 +- .../plantuml/asciiart/BasicCharArea.java | 6 +- .../plantuml/asciiart/BasicCharAreaImpl.java | 6 +- .../asciiart/ComponentTextActiveLine.java | 6 +- .../plantuml/asciiart/ComponentTextActor.java | 6 +- .../plantuml/asciiart/ComponentTextArrow.java | 7 +- .../plantuml/asciiart/ComponentTextDelay.java | 6 +- .../asciiart/ComponentTextDestroy.java | 6 +- .../asciiart/ComponentTextDivider.java | 6 +- .../asciiart/ComponentTextGroupingBody.java | 6 +- .../asciiart/ComponentTextGroupingElse.java | 6 +- .../asciiart/ComponentTextGroupingHeader.java | 6 +- .../asciiart/ComponentTextGroupingTail.java | 6 +- .../plantuml/asciiart/ComponentTextLine.java | 6 +- .../asciiart/ComponentTextNewpage.java | 6 +- .../plantuml/asciiart/ComponentTextNote.java | 6 +- .../asciiart/ComponentTextParticipant.java | 6 +- .../asciiart/ComponentTextSelfArrow.java | 6 +- .../plantuml/asciiart/ComponentTextShape.java | 6 +- .../plantuml/asciiart/TextSkin.java | 6 +- .../plantuml/asciiart/TextStringBounder.java | 6 +- .../plantuml/asciiart/TranslatedCharArea.java | 6 +- .../plantuml/asciiart/UmlCharArea.java | 6 +- .../plantuml/asciiart/UmlCharAreaImpl.java | 6 +- .../plantuml/asciiart/Wcwidth.java | 6 +- .../plantuml/bpm/AbstractConnectorPuzzle.java | 6 +- .../sourceforge/plantuml/bpm/BpmBranch.java | 6 +- .../sourceforge/plantuml/bpm/BpmDiagram.java | 24 +- .../plantuml/bpm/BpmDiagramFactory.java | 6 +- .../sourceforge/plantuml/bpm/BpmElement.java | 31 +- .../plantuml/bpm/BpmElementType.java | 6 +- .../sourceforge/plantuml/bpm/BpmEvent.java | 6 +- .../sourceforge/plantuml/bpm/BpmEventAdd.java | 6 +- .../plantuml/bpm/BpmEventGoto.java | 6 +- .../plantuml/bpm/BpmEventResume.java | 6 +- .../net/sourceforge/plantuml/bpm/Cell.java | 6 +- .../net/sourceforge/plantuml/bpm/Chain.java | 6 +- .../sourceforge/plantuml/bpm/ChainImpl.java | 6 +- .../plantuml/bpm/CleanerEmptyLine.java | 6 +- .../bpm/CleanerInterleavingLines.java | 6 +- .../plantuml/bpm/CleanerMoveBlock.java | 10 +- .../src/net/sourceforge/plantuml/bpm/Col.java | 6 +- .../plantuml/bpm/CommandDockedEvent.java | 6 +- .../plantuml/bpm/CommandElseBranch.java | 6 +- .../plantuml/bpm/CommandEndBranch.java | 6 +- .../sourceforge/plantuml/bpm/CommandGoto.java | 6 +- .../plantuml/bpm/CommandMerge.java | 6 +- .../plantuml/bpm/CommandNewBranch.java | 6 +- .../plantuml/bpm/CommandResume.java | 6 +- .../plantuml/bpm/ConnectorPuzzle.java | 6 +- .../plantuml/bpm/ConnectorPuzzleEmpty.java | 19 +- .../net/sourceforge/plantuml/bpm/Coord.java | 6 +- .../sourceforge/plantuml/bpm/FootPrint.java | 6 +- .../net/sourceforge/plantuml/bpm/Grid.java | 6 +- .../sourceforge/plantuml/bpm/GridArray.java | 19 +- .../sourceforge/plantuml/bpm/GridCleaner.java | 6 +- .../net/sourceforge/plantuml/bpm/Line.java | 6 +- .../sourceforge/plantuml/bpm/Navigator.java | 6 +- .../sourceforge/plantuml/bpm/Navigators.java | 6 +- .../sourceforge/plantuml/bpm/Placeable.java | 6 +- .../plantuml/braille/BrailleChar.java | 6 +- .../plantuml/braille/BrailleCharFactory.java | 6 +- .../plantuml/braille/BrailleDrawer.java | 24 +- .../plantuml/braille/BrailleGrid.java | 6 +- .../plantuml/braille/BrailleUtils.java | 6 +- .../sourceforge/plantuml/braille/Coords.java | 6 +- .../DriverCenteredCharacterBraille.java | 8 +- .../braille/DriverDotPathBraille.java | 8 +- .../plantuml/braille/DriverLineBraille.java | 8 +- .../plantuml/braille/DriverNoneBraille.java | 8 +- .../braille/DriverPolygonBraille.java | 8 +- .../braille/DriverRectangleBraille.java | 8 +- .../plantuml/braille/DriverTextBraille.java | 8 +- .../plantuml/braille/UGraphicBraille.java | 23 +- .../plantuml/brotli/BitReader.java | 6 +- .../plantuml/brotli/BrotliInputStream.java | 6 +- .../brotli/BrotliRuntimeException.java | 6 +- .../sourceforge/plantuml/brotli/Context.java | 6 +- .../sourceforge/plantuml/brotli/Decode.java | 6 +- .../plantuml/brotli/Dictionary.java | 6 +- .../plantuml/brotli/DictionaryData.java | 6 +- .../sourceforge/plantuml/brotli/Huffman.java | 6 +- .../sourceforge/plantuml/brotli/State.java | 6 +- .../plantuml/brotli/Transform.java | 6 +- .../sourceforge/plantuml/brotli/Utils.java | 6 +- .../classdiagram/AbstractEntityDiagram.java | 6 +- .../plantuml/classdiagram/ClassDiagram.java | 134 +-- .../classdiagram/ClassDiagramFactory.java | 35 +- .../plantuml/classdiagram/FullLayout.java | 8 +- .../plantuml/classdiagram/RowLayout.java | 8 +- .../command/CommandAddMethod.java | 26 +- .../command/CommandAllowMixing.java | 6 +- .../command/CommandCreateClass.java | 56 +- .../command/CommandCreateClassMultilines.java | 101 +- .../command/CommandCreateElementFull2.java | 23 +- .../command/CommandDiamondAssociation.java | 18 +- .../command/CommandHideShow2.java | 6 +- .../command/CommandHideShowByGender.java | 71 +- .../command/CommandHideShowByVisibility.java | 39 +- .../command/CommandHideShowSpecificClass.java | 8 +- .../classdiagram/command/CommandImport.java | 122 --- .../command/CommandLayoutNewLine.java | 6 +- .../command/CommandLinkClass.java | 381 ++++--- .../command/CommandLinkLollipop.java | 35 +- .../command/CommandNamespaceSeparator.java | 11 +- .../command/CommandRemoveRestore.java | 6 +- .../command/CommandStereotype.java | 13 +- .../classdiagram/command/CommandUrl.java | 20 +- .../command/GenericRegexProducer.java | 6 +- .../classdiagram/command/JavaClass.java | 83 -- .../classdiagram/command/JavaFile.java | 107 -- .../code/ArobaseStringCompressor.java | 8 +- .../code/ArobaseStringCompressor2.java | 12 +- .../plantuml/code/AsciiEncoder.java | 6 +- .../plantuml/code/AsciiEncoderBase64.java | 6 +- .../plantuml/code/AsciiEncoderFinalZeros.java | 6 +- .../plantuml/code/AsciiEncoderHex.java | 6 +- .../plantuml/code/Base64Coder.java | 6 +- .../ByteArray.java} | 45 +- .../plantuml/code/Compression.java | 14 +- .../plantuml/code/CompressionBrotli.java | 25 +- .../plantuml/code/CompressionHuffman.java | 33 +- .../plantuml/code/CompressionNone.java | 10 +- .../plantuml/code/CompressionZlib.java | 63 +- .../plantuml/code/CompressionZlibPure.java | 83 ++ .../plantuml/code/CompressionZopfliZlib.java | 10 +- .../code/NoPlantumlCompressionException.java | 45 + .../sourceforge/plantuml/code/PairInt.java | 6 +- .../net/sourceforge/plantuml/code/Spiral.java | 6 +- .../plantuml/code/SpiralOnRectangle.java | 6 +- .../plantuml/code/StringCompressor.java | 8 +- .../plantuml/code/StringCompressorNone.java | 8 +- .../net/sourceforge/plantuml/code/Tokens.java | 212 ++++ .../sourceforge/plantuml/code/Transcoder.java | 8 +- .../plantuml/code/TranscoderImpl.java | 57 +- .../plantuml/code/TranscoderSmart.java | 57 +- .../plantuml/code/TranscoderSmart2.java | 27 +- .../plantuml/code/TranscoderSmartAttic.java | 103 ++ .../code/TranscoderSmartProtected.java | 176 ++++ .../code/TranscoderSmartProtectedPure.java | 176 ++++ .../plantuml/code/TranscoderUtil.java | 14 +- .../sourceforge/plantuml/code/URLEncoder.java | 6 +- .../plantuml/code/Upf9Decoder.java | 80 ++ .../plantuml/code/Upf9Encoder.java | 110 ++ .../plantuml/code/deflate/BitInputStream.java | 92 ++ .../code/deflate/ByteBitInputStream.java | 128 +++ .../plantuml/code/deflate/ByteHistory.java | 122 +++ .../plantuml/code/deflate/CanonicalCode.java | 204 ++++ .../plantuml/code/deflate/Decompressor.java | 330 ++++++ .../deflate/OutputStreamProtected.java} | 50 +- .../plantuml/command/BlocLines.java | 145 +-- .../sourceforge/plantuml/command/Command.java | 6 +- .../command/CommandAffineTransform.java | 6 +- .../CommandAffineTransformMultiline.java | 6 +- .../plantuml/command/CommandCaption.java | 6 +- .../plantuml/command/CommandControl.java | 6 +- .../command/CommandDecoratorMultine.java | 8 +- .../plantuml/command/CommandEndPackage.java | 6 +- .../command/CommandExecutionResult.java | 6 +- ...Command.java => CommandFactorySprite.java} | 75 +- .../command/CommandFootboxIgnored.java | 6 +- .../plantuml/command/CommandFooter.java | 21 +- .../plantuml/command/CommandHeader.java | 19 +- .../plantuml/command/CommandHideUnlinked.java | 6 +- .../plantuml/command/CommandMainframe.java | 6 +- .../plantuml/command/CommandMinwidth.java | 6 +- .../plantuml/command/CommandMultilines.java | 10 +- .../plantuml/command/CommandMultilines2.java | 18 +- .../plantuml/command/CommandMultilines3.java | 14 +- .../command/CommandMultilinesBracket.java | 8 +- .../command/CommandMultilinesCaption.java | 61 ++ .../command/CommandMultilinesComment.java | 6 +- .../command/CommandMultilinesFooter.java | 22 +- .../command/CommandMultilinesHeader.java | 22 +- .../command/CommandMultilinesLegend.java | 8 +- .../command/CommandMultilinesTitle.java | 6 +- .../plantuml/command/CommandNamespace.java | 28 +- .../plantuml/command/CommandNamespace2.java | 112 ++ .../command/CommandNamespaceEmpty.java | 107 ++ .../plantuml/command/CommandNope.java | 6 +- .../plantuml/command/CommandPackage.java | 44 +- .../plantuml/command/CommandPackageEmpty.java | 21 +- .../plantuml/command/CommandPage.java | 6 +- .../plantuml/command/CommandPragma.java | 6 +- .../plantuml/command/CommandRankDir.java | 6 +- .../plantuml/command/CommandRotate.java | 6 +- .../plantuml/command/CommandScale.java | 10 +- .../command/CommandScaleMaxHeight.java | 6 +- .../command/CommandScaleMaxWidth.java | 6 +- .../CommandScaleMaxWidthAndHeight.java | 6 +- .../command/CommandScaleWidthAndHeight.java | 6 +- .../command/CommandScaleWidthOrHeight.java | 6 +- .../plantuml/command/CommandSkinParam.java | 6 +- .../command/CommandSkinParamMultilines.java | 8 +- .../plantuml/command/CommandSpriteFile.java | 52 +- .../plantuml/command/CommandTitle.java | 6 +- .../plantuml/command/MultilinesStrategy.java | 6 +- .../command/PSystemAbstractFactory.java | 6 +- .../plantuml/command/PSystemBasicFactory.java | 6 +- .../command/PSystemSingleLineFactory.java | 6 +- .../plantuml/command/Position.java | 6 +- .../plantuml/command/ProtectedCommand.java | 6 +- .../plantuml/command/SingleLineCommand2.java | 20 +- .../plantuml/command/SkinLoader.java | 8 +- .../plantuml/command/UmlDiagramFactory.java | 27 +- .../note/CommandConstraintOnLinks.java | 83 ++ ...teCommand.java => CommandFactoryNote.java} | 26 +- ...d.java => CommandFactoryNoteActivity.java} | 37 +- ...d.java => CommandFactoryNoteOnEntity.java} | 75 +- ...and.java => CommandFactoryNoteOnLink.java} | 14 +- ...nd.java => CommandFactoryTipOnEntity.java} | 32 +- .../note/SingleMultiFactoryCommand.java | 6 +- .../FactorySequenceNoteAcrossCommand.java | 8 +- .../sequence/FactorySequenceNoteCommand.java | 8 +- .../FactorySequenceNoteOnArrowCommand.java | 16 +- ...FactorySequenceNoteOverSeveralCommand.java | 14 +- .../plantuml/command/regex/FoxSignature.java | 6 +- .../plantuml/command/regex/IRegex.java | 6 +- .../plantuml/command/regex/Matcher2.java | 9 +- .../command/regex/MatcherIterator.java | 6 +- .../plantuml/command/regex/MyPattern.java | 30 +- .../plantuml/command/regex/Pattern2.java | 6 +- .../plantuml/command/regex/RegexComposed.java | 34 +- .../plantuml/command/regex/RegexConcat.java | 23 +- .../plantuml/command/regex/RegexLeaf.java | 17 +- .../plantuml/command/regex/RegexOptional.java | 8 +- .../plantuml/command/regex/RegexOr.java | 8 +- .../command/regex/RegexPartialMatch.java | 6 +- .../plantuml/command/regex/RegexResult.java | 6 +- .../compositediagram/CompositeDiagram.java | 15 +- .../CompositeDiagramFactory.java | 6 +- .../command/CommandCreateBlock.java | 13 +- .../command/CommandCreatePackageBlock.java | 15 +- .../command/CommandEndPackageBlock.java | 6 +- .../command/CommandLinkBlock.java | 18 +- .../sourceforge/plantuml/core/Diagram.java | 6 +- .../plantuml/core/DiagramDescription.java | 6 +- .../plantuml/core/DiagramType.java | 11 +- .../sourceforge/plantuml/core/ImageData.java | 6 +- .../sourceforge/plantuml/core/UmlSource.java | 54 +- .../plantuml/creole/CreoleContext.java | 6 +- .../plantuml/creole/CreoleHorizontalLine.java | 17 +- .../plantuml/creole/CreoleMode.java | 6 +- .../sourceforge/plantuml/creole/Fission.java | 36 +- .../sourceforge/plantuml/creole/Parser.java | 85 ++ .../sourceforge/plantuml/creole/Position.java | 14 +- .../net/sourceforge/plantuml/creole/Sea.java | 10 +- .../sourceforge/plantuml/creole/Sheet.java | 8 +- .../plantuml/creole/SheetBlock1.java | 12 +- .../plantuml/creole/SheetBlock2.java | 29 +- .../plantuml/creole/SheetBuilder.java | 39 + .../sourceforge/plantuml/creole/Stencil.java | 6 +- .../sourceforge/plantuml/creole/Stripe.java | 12 +- .../plantuml/creole/StripeStyle.java | 9 +- .../plantuml/creole/StripeStyleType.java | 6 +- .../sourceforge/plantuml/creole/UCreole.java | 7 +- .../creole/{ => atom}/AbstractAtom.java | 11 +- .../plantuml/creole/{ => atom}/Atom.java | 8 +- .../{ => atom}/AtomHorizontalTexts.java | 10 +- .../plantuml/creole/{ => atom}/AtomImg.java | 115 +- .../creole/{ => atom}/AtomImgSvg.java | 8 +- .../plantuml/creole/{ => atom}/AtomMath.java | 36 +- .../creole/{ => atom}/AtomOpenIcon.java | 16 +- .../plantuml/creole/{ => atom}/AtomSpace.java | 8 +- .../creole/{ => atom}/AtomSprite.java | 25 +- .../plantuml/creole/{ => atom}/AtomTable.java | 53 +- .../plantuml/creole/{ => atom}/AtomTree.java | 23 +- .../creole/{ => atom}/AtomVerticalTexts.java | 10 +- .../creole/{ => atom}/AtomWithMargin.java | 35 +- .../plantuml/creole/{ => atom}/Bullet.java | 25 +- .../creole/{ => command}/Command.java | 14 +- .../CommandCreoleColorAndSizeChange.java | 15 +- .../CommandCreoleColorChange.java | 15 +- .../CommandCreoleExposantChange.java | 17 +- .../CommandCreoleFontFamilyChange.java | 9 +- .../{ => command}/CommandCreoleImg.java | 39 +- .../{ => command}/CommandCreoleLatex.java | 19 +- .../{ => command}/CommandCreoleMath.java | 19 +- .../CommandCreoleMonospaced.java | 11 +- .../{ => command}/CommandCreoleOpenIcon.java | 26 +- .../{ => command}/CommandCreoleQrcode.java | 12 +- .../CommandCreoleSizeChange.java | 9 +- .../{ => command}/CommandCreoleSpace.java | 9 +- .../{ => command}/CommandCreoleSprite.java | 26 +- .../{ => command}/CommandCreoleStyle.java | 18 +- .../CommandCreoleSvgAttributeChange.java | 9 +- .../{ => command}/CommandCreoleUrl.java | 17 +- .../creole/{ => legacy}/AtomText.java | 188 ++-- .../creole/{ => legacy}/CreoleParser.java | 53 +- .../CreoleStripeSimpleParser.java | 13 +- .../creole/{ => legacy}/PSystemCreole.java | 26 +- .../{ => legacy}/PSystemCreoleFactory.java | 8 +- .../creole/{ => legacy}/StripeSimple.java | 77 +- .../creole/{ => legacy}/StripeTable.java | 56 +- .../creole/{ => legacy}/StripeTree.java | 42 +- .../plantuml/creole/rosetta/AtomText22.java | 284 +++++ .../creole/rosetta/CreoleParser2.java | 73 ++ .../creole/rosetta/ReaderAbstractWiki.java | 135 +++ .../plantuml/creole/rosetta/ReaderCreole.java | 70 ++ .../creole/rosetta/ReaderDokuwiki.java | 356 +++++++ .../rosetta/ReaderWiki.java} | 16 +- .../plantuml/creole/rosetta/Rosetta.java | 95 ++ .../plantuml/creole/rosetta/StripeRow.java | 123 +++ .../plantuml/creole/rosetta/URosetta.java | 36 + .../plantuml/creole/rosetta/WikiLanguage.java | 140 +++ .../rosetta/WriterWiki.java} | 35 +- .../plantuml/cucadiagram/Bodier.java | 204 +--- .../plantuml/cucadiagram/BodierImpl.java | 231 ++++ .../plantuml/cucadiagram/BodierMap.java | 107 ++ .../plantuml/cucadiagram/BodyEnhanced.java | 64 +- .../plantuml/cucadiagram/BodyEnhanced2.java | 8 +- .../plantuml/cucadiagram/Code.java | 95 +- .../CodeImpl.java} | 65 +- .../plantuml/cucadiagram/CucaDiagram.java | 476 +++++++-- .../plantuml/cucadiagram/Display.java | 186 +++- .../cucadiagram/DisplayPositionned.java | 6 +- .../plantuml/cucadiagram/DisplaySection.java | 7 +- .../plantuml/cucadiagram/Election.java | 10 +- .../plantuml/cucadiagram/EntityGender.java | 6 +- .../cucadiagram/EntityGenderUtils.java | 14 +- .../plantuml/cucadiagram/EntityPort.java | 39 +- .../plantuml/cucadiagram/EntityPortion.java | 18 +- .../plantuml/cucadiagram/EntityPosition.java | 44 +- .../plantuml/cucadiagram/EntityUtils.java | 6 +- .../plantuml/cucadiagram/GroupHierarchy.java | 15 +- .../plantuml/cucadiagram/GroupPrinter.java | 17 +- .../plantuml/cucadiagram/GroupRoot.java | 52 +- .../plantuml/cucadiagram/GroupType.java | 6 +- .../plantuml/cucadiagram/HideOrShow2.java | 23 +- .../plantuml/cucadiagram/IEntity.java | 15 +- .../plantuml/cucadiagram/IGroup.java | 9 +- .../plantuml/cucadiagram/ILeaf.java | 6 +- .../plantuml/cucadiagram/Ident.java | 262 ++++- .../plantuml/cucadiagram/LeafType.java | 14 +- .../plantuml/cucadiagram/Link.java | 52 +- .../plantuml/cucadiagram/LinkArrow.java | 28 +- .../plantuml/cucadiagram/LinkConstraint.java | 100 ++ .../plantuml/cucadiagram/LinkDecor.java | 85 +- .../plantuml/cucadiagram/LinkHat.java | 6 +- .../plantuml/cucadiagram/LinkMiddleDecor.java | 10 +- .../plantuml/cucadiagram/LinkStyle.java | 6 +- .../plantuml/cucadiagram/LinkType.java | 53 +- .../plantuml/cucadiagram/LongCode.java | 87 -- .../plantuml/cucadiagram/Magma.java | 6 +- .../plantuml/cucadiagram/MagmaList.java | 6 +- .../plantuml/cucadiagram/Member.java | 171 ++- .../plantuml/cucadiagram/MemberImpl.java | 194 ---- .../cucadiagram/MethodsOrFieldsArea.java | 57 +- .../cucadiagram/NamespaceStrategy.java | 6 +- .../cucadiagram/NoteLinkStrategy.java | 6 +- .../plantuml/cucadiagram/PortionShower.java | 6 +- .../plantuml/cucadiagram/Rankdir.java | 6 +- .../plantuml/cucadiagram/RuleType.java | 6 +- .../plantuml/cucadiagram/SquareLinker.java | 6 +- .../plantuml/cucadiagram/SquareMaker.java | 6 +- .../plantuml/cucadiagram/Stereotag.java | 6 +- .../plantuml/cucadiagram/Stereotype.java | 36 +- .../plantuml/cucadiagram/SuperGroup.java | 48 + .../plantuml/cucadiagram/TextBlockMap.java | 203 ++++ .../UnparsableGraphvizException.java | 6 +- .../plantuml/cucadiagram/WithLinkType.java | 18 +- .../cucadiagram/dot/AbstractGraphviz.java | 14 +- .../dot/CucaDiagramSimplifierActivity.java | 6 +- .../dot/CucaDiagramSimplifierState.java | 6 +- .../cucadiagram/dot/CucaDiagramTxtMaker.java | 29 +- .../plantuml/cucadiagram/dot/DebugTrace.java | 13 +- .../plantuml/cucadiagram/dot/DotData.java | 19 +- .../plantuml/cucadiagram/dot/DotMaker2.java | 6 +- .../plantuml/cucadiagram/dot/DotSplines.java | 6 +- .../plantuml/cucadiagram/dot/ExeState.java | 6 +- .../plantuml/cucadiagram/dot/Graphviz.java | 6 +- .../cucadiagram/dot/GraphvizLinux.java | 6 +- .../cucadiagram/dot/GraphvizUtils.java | 44 +- .../cucadiagram/dot/GraphvizVersion.java | 6 +- .../dot/GraphvizVersionFinder.java | 6 +- .../cucadiagram/dot/GraphvizVersions.java | 6 +- .../cucadiagram/dot/GraphvizWindows.java | 56 +- .../cucadiagram/dot/Neighborhood.java | 6 +- .../cucadiagram/dot/ProcessRunner.java | 16 +- .../cucadiagram/dot/ProcessState.java | 6 +- .../cucadiagram/entity/EntityFactory.java | 474 +++++++-- .../cucadiagram/entity/EntityImpl.java | 236 ++++- .../plantuml/cute/ApolloniusSolver.java | 6 +- .../plantuml/cute/ApolloniusSolver2.java | 6 +- .../net/sourceforge/plantuml/cute/Arc.java | 6 +- .../sourceforge/plantuml/cute/Balloon.java | 6 +- .../plantuml/cute/BetweenCorners.java | 6 +- .../net/sourceforge/plantuml/cute/Cheese.java | 13 +- .../net/sourceforge/plantuml/cute/Circle.java | 6 +- .../net/sourceforge/plantuml/cute/Corner.java | 6 +- .../sourceforge/plantuml/cute/Crossing.java | 6 +- .../plantuml/cute/CrossingSegment.java | 6 +- .../plantuml/cute/CrossingSimple.java | 6 +- .../sourceforge/plantuml/cute/CutePath.java | 13 +- .../sourceforge/plantuml/cute/CuteShape.java | 6 +- .../plantuml/cute/CuteShapeFactory.java | 6 +- .../net/sourceforge/plantuml/cute/Group.java | 6 +- .../plantuml/cute/InfiniteLine.java | 6 +- .../sourceforge/plantuml/cute/MyDouble.java | 6 +- .../sourceforge/plantuml/cute/MyPoint2D.java | 6 +- .../plantuml/cute/PSystemCute.java | 23 +- .../plantuml/cute/PSystemCuteFactory.java | 6 +- .../plantuml/cute/Positionned.java | 6 +- .../plantuml/cute/PositionnedImpl.java | 22 +- .../sourceforge/plantuml/cute/Rectangle.java | 6 +- .../plantuml/cute/RotationZoom.java | 6 +- .../sourceforge/plantuml/cute/Segment.java | 6 +- .../net/sourceforge/plantuml/cute/Stick.java | 6 +- .../sourceforge/plantuml/cute/Tension.java | 6 +- .../sourceforge/plantuml/cute/Triangle.java | 13 +- .../plantuml/cute/TriangleCorner.java | 6 +- .../plantuml/cute/TriangleCornerSimple.java | 6 +- .../sourceforge/plantuml/cute/VarArgs.java | 20 +- .../dedication/DecoderInputStream.java | 6 +- .../plantuml/dedication/Dedication.java | 9 +- .../plantuml/dedication/Dedications.java | 6 +- .../dedication/PSystemDedication.java | 18 +- .../dedication/PSystemDedicationFactory.java | 6 +- .../plantuml/dedication/QBlock.java | 6 +- .../plantuml/dedication/QBlocks.java | 6 +- .../plantuml/dedication/TurningBytes.java | 6 +- .../definition/PSystemDefinition.java | 16 +- .../definition/PSystemDefinitionFactory.java | 6 +- .../plantuml/descdiagram/BoxedCharacter.java | 30 +- .../descdiagram/CommandCreateDomain.java | 32 +- .../descdiagram/DescriptionDiagram.java | 99 +- .../DescriptionDiagramFactory.java | 18 +- .../EntityImageDesignedDomain.java | 24 +- .../descdiagram/EntityImageDomain.java | 20 +- .../descdiagram/EntityImageMachine.java | 26 +- .../descdiagram/EntityImageRequirement.java | 23 +- .../descdiagram/command/CommandArchimate.java | 15 +- .../command/CommandArchimateMultilines.java | 17 +- .../command/CommandCreateElementFull.java | 95 +- .../CommandCreateElementMultilines.java | 51 +- .../CommandCreateElementParenthesis.java | 235 +++++ .../command/CommandLinkElement.java | 220 ++-- .../descdiagram/command/CommandNewpage.java | 6 +- .../command/CommandPackageWithUSymbol.java | 135 +-- .../plantuml/descdiagram/command/Labels.java | 111 ++ .../descdiagram/command/StringWithArrow.java | 140 +++ .../plantuml/directdot/PSystemDot.java | 14 +- .../plantuml/directdot/PSystemDotFactory.java | 8 +- .../plantuml/ditaa/PSystemDitaa.java | 36 +- .../plantuml/ditaa/PSystemDitaaFactory.java | 6 +- .../plantuml/donors/PSystemDonors.java | 86 +- .../plantuml/donors/PSystemDonorsFactory.java | 6 +- .../donors/PSystemSkinparameterList.java | 16 +- .../PSystemSkinparameterListFactory.java | 6 +- .../sourceforge/plantuml/eggs/EggUtils.java | 6 +- .../plantuml/eggs/GraphicsPath.java | 16 +- .../plantuml/eggs/PSystemAppleTwo.java | 12 +- .../plantuml/eggs/PSystemAppleTwoFactory.java | 6 +- .../plantuml/eggs/PSystemCharlie.java | 18 +- .../plantuml/eggs/PSystemCharlieFactory.java | 6 +- .../plantuml/eggs/PSystemColors.java | 50 +- .../plantuml/eggs/PSystemColorsFactory.java | 6 +- .../sourceforge/plantuml/eggs/PSystemEgg.java | 12 +- .../plantuml/eggs/PSystemEggFactory.java | 6 +- .../plantuml/eggs/PSystemLost.java | 12 +- .../plantuml/eggs/PSystemLostFactory.java | 6 +- .../plantuml/eggs/PSystemPath.java | 8 +- .../plantuml/eggs/PSystemPathFactory.java | 6 +- .../sourceforge/plantuml/eggs/PSystemRIP.java | 15 +- .../plantuml/eggs/PSystemRIPFactory.java | 6 +- .../plantuml/eggs/PSystemWelcome.java | 14 +- .../plantuml/eggs/PSystemWelcomeFactory.java | 6 +- .../plantuml/eggs/SentenceDecoder.java | 6 +- .../plantuml/eggs/SentenceProducer.java | 6 +- .../sourceforge/plantuml/eps/EpsGraphics.java | 85 +- .../plantuml/eps/EpsGraphicsMacro.java | 6 +- .../plantuml/eps/EpsGraphicsMacroAndText.java | 6 +- .../sourceforge/plantuml/eps/EpsStrategy.java | 6 +- .../plantuml/eps/PostScriptCommand.java | 6 +- .../eps/PostScriptCommandCurveTo.java | 6 +- .../plantuml/eps/PostScriptCommandLineTo.java | 6 +- .../plantuml/eps/PostScriptCommandMacro.java | 6 +- .../plantuml/eps/PostScriptCommandMoveTo.java | 6 +- .../plantuml/eps/PostScriptCommandQuadTo.java | 6 +- .../plantuml/eps/PostScriptCommandRaw.java | 6 +- .../plantuml/eps/PostScriptData.java | 6 +- .../plantuml/error/PSystemError.java | 125 ++- .../error/PSystemErrorPreprocessor.java | 6 +- .../plantuml/error/PSystemErrorUtils.java | 6 +- .../plantuml/error/PSystemErrorV2.java | 6 +- .../plantuml/evalex/AbstractFunction.java | 6 +- .../plantuml/evalex/AbstractLazyFunction.java | 6 +- .../plantuml/evalex/AbstractLazyOperator.java | 6 +- .../plantuml/evalex/AbstractOperator.java | 6 +- .../evalex/AbstractUnaryOperator.java | 6 +- .../plantuml/evalex/Expression.java | 6 +- .../sourceforge/plantuml/evalex/Function.java | 6 +- .../plantuml/evalex/LazyFunction.java | 6 +- .../plantuml/evalex/LazyOperator.java | 6 +- .../sourceforge/plantuml/evalex/NString.java | 6 +- .../sourceforge/plantuml/evalex/Operator.java | 6 +- .../sourceforge/plantuml/evalex/Snipset1.java | 6 +- .../sourceforge/plantuml/evalex/Snipset2.java | 6 +- .../sourceforge/plantuml/evalex/Snipset3.java | 6 +- .../plantuml/flashcode/FlashCodeFactory.java | 6 +- .../plantuml/flashcode/FlashCodeUtils.java | 6 +- .../flashcode/FlashCodeUtilsNone.java | 6 +- .../plantuml/flowdiagram/ActivityBox.java | 16 +- .../flowdiagram/CommandLineSimple.java | 6 +- .../plantuml/flowdiagram/CommandLink.java | 6 +- .../plantuml/flowdiagram/FlowDiagram.java | 18 +- .../flowdiagram/FlowDiagramFactory.java | 6 +- .../plantuml/font/PSystemListFonts.java | 12 +- .../font/PSystemListFontsFactory.java | 6 +- .../plantuml/ftp/FtpConnexion.java | 6 +- .../net/sourceforge/plantuml/ftp/FtpLoop.java | 14 +- .../sourceforge/plantuml/ftp/FtpServer.java | 6 +- .../sourceforge/plantuml/fun/IconLoader.java | 33 +- .../sourceforge/plantuml/fun/sprite021.png | Bin 2038 -> 1003 bytes .../sourceforge/plantuml/fun/sprite022.png | Bin 360 -> 352 bytes .../sourceforge/plantuml/fun/sprite023.png | Bin 770 -> 404 bytes .../sourceforge/plantuml/fun/sprite024.png | Bin 1472 -> 1011 bytes .../sourceforge/plantuml/fun/sprite025.png | Bin 1246 -> 553 bytes .../sourceforge/plantuml/fun/sprite026.png | Bin 996 -> 739 bytes .../sourceforge/plantuml/fun/sprite027.png | Bin 400 -> 221 bytes .../sourceforge/plantuml/fun/sprite028.png | Bin 1787 -> 1561 bytes .../sourceforge/plantuml/fun/sprite029.png | Bin 0 -> 731 bytes .../plantuml/geom/AbstractFigure.java | 6 +- .../plantuml/geom/AbstractLineSegment.java | 6 +- .../plantuml/geom/AbstractPolyline.java | 6 +- .../net/sourceforge/plantuml/geom/Box.java | 6 +- .../sourceforge/plantuml/geom/ClosedArea.java | 6 +- .../plantuml/geom/CollectionUtils.java | 6 +- .../sourceforge/plantuml/geom/Dijkstra.java | 6 +- .../plantuml/geom/InflateData.java | 6 +- .../plantuml/geom/InflationTransform.java | 6 +- .../sourceforge/plantuml/geom/Kingdom.java | 6 +- .../plantuml/geom/LineSegmentDouble.java | 6 +- .../plantuml/geom/LineSegmentInt.java | 6 +- .../plantuml/geom/Neighborhood.java | 6 +- .../plantuml/geom/Orientation.java | 6 +- .../sourceforge/plantuml/geom/Point2DInt.java | 6 +- .../sourceforge/plantuml/geom/Pointable.java | 6 +- .../sourceforge/plantuml/geom/Polyline.java | 6 +- .../plantuml/geom/PolylineBreakeable.java | 6 +- .../plantuml/geom/PolylineImpl.java | 6 +- .../plantuml/geom/Singularity.java | 6 +- .../sourceforge/plantuml/geom/SpiderWeb.java | 6 +- .../sourceforge/plantuml/geom/XMoveable.java | 6 +- .../plantuml/geom/kinetic/Frame.java | 6 +- .../plantuml/geom/kinetic/MoveObserver.java | 6 +- .../plantuml/geom/kinetic/Path.java | 6 +- .../plantuml/geom/kinetic/Point2DCharge.java | 6 +- .../plantuml/geom/kinetic/Quadrant.java | 6 +- .../plantuml/geom/kinetic/QuadrantMapper.java | 6 +- .../plantuml/geom/kinetic/SegmentCutter.java | 6 +- .../plantuml/geom/kinetic/VectorForce.java | 6 +- .../plantuml/geom/kinetic/World.java | 6 +- .../sourceforge/plantuml/golem/Magnet.java | 6 +- .../plantuml/golem/MinMaxDouble.java | 6 +- .../plantuml/golem/MinMaxGolem.java | 6 +- .../net/sourceforge/plantuml/golem/Path.java | 6 +- .../sourceforge/plantuml/golem/Position.java | 6 +- .../sourceforge/plantuml/golem/Square.java | 6 +- .../net/sourceforge/plantuml/golem/Tile.java | 11 +- .../sourceforge/plantuml/golem/TileArea.java | 6 +- .../plantuml/golem/TileGeometry.java | 6 +- .../plantuml/golem/TilesField.java | 11 +- .../net/sourceforge/plantuml/graph/ALink.java | 6 +- .../sourceforge/plantuml/graph/ALinkImpl.java | 6 +- .../net/sourceforge/plantuml/graph/ANode.java | 6 +- .../sourceforge/plantuml/graph/ANodeImpl.java | 6 +- .../plantuml/graph/AbstractEntityImage.java | 40 +- .../net/sourceforge/plantuml/graph/Board.java | 6 +- .../plantuml/graph/BoardCollection.java | 6 +- .../plantuml/graph/BoardExplorer.java | 6 +- .../plantuml/graph/CostComputer.java | 6 +- .../plantuml/graph/ElectricCharge.java | 6 +- .../plantuml/graph/ElectricWord.java | 6 +- .../graph/EntityImageActivityBar.java | 8 +- .../graph/EntityImageActivityBranch.java | 12 +- .../graph/EntityImageActivityCircle.java | 8 +- .../graph/EntityImageCircleInterface.java | 8 +- .../sourceforge/plantuml/graph/Galaxy4.java | 6 +- .../plantuml/graph/GeneralPathFactory.java | 6 +- .../sourceforge/plantuml/graph/Graph1.java | 6 +- .../net/sourceforge/plantuml/graph/Heap.java | 6 +- .../plantuml/graph/KenavoCostComputer.java | 6 +- .../plantuml/graph/LenghtLinkComparator.java | 6 +- .../plantuml/graph/LinkString.java | 6 +- .../plantuml/graph/MethodsOrFieldsArea.java | 6 +- .../net/sourceforge/plantuml/graph/Move.java | 6 +- .../net/sourceforge/plantuml/graph/Oven.java | 6 +- .../plantuml/graph/SimpleCostComputer.java | 6 +- .../plantuml/graph/SortedCollection.java | 6 +- .../graph/SortedCollectionArrayList.java | 6 +- .../graph/SortedCollectionLinked.java | 6 +- .../net/sourceforge/plantuml/graph/Zoda1.java | 6 +- .../net/sourceforge/plantuml/graph/Zoda2.java | 6 +- .../plantuml/graph2/CubicCurveFactory.java | 6 +- .../sourceforge/plantuml/graph2/Dijkstra.java | 6 +- .../plantuml/graph2/GeomUtils.java | 6 +- .../plantuml/graph2/IInflationTransform.java | 6 +- .../graph2/IdentityInflationTransform.java | 6 +- .../plantuml/graph2/InflateData2.java | 6 +- .../plantuml/graph2/InflationTransform2.java | 6 +- .../plantuml/graph2/MagicPointsFactory.java | 6 +- .../plantuml/graph2/MagicPointsFactory2.java | 6 +- .../sourceforge/plantuml/graph2/Measurer.java | 6 +- .../sourceforge/plantuml/graph2/MyCurve.java | 6 +- .../plantuml/graph2/Neighborhood2.java | 6 +- .../net/sourceforge/plantuml/graph2/Plan.java | 6 +- .../plantuml/graph2/Polyline2.java | 6 +- .../plantuml/graph2/RectanglesCollection.java | 6 +- .../plantuml/graph2/Singularity2.java | 6 +- .../plantuml/graph2/SortedList.java | 6 +- .../plantuml/graph2/SortedListImpl.java | 6 +- .../plantuml/graphic/AbstractTextBlock.java | 6 +- .../plantuml/graphic/AddStyle.java | 11 +- .../plantuml/graphic/CircledCharacter.java | 25 +- .../plantuml/graphic/ColorAndSizeChange.java | 14 +- .../plantuml/graphic/ColorChange.java | 14 +- .../plantuml/graphic/CoordinateChange.java | 6 +- .../plantuml/graphic/DisplayUtils.java | 6 +- .../plantuml/graphic/ExposantChange.java | 6 +- .../plantuml/graphic/FontChange.java | 6 +- .../plantuml/graphic/FontConfiguration.java | 82 +- .../plantuml/graphic/FontFamilyChange.java | 6 +- .../plantuml/graphic/FontPosition.java | 6 +- .../plantuml/graphic/FontStyle.java | 14 +- .../plantuml/graphic/GraphicPosition.java | 6 +- .../plantuml/graphic/GraphicStrings.java | 61 +- .../plantuml/graphic/HorizontalAlignment.java | 23 +- .../plantuml/graphic/HtmlColorAndStyle.java | 74 +- .../plantuml/graphic/HtmlColorUserDef.java | 35 - .../plantuml/graphic/HtmlCommand.java | 6 +- .../plantuml/graphic/HtmlCommandFactory.java | 6 +- .../net/sourceforge/plantuml/graphic/Img.java | 62 +- .../plantuml/graphic/ImgValign.java | 6 +- .../plantuml/graphic/InnerStrategy.java | 6 +- .../sourceforge/plantuml/graphic/Line.java | 6 +- .../plantuml/graphic/QuoteUtils.java | 532 +++++----- .../sourceforge/plantuml/graphic/Rainbow.java | 40 +- .../plantuml/graphic/RemoveStyle.java | 6 +- .../plantuml/graphic/ResetFont.java | 6 +- .../graphic/SimpleTextBlockBordered.java | 14 +- .../plantuml/graphic/SingleLine.java | 8 +- .../plantuml/graphic/SizeChange.java | 6 +- .../plantuml/graphic/SkinParameter.java | 127 ++- ...phicAddAriaLabel.java => SpecialText.java} | 41 +- .../plantuml/graphic/Splitter.java | 8 +- .../plantuml/graphic/SpriteCommand.java | 6 +- .../plantuml/graphic/StringBounder.java | 6 +- .../plantuml/graphic/SvgAttributes.java | 6 +- .../plantuml/graphic/SvgAttributesChange.java | 6 +- .../plantuml/graphic/SymbolContext.java | 65 +- .../sourceforge/plantuml/graphic/Text.java | 6 +- .../plantuml/graphic/TextBlock.java | 6 +- .../plantuml/graphic/TextBlockArrow.java | 15 +- .../plantuml/graphic/TextBlockBordered.java | 71 +- .../plantuml/graphic/TextBlockEmpty.java | 6 +- .../plantuml/graphic/TextBlockGeneric.java | 19 +- .../plantuml/graphic/TextBlockHorizontal.java | 8 +- .../plantuml/graphic/TextBlockLineBefore.java | 17 +- .../plantuml/graphic/TextBlockMarged.java | 41 +- .../plantuml/graphic/TextBlockMinWidth.java | 20 +- .../plantuml/graphic/TextBlockRaw.java | 8 +- .../plantuml/graphic/TextBlockRecentred.java | 9 +- .../plantuml/graphic/TextBlockSimple.java | 54 +- .../plantuml/graphic/TextBlockSprited.java | 22 +- .../plantuml/graphic/TextBlockTitle.java | 10 +- .../plantuml/graphic/TextBlockUtils.java | 90 +- .../plantuml/graphic/TextBlockVertical2.java | 21 +- .../plantuml/graphic/TextBlockWidth.java | 6 +- .../graphic/TextBlockWidthAdapter.java | 6 +- .../plantuml/graphic/TextBlockWithUrl.java | 8 +- .../plantuml/graphic/TextLink.java | 6 +- .../plantuml/graphic/TileImage.java | 11 +- .../plantuml/graphic/TileImageSvg.java | 17 +- .../plantuml/graphic/TileText.java | 11 +- .../plantuml/graphic/UDrawable.java | 6 +- .../plantuml/graphic/UDrawableUtils.java | 6 +- .../plantuml/graphic/UGraphicDelegator.java | 25 +- .../graphic/UGraphicInterceptorUDrawable.java | 6 +- .../sourceforge/plantuml/graphic/USymbol.java | 85 +- .../plantuml/graphic/USymbolActor.java | 19 +- .../plantuml/graphic/USymbolArtifact.java | 12 +- .../plantuml/graphic/USymbolBoundary.java | 6 +- .../plantuml/graphic/USymbolCard.java | 25 +- .../plantuml/graphic/USymbolCloud.java | 19 +- .../plantuml/graphic/USymbolCollections.java | 19 +- .../plantuml/graphic/USymbolComponent1.java | 15 +- .../plantuml/graphic/USymbolComponent2.java | 8 +- .../plantuml/graphic/USymbolControl.java | 6 +- .../plantuml/graphic/USymbolDatabase.java | 25 +- .../plantuml/graphic/USymbolEntityDomain.java | 8 +- .../plantuml/graphic/USymbolFile.java | 6 +- .../plantuml/graphic/USymbolFolder.java | 16 +- .../plantuml/graphic/USymbolFrame.java | 58 +- .../plantuml/graphic/USymbolInterface.java | 6 +- .../plantuml/graphic/USymbolLabel.java | 121 +++ .../plantuml/graphic/USymbolNode.java | 25 +- .../plantuml/graphic/USymbolQueue.java | 10 +- .../plantuml/graphic/USymbolRect.java | 36 +- .../graphic/USymbolSimpleAbstract.java | 23 +- .../plantuml/graphic/USymbolStack.java | 23 +- .../plantuml/graphic/USymbolStorage.java | 11 +- .../plantuml/graphic/USymbolTogether.java | 6 +- .../plantuml/graphic/UnusedSpace.java | 8 +- .../plantuml/graphic/VerticalAlignment.java | 6 +- .../plantuml/graphic/VerticalPosition.java | 6 +- .../plantuml/graphic/color/ColorParser.java | 10 +- .../plantuml/graphic/color/ColorType.java | 6 +- .../plantuml/graphic/color/Colors.java | 26 +- .../sourceforge/plantuml/hector/Box2D.java | 6 +- .../hector/CucaDiagramFileMakerHectorB1.java | 16 +- .../plantuml/hector/GrowingTree.java | 6 +- .../plantuml/hector/HectorPath.java | 13 +- .../net/sourceforge/plantuml/hector/Pin.java | 6 +- .../plantuml/hector/PinFactory.java | 6 +- .../sourceforge/plantuml/hector/PinLink.java | 6 +- .../hector/PinLinksContinuousSet.java | 6 +- .../sourceforge/plantuml/hector/Skeleton.java | 6 +- .../plantuml/hector/SkeletonBuilder.java | 6 +- .../hector/SkeletonConfiguration.java | 6 +- .../SkeletonConfigurationComparator.java | 6 +- .../SkeletonConfigurationEvaluator.java | 6 +- ...letonConfigurationEvaluatorLineLenght.java | 6 +- .../hector/SkeletonConfigurationSet.java | 6 +- .../hector/SkeletonConfigurationUtils.java | 6 +- .../hector/SkeletonConfigurations.java | 6 +- .../plantuml/hector/SkeletonMutation.java | 6 +- .../plantuml/hector/SmartConnection.java | 21 +- .../hector/UnlinarCompressedPlan.java | 6 +- .../plantuml/hector/UnlinearCompression.java | 6 +- .../sourceforge/plantuml/hector2/MinMax.java | 6 +- .../plantuml/hector2/continuity/Skeleton.java | 6 +- .../hector2/continuity/SkeletonBuilder.java | 6 +- .../plantuml/hector2/graphic/Foo1.java | 6 +- .../plantuml/hector2/graphic/Foo2.java | 8 +- .../plantuml/hector2/layering/Layer.java | 6 +- .../hector2/layering/LayerFactory.java | 6 +- .../plantuml/hector2/mpos/Distribution.java | 6 +- .../plantuml/hector2/mpos/MutationLayer.java | 6 +- .../hector2/mpos/MutationLayerMove.java | 6 +- .../plantuml/help/CommandHelp.java | 6 +- .../plantuml/help/CommandHelpColor.java | 10 +- .../plantuml/help/CommandHelpFont.java | 6 +- .../plantuml/help/CommandHelpKeyword.java | 6 +- .../plantuml/help/CommandHelpSkinparam.java | 6 +- .../plantuml/help/CommandHelpType.java | 6 +- .../net/sourceforge/plantuml/help/Help.java | 17 +- .../plantuml/help/HelpFactory.java | 6 +- .../plantuml/html/CucaDiagramHtmlMaker.java | 31 +- .../plantuml/html/LinkHtmlPrinter.java | 16 +- .../jdot/CucaDiagramFileMakerJDot.java | 151 ++- .../sourceforge/plantuml/jdot/DebugUtils.java | 6 +- .../sourceforge/plantuml/jdot/JDotPath.java | 28 +- .../sourceforge/plantuml/jdot/YMirror.java | 6 +- .../net/sourceforge/plantuml/json/Json.java | 6 +- .../sourceforge/plantuml/json/JsonArray.java | 6 +- .../plantuml/json/JsonHandler.java | 6 +- .../plantuml/json/JsonLiteral.java | 6 +- .../sourceforge/plantuml/json/JsonNumber.java | 6 +- .../sourceforge/plantuml/json/JsonObject.java | 6 +- .../sourceforge/plantuml/json/JsonParser.java | 6 +- .../sourceforge/plantuml/json/JsonString.java | 6 +- .../sourceforge/plantuml/json/JsonValue.java | 6 +- .../sourceforge/plantuml/json/JsonWriter.java | 6 +- .../sourceforge/plantuml/json/Location.java | 6 +- .../plantuml/json/ParseException.java | 6 +- .../plantuml/json/PrettyPrint.java | 6 +- .../plantuml/json/WriterConfig.java | 6 +- .../plantuml/json/WritingBuffer.java | 6 +- .../plantuml/jungle/CommandAddLevel.java | 6 +- .../plantuml/jungle/CommandEmpty.java | 6 +- .../sourceforge/plantuml/jungle/GNode.java | 6 +- .../plantuml/jungle/GNodeUtils.java | 6 +- .../sourceforge/plantuml/jungle/GTile.java | 6 +- .../plantuml/jungle/GTileGeometry.java | 6 +- .../plantuml/jungle/GTileLeftRight.java | 15 +- .../plantuml/jungle/GTileNode.java | 21 +- .../plantuml/jungle/GTileOneLevelFactory.java | 6 +- .../plantuml/jungle/GTileStack.java | 8 +- .../sourceforge/plantuml/jungle/Needle.java | 11 +- .../plantuml/jungle/PSystemTree.java | 25 +- .../plantuml/jungle/PSystemTreeFactory.java | 6 +- .../plantuml/jungle/Rendering.java | 6 +- .../plantuml/math/ASCIIMathTeXImg.js | 863 +++++++++++++++ .../sourceforge/plantuml/math/AsciiMath.java | 18 +- .../plantuml/math/AsciiMathOld.java | 12 +- .../plantuml/math/AsciiMathParser.js | 846 +++++++++++++++ .../plantuml/math/ConverterSvg.java | 6 +- .../plantuml/math/LatexBuilder.java | 74 +- .../plantuml/math/PSystemLatex.java | 58 +- .../plantuml/math/PSystemLatexFactory.java | 6 +- .../plantuml/math/PSystemMath.java | 16 +- .../plantuml/math/PSystemMathFactory.java | 6 +- .../plantuml/math/ScientificEquation.java | 16 +- .../plantuml/math/ScientificEquationSafe.java | 32 +- .../plantuml/math/TeXIconBuilder.java | 6 +- .../plantuml/mda/MDADiagramImpl.java | 8 +- .../plantuml/mda/MDAEntityImpl.java | 8 +- .../plantuml/mda/MDAPackageImpl.java | 8 +- .../mindmap/CommandMindMapDirection.java | 6 +- .../plantuml/mindmap/CommandMindMapLeft.java | 9 +- .../mindmap/CommandMindMapLeftNumber.java | 9 +- .../mindmap/CommandMindMapOrgmode.java | 14 +- .../CommandMindMapOrgmodeMultiline.java | 97 ++ .../plantuml/mindmap/CommandMindMapPlus.java | 10 +- .../plantuml/mindmap/CommandMindMapRight.java | 11 +- .../mindmap/CommandMindMapRightNumber.java | 9 +- .../plantuml/mindmap/CommandMindMapRoot.java | 9 +- .../mindmap/CommandMindMapTabulation.java | 18 +- .../sourceforge/plantuml/mindmap/Finger.java | 6 +- .../plantuml/mindmap/FingerImpl.java | 230 ++-- .../plantuml/mindmap/FingerImpl2.java | 218 ---- .../sourceforge/plantuml/mindmap/Idea.java | 37 +- .../plantuml/mindmap/IdeaShape.java | 6 +- .../plantuml/mindmap/MindMapDiagram.java | 94 +- .../mindmap/MindMapDiagramFactory.java | 7 +- .../sourceforge/plantuml/mindmap/Stripe.java | 6 +- .../plantuml/mindmap/StripeFrontier.java | 6 +- .../plantuml/mindmap/SymetricalTee.java | 6 +- .../mindmap/SymetricalTeePositioned.java | 6 +- .../sourceforge/plantuml/mindmap/Tetris.java | 6 +- .../plantuml/mjpeg/MJPEGGenerator.java | 994 ++++++++---------- .../plantuml/nwdiag/CommandComment.java | 6 +- .../plantuml/nwdiag/CommandElement.java | 6 +- .../plantuml/nwdiag/CommandEndSomething.java | 6 +- .../plantuml/nwdiag/CommandGroup.java | 6 +- .../plantuml/nwdiag/CommandLink.java | 6 +- .../plantuml/nwdiag/CommandNetwork.java | 6 +- .../plantuml/nwdiag/CommandNwDiagInit.java | 6 +- .../plantuml/nwdiag/CommandProperty.java | 6 +- .../plantuml/nwdiag/DiagElement.java | 22 +- .../plantuml/nwdiag/DiagGroup.java | 14 +- .../nwdiag/GridTextBlockDecorated.java | 17 +- .../plantuml/nwdiag/GridTextBlockSimple.java | 6 +- .../plantuml/nwdiag/LinkedElement.java | 15 +- .../sourceforge/plantuml/nwdiag/Network.java | 14 +- .../plantuml/nwdiag/NwDiagram.java | 85 +- .../plantuml/nwdiag/NwDiagramFactory.java | 6 +- .../AbstractClassOrObjectDiagram.java | 63 +- .../objectdiagram/ObjectDiagramFactory.java | 110 -- .../objectdiagram/command/CommandAddData.java | 13 +- .../command/CommandCreateEntityObject.java | 17 +- .../CommandCreateEntityObjectMultilines.java | 25 +- .../command/CommandCreateMap.java | 138 +++ .../plantuml/openiconic/Movement.java | 6 +- .../plantuml/openiconic/OpenIcon.java | 19 +- .../openiconic/PSystemListOpenIconic.java | 14 +- .../PSystemListOpenIconicFactory.java | 6 +- .../openiconic/PSystemOpenIconic.java | 29 +- .../openiconic/PSystemOpenIconicFactory.java | 6 +- .../plantuml/openiconic/StringDecipher.java | 6 +- .../plantuml/openiconic/SvgCommand.java | 6 +- .../plantuml/openiconic/SvgCommandLetter.java | 6 +- .../plantuml/openiconic/SvgCommandNumber.java | 6 +- .../plantuml/openiconic/SvgPath.java | 6 +- .../plantuml/openiconic/SvgPosition.java | 6 +- .../plantuml/openiconic/data/DummyIcon.java | 6 +- .../plantuml/oregon/BasicGame.java | 6 +- .../sourceforge/plantuml/oregon/Keyboard.java | 6 +- .../plantuml/oregon/KeyboardList.java | 6 +- .../plantuml/oregon/MagicTable.java | 6 +- .../plantuml/oregon/NoInputException.java | 6 +- .../plantuml/oregon/OregonBasicGame.java | 6 +- .../plantuml/oregon/PSystemOregon.java | 12 +- .../plantuml/oregon/PSystemOregonFactory.java | 6 +- .../sourceforge/plantuml/oregon/Screen.java | 6 +- .../plantuml/oregon/SecureCoder.java | 6 +- .../plantuml/oregon/SmartKeyboard.java | 6 +- .../plantuml/pdf/PdfConverter.java | 6 +- .../sourceforge/plantuml/png/Metadata.java | 15 +- .../sourceforge/plantuml/png/MetadataTag.java | 19 +- .../plantuml/png/PngFlashcoder.java | 6 +- .../net/sourceforge/plantuml/png/PngIO.java | 19 +- .../plantuml/png/PngIOMetadata.java | 12 +- .../sourceforge/plantuml/png/PngRotation.java | 6 +- .../sourceforge/plantuml/png/PngSegment.java | 6 +- .../sourceforge/plantuml/png/PngSizer.java | 6 +- .../sourceforge/plantuml/png/PngSplitter.java | 19 +- .../sourceforge/plantuml/png/PngTitler.java | 21 +- .../plantuml/posimo/AbstractEntityImage2.java | 12 +- .../plantuml/posimo/BezierUtils.java | 6 +- .../sourceforge/plantuml/posimo/Block.java | 6 +- .../sourceforge/plantuml/posimo/Cluster.java | 6 +- .../plantuml/posimo/Clusterable.java | 6 +- .../sourceforge/plantuml/posimo/Decor.java | 6 +- .../posimo/DecorInterfaceProvider.java | 6 +- .../sourceforge/plantuml/posimo/DotPath.java | 55 +- .../plantuml/posimo/DotxMaker.java | 6 +- .../plantuml/posimo/EntityImageNote2.java | 6 +- .../sourceforge/plantuml/posimo/Frame.java | 23 +- .../plantuml/posimo/GraphvizSolverB.java | 24 +- .../plantuml/posimo/IEntityImageBlock.java | 6 +- .../sourceforge/plantuml/posimo/Label.java | 6 +- .../plantuml/posimo/LabelImage.java | 6 +- .../plantuml/posimo/LineRectIntersection.java | 6 +- .../posimo/LineSegmentIntersection.java | 6 +- .../plantuml/posimo/MargedBlock.java | 6 +- .../sourceforge/plantuml/posimo/Mirror.java | 6 +- .../sourceforge/plantuml/posimo/Moveable.java | 6 +- .../net/sourceforge/plantuml/posimo/Path.java | 16 +- .../plantuml/posimo/PathDrawer.java | 6 +- .../plantuml/posimo/PathDrawerInterface.java | 22 +- .../plantuml/posimo/Positionable.java | 6 +- .../plantuml/posimo/PositionableImpl.java | 6 +- .../plantuml/posimo/PositionableUtils.java | 6 +- .../sourceforge/plantuml/posimo/Racorder.java | 6 +- .../plantuml/posimo/RacorderAbstract.java | 6 +- .../posimo/RacorderFollowTangeante.java | 6 +- .../posimo/RacorderFollowTangeanteOld.java | 6 +- .../plantuml/posimo/RacorderInToCenter.java | 6 +- .../plantuml/posimo/RacorderOrthogonal.java | 6 +- .../plantuml/posimo/SimpleDrawer.java | 6 +- .../plantuml/posimo/TwoLinesIntersection.java | 6 +- .../net/sourceforge/plantuml/postit/Area.java | 6 +- .../plantuml/postit/AreaLayout.java | 6 +- .../plantuml/postit/AreaLayoutFixedWidth.java | 6 +- .../plantuml/postit/CommandCreatePostIt.java | 6 +- .../plantuml/postit/CommandWidth.java | 6 +- .../sourceforge/plantuml/postit/Elastic.java | 6 +- .../plantuml/postit/PostIdDiagramFactory.java | 6 +- .../sourceforge/plantuml/postit/PostIt.java | 18 +- .../plantuml/postit/PostItDiagram.java | 12 +- .../sourceforge/plantuml/preproc/Define.java | 10 +- .../plantuml/preproc/DefineSignature.java | 6 +- .../plantuml/preproc/DefineVariable.java | 6 +- .../sourceforge/plantuml/preproc/Defines.java | 68 +- .../plantuml/preproc/EvalBoolean.java | 6 +- .../plantuml/preproc/EvalMath.java | 6 +- .../plantuml/preproc/FileWithSuffix.java | 120 ++- .../plantuml/preproc/IfManager.java | 121 --- .../plantuml/preproc/ImportedFiles.java | 78 +- .../plantuml/preproc/NumericCompare.java | 6 +- .../plantuml/preproc/ReadLine.java | 6 +- .../preproc/ReadLineInstrumented.java | 93 -- .../plantuml/preproc/ReadLineList.java | 6 +- .../plantuml/preproc/ReadLineNumbered.java | 10 +- .../plantuml/preproc/ReadLineReader.java | 15 +- .../plantuml/preproc/ReadLineSimple.java | 6 +- .../preproc/StartDiagramExtractReader.java | 24 +- .../sourceforge/plantuml/preproc/Stdlib.java | 58 +- .../net/sourceforge/plantuml/preproc/Sub.java | 64 +- .../sourceforge/plantuml/preproc/Sub2.java | 88 -- .../sourceforge/plantuml/preproc/Truth.java | 6 +- .../plantuml/preproc/UncommentReadLine.java | 21 +- .../plantuml/preproc/Variables.java | 6 +- .../plantuml/preproc2/Preprocessor.java | 67 +- .../preproc2/PreprocessorDefineApply.java | 86 -- .../preproc2/PreprocessorDefineLearner.java | 177 ---- .../preproc2/PreprocessorInclude.java | 376 ------- .../preproc2/PreprocessorIncludeStrategy.java | 6 +- .../preproc2/PreprocessorModeSet.java | 10 +- .../plantuml/preproc2/PreprocessorUtils.java | 133 +++ .../plantuml/preproc2/ReadFilter.java | 6 +- ...ddConfig.java => ReadFilterAddConfig.java} | 12 +- .../plantuml/preproc2/ReadFilterAnd.java | 6 +- .../preproc2/ReadFilterMergeLines.java | 84 ++ ...mment.java => ReadFilterQuoteComment.java} | 19 +- .../plantuml/preproc2/ReadLineInsertable.java | 72 -- .../plantuml/preproc2/SubPreprocessor.java | 194 ---- .../{project3 => project}/Arrows.java | 8 +- .../plantuml/project/Completion.java | 47 + .../{project3 => project}/ConstantPlan.java | 12 +- .../{project3 => project}/DaysAsDates.java | 36 +- .../{project3 => project}/Failable.java | 8 +- .../{project3 => project}/GanttArrow.java | 30 +- .../GanttConstraint.java | 32 +- .../{project3 => project}/GanttDiagram.java | 465 ++++---- .../GanttDiagramFactory.java | 37 +- .../DefinesGet.java => project/Load.java} | 28 +- .../{project3 => project}/LoadPlanable.java | 12 +- .../{project3 => project}/PlanUtils.java | 14 +- .../{project3 => project}/Solver3.java | 28 +- .../plantuml/{project3 => project}/Today.java | 10 +- .../plantuml/{project3 => project}/Value.java | 8 +- .../project/command/CommandColorTask.java | 77 ++ .../command}/CommandGanttArrow.java | 13 +- .../command}/CommandGanttArrow2.java | 10 +- .../command}/CommandPage.java | 9 +- .../project/command/CommandPrintBetween.java | 75 ++ .../project/command/CommandPrintScale.java | 71 ++ .../command}/CommandSeparator.java | 9 +- .../command}/NaturalCommand.java | 17 +- .../command}/NaturalCommandAnd.java | 16 +- .../command}/NaturalCommandAndAnd.java | 15 +- .../core/AbstractTask.java} | 48 +- .../{project3 => project/core}/Moment.java | 14 +- .../core}/MomentImpl.java | 20 +- .../core/PrintScale.java} | 36 +- .../plantuml/project/core/Resource.java | 113 ++ .../{project3 => project/core}/Task.java | 40 +- .../core}/TaskAttribute.java | 8 +- .../{project3 => project/core}/TaskCode.java | 8 +- .../{project3 => project/core}/TaskImpl.java | 83 +- .../core}/TaskInstant.java | 17 +- .../core}/TaskSeparator.java | 45 +- .../project/draw/AbstractTaskDraw.java | 68 ++ .../plantuml/project/draw/PathUtils.java | 63 ++ .../draw}/ResourceDraw.java | 39 +- .../{project3 => project/draw}/TaskDraw.java | 15 +- .../project/draw/TaskDrawDiamond.java | 103 ++ .../project/draw/TaskDrawRegular.java | 148 +++ .../draw}/TaskDrawSeparator.java | 55 +- .../plantuml/project/draw/TimeHeader.java | 110 ++ .../project/draw/TimeHeaderDaily.java | 207 ++++ .../project/draw/TimeHeaderMonthly.java | 144 +++ .../project/draw/TimeHeaderSimple.java | 91 ++ .../project/draw/TimeHeaderWeekly.java | 138 +++ .../lang}/Complement.java | 8 +- ...lementBeforeOrAfterOrAtTaskStartOrEnd.java | 90 ++ .../lang}/ComplementClose.java | 10 +- .../lang}/ComplementColors.java | 26 +- .../lang/ComplementCompleted.java} | 34 +- .../lang}/ComplementDate.java | 18 +- .../lang}/ComplementDates.java | 24 +- .../lang/ComplementDayOfWeek.java} | 27 +- .../lang}/ComplementEmpty.java | 10 +- .../lang}/ComplementInColors.java | 16 +- .../lang}/ComplementInColors2.java | 16 +- .../lang}/ComplementName.java | 8 +- .../lang}/ComplementNamed.java | 10 +- .../lang}/ComplementOpen.java | 10 +- .../lang}/ComplementPattern.java | 10 +- .../project/lang/ComplementSeveralDays.java | 65 ++ .../plantuml/project/lang/ComplementUrl.java | 57 + .../{project3 => project/lang}/Subject.java | 8 +- .../lang}/SubjectDayAsDate.java | 12 +- .../lang}/SubjectDayOfWeek.java | 10 +- .../lang}/SubjectDaysAsDates.java | 23 +- .../lang}/SubjectPattern.java | 9 +- .../lang}/SubjectProject.java | 9 +- .../lang}/SubjectResource.java | 11 +- .../lang}/SubjectTask.java | 17 +- .../lang}/SubjectToday.java | 10 +- .../{project3 => project/lang}/Verb.java | 8 +- .../{project3 => project/lang}/VerbAre.java | 10 +- .../{project3 => project/lang}/VerbEnds.java | 13 +- .../lang}/VerbHappens.java | 21 +- .../lang}/VerbIsColored.java | 10 +- .../lang}/VerbIsColoredForToday.java | 10 +- .../lang}/VerbIsDeleted.java | 10 +- .../lang/VerbIsForTask.java} | 23 +- .../lang}/VerbIsForToday.java | 14 +- .../plantuml/project/lang/VerbIsOff.java | 87 ++ .../lang/VerbIsOn.java} | 34 +- .../lang}/VerbIsOrAre.java | 35 +- .../lang}/VerbIsOrAreNamed.java | 13 +- .../{project3 => project/lang}/VerbLasts.java | 11 +- .../plantuml/project/lang/VerbLinksTo.java | 65 ++ .../lang}/VerbPattern.java | 9 +- .../project/lang/VerbProjectStarts.java | 80 ++ .../lang}/VerbTaskEndsAbsolute.java | 15 +- .../lang}/VerbTaskStarts.java | 13 +- .../lang}/VerbTaskStartsAbsolute.java | 15 +- .../plantuml/project/time/Day.java | 184 ++++ .../{project3 => project/time}/DayOfWeek.java | 12 +- .../time/GCalendar.java} | 26 +- .../{project3 => project/time}/Month.java | 17 +- .../plantuml/project/time/MonthYear.java | 104 ++ .../plantuml/project/time/Wink.java | 82 ++ .../timescale}/TimeScale.java | 16 +- .../timescale/TimeScaleCompressed.java | 58 + .../project/timescale/TimeScaleDaily.java | 64 ++ .../timescale/TimeScaleWink.java} | 22 +- .../UnusedTimeScaleWithoutWeekEnd.java} | 29 +- .../plantuml/project3/DayAsDate.java | 135 --- .../plantuml/project3/GCalendar.java | 41 - .../plantuml/project3/TaskDrawRegular.java | 159 --- .../plantuml/project3/TimeScaleBasic2.java | 74 -- .../plantuml/real/AbstractReal.java | 6 +- .../plantuml/real/PositiveForce.java | 6 +- .../net/sourceforge/plantuml/real/Real.java | 6 +- .../sourceforge/plantuml/real/RealDelta.java | 6 +- .../sourceforge/plantuml/real/RealImpl.java | 6 +- .../sourceforge/plantuml/real/RealLine.java | 6 +- .../sourceforge/plantuml/real/RealMax.java | 6 +- .../sourceforge/plantuml/real/RealMiddle.java | 6 +- .../plantuml/real/RealMiddle2.java | 6 +- .../sourceforge/plantuml/real/RealMin.java | 6 +- .../plantuml/real/RealMoveable.java | 6 +- .../sourceforge/plantuml/real/RealOrigin.java | 6 +- .../sourceforge/plantuml/real/RealUtils.java | 6 +- .../net/sourceforge/plantuml/salt/Cell.java | 6 +- .../sourceforge/plantuml/salt/DataSource.java | 6 +- .../plantuml/salt/DataSourceImpl.java | 6 +- .../sourceforge/plantuml/salt/Dictionary.java | 23 +- .../plantuml/salt/PSystemSalt.java | 38 +- .../plantuml/salt/PSystemSaltFactory.java | 6 +- .../sourceforge/plantuml/salt/Position.java | 6 +- .../plantuml/salt/Positionner2.java | 6 +- .../sourceforge/plantuml/salt/Terminated.java | 6 +- .../sourceforge/plantuml/salt/Terminator.java | 6 +- .../salt/element/AbstractElement.java | 6 +- .../salt/element/AbstractElementText.java | 6 +- .../plantuml/salt/element/Element.java | 6 +- .../plantuml/salt/element/ElementBorder.java | 10 +- .../plantuml/salt/element/ElementButton.java | 13 +- .../salt/element/ElementDroplist.java | 24 +- .../plantuml/salt/element/ElementEmpty.java | 6 +- .../plantuml/salt/element/ElementImage.java | 6 +- .../plantuml/salt/element/ElementLine.java | 21 +- .../plantuml/salt/element/ElementMenuBar.java | 15 +- .../salt/element/ElementMenuEntry.java | 17 +- .../salt/element/ElementMenuPopup.java | 15 +- .../plantuml/salt/element/ElementPyramid.java | 6 +- .../salt/element/ElementPyramidScrolled.java | 29 +- .../salt/element/ElementRadioCheckbox.java | 50 +- .../plantuml/salt/element/ElementTabBar.java | 24 +- .../plantuml/salt/element/ElementText.java | 6 +- .../salt/element/ElementTextField.java | 12 +- .../plantuml/salt/element/ElementTree.java | 11 +- .../salt/element/ElementTreeEntry.java | 6 +- .../plantuml/salt/element/Grid.java | 16 +- .../plantuml/salt/element/Grid2.java | 18 +- .../plantuml/salt/element/LeftFirst.java | 6 +- .../plantuml/salt/element/ListWidth.java | 6 +- .../plantuml/salt/element/Segment.java | 6 +- .../plantuml/salt/element/Skeleton.java | 10 +- .../plantuml/salt/element/Skeleton2.java | 12 +- .../plantuml/salt/element/TableStrategy.java | 6 +- .../plantuml/salt/element/TopFirst.java | 6 +- .../plantuml/salt/element/WrappedElement.java | 6 +- .../AbstractElementFactoryComplex.java | 6 +- .../plantuml/salt/factory/ElementFactory.java | 6 +- .../salt/factory/ElementFactoryBorder.java | 6 +- .../salt/factory/ElementFactoryButton.java | 6 +- .../factory/ElementFactoryCheckboxOff.java | 6 +- .../factory/ElementFactoryCheckboxOn.java | 6 +- .../salt/factory/ElementFactoryDroplist.java | 6 +- .../salt/factory/ElementFactoryImage.java | 6 +- .../salt/factory/ElementFactoryLine.java | 6 +- .../salt/factory/ElementFactoryMenu.java | 6 +- .../salt/factory/ElementFactoryPyramid.java | 6 +- .../salt/factory/ElementFactoryRadioOff.java | 6 +- .../salt/factory/ElementFactoryRadioOn.java | 6 +- .../ElementFactoryRetrieveFromDictonnary.java | 6 +- .../salt/factory/ElementFactoryScroll.java | 6 +- .../salt/factory/ElementFactoryTab.java | 6 +- .../salt/factory/ElementFactoryText.java | 6 +- .../salt/factory/ElementFactoryTextField.java | 6 +- .../salt/factory/ElementFactoryTree.java | 6 +- .../plantuml/salt/factory/ScrollStrategy.java | 6 +- .../plantuml/security/ImageIO.java | 102 ++ .../sourceforge/plantuml/security/SFile.java | 356 +++++++ .../sourceforge/plantuml/security/SURL.java | 243 +++++ .../plantuml/security/SecurityProfile.java | 154 +++ .../plantuml/security/SecurityUtils.java | 147 +++ .../sequencediagram/AbstractEvent.java | 6 +- .../sequencediagram/AbstractMessage.java | 27 +- .../plantuml/sequencediagram/AutoNumber.java | 6 +- .../plantuml/sequencediagram/Delay.java | 10 +- .../plantuml/sequencediagram/Divider.java | 10 +- .../sequencediagram/DottedNumber.java | 6 +- .../plantuml/sequencediagram/Englober.java | 17 +- .../plantuml/sequencediagram/Event.java | 6 +- .../sequencediagram/EventWithDeactivate.java | 6 +- .../plantuml/sequencediagram/Grouping.java | 26 +- .../sequencediagram/GroupingLeaf.java | 16 +- .../sequencediagram/GroupingStart.java | 14 +- .../sequencediagram/GroupingType.java | 6 +- .../plantuml/sequencediagram/HSpace.java | 6 +- .../plantuml/sequencediagram/InGroupable.java | 6 +- .../sequencediagram/InGroupableList.java | 6 +- .../plantuml/sequencediagram/LifeEvent.java | 6 +- .../sequencediagram/LifeEventType.java | 6 +- .../plantuml/sequencediagram/LinkAnchor.java | 13 +- .../plantuml/sequencediagram/Message.java | 8 +- .../plantuml/sequencediagram/MessageExo.java | 18 +- .../sequencediagram/MessageExoType.java | 32 +- .../sequencediagram/MessageNumber.java | 6 +- .../plantuml/sequencediagram/Newpage.java | 6 +- .../plantuml/sequencediagram/Note.java | 32 +- .../sequencediagram/NotePosition.java | 8 +- .../plantuml/sequencediagram/NoteStyle.java | 12 +- .../plantuml/sequencediagram/NoteType.java | 6 +- .../plantuml/sequencediagram/Notes.java | 6 +- .../plantuml/sequencediagram/Participant.java | 81 +- .../sequencediagram/ParticipantEnglober.java | 20 +- .../sequencediagram/ParticipantType.java | 26 +- .../plantuml/sequencediagram/Reference.java | 40 +- .../sequencediagram/SequenceDiagram.java | 58 +- .../SequenceDiagramFactory.java | 13 +- .../command/CommandActivate.java | 12 +- .../command/CommandActivate2.java | 6 +- .../sequencediagram/command/CommandArrow.java | 90 +- .../command/CommandAutoNewpage.java | 6 +- .../command/CommandAutoactivate.java | 6 +- .../command/CommandAutonumber.java | 6 +- .../command/CommandAutonumberIncrement.java | 6 +- .../command/CommandAutonumberResume.java | 6 +- .../command/CommandAutonumberStop.java | 6 +- .../command/CommandBoxEnd.java | 6 +- .../command/CommandBoxStart.java | 30 +- .../command/CommandDeactivateShort.java | 8 +- .../sequencediagram/command/CommandDelay.java | 6 +- .../command/CommandDivider.java | 6 +- .../command/CommandExoArrowAny.java | 61 +- .../command/CommandExoArrowLeft.java | 11 +- .../command/CommandExoArrowRight.java | 11 +- .../command/CommandFootbox.java | 6 +- .../command/CommandFootboxOld.java | 6 +- .../command/CommandGrouping.java | 14 +- .../command/CommandHSpace.java | 6 +- .../command/CommandIgnoreNewpage.java | 6 +- .../command/CommandLinkAnchor.java | 6 +- .../command/CommandNewpage.java | 6 +- .../command/CommandParticipant.java | 6 +- .../command/CommandParticipantA.java | 6 +- .../command/CommandParticipantA2.java | 6 +- .../command/CommandParticipantA3.java | 6 +- .../command/CommandParticipantA4.java | 6 +- ...CommandReferenceMultilinesOverSeveral.java | 16 +- .../command/CommandReferenceOverSeveral.java | 14 +- .../command/CommandReturn.java | 33 +- .../sequencediagram/command/CommandSkin.java | 6 +- .../sequencediagram/command/CommandUrl.java | 6 +- .../sequencediagram/graphic/Arrow.java | 9 +- .../graphic/ArrowAndNoteBox.java | 6 +- .../graphic/ArrowAndParticipant.java | 13 +- .../sequencediagram/graphic/Constraint.java | 6 +- .../graphic/ConstraintSet.java | 6 +- .../sequencediagram/graphic/DrawableSet.java | 11 +- .../graphic/DrawableSetInitializer.java | 7 +- .../sequencediagram/graphic/FileMaker.java | 6 +- .../graphic/FreeYStrategy.java | 6 +- .../graphic/FreeYStrategyBasic.java | 6 +- .../sequencediagram/graphic/Frontier.java | 6 +- .../graphic/FrontierComplex.java | 6 +- .../graphic/FrontierSimple.java | 6 +- .../graphic/FrontierStack.java | 6 +- .../graphic/FrontierStackImpl.java | 6 +- .../graphic/GraphicalDelayText.java | 6 +- .../graphic/GraphicalDivider.java | 8 +- .../graphic/GraphicalElement.java | 6 +- .../graphic/GraphicalElementLiveEvent.java | 6 +- .../graphic/GraphicalHSpace.java | 6 +- .../graphic/GraphicalNewpage.java | 8 +- .../graphic/GraphicalReference.java | 8 +- .../graphic/GroupingGraphicalElement.java | 6 +- .../graphic/GroupingGraphicalElementElse.java | 6 +- .../GroupingGraphicalElementHeader.java | 8 +- .../graphic/GroupingGraphicalElementTail.java | 6 +- .../graphic/InGroupablesStack.java | 6 +- .../sequencediagram/graphic/Lazy.java | 6 +- .../sequencediagram/graphic/LifeDestroy.java | 6 +- .../sequencediagram/graphic/LifeLine.java | 14 +- .../graphic/LifeSegmentVariation.java | 6 +- .../graphic/LivingParticipantBox.java | 6 +- .../sequencediagram/graphic/MessageArrow.java | 6 +- .../graphic/MessageExoArrow.java | 6 +- .../graphic/MessageSelfArrow.java | 6 +- .../sequencediagram/graphic/NoteBox.java | 8 +- .../sequencediagram/graphic/NotesBoxes.java | 6 +- .../sequencediagram/graphic/Page.java | 6 +- .../sequencediagram/graphic/PageSplitter.java | 6 +- .../graphic/ParticipantBox.java | 12 +- .../graphic/ParticipantBoxSimple.java | 6 +- .../graphic/ParticipantRange.java | 6 +- .../sequencediagram/graphic/Pushable.java | 6 +- .../sequencediagram/graphic/Segment.java | 6 +- .../graphic/SegmentColored.java | 12 +- .../graphic/SequenceDiagramArea.java | 6 +- .../SequenceDiagramFileMakerPuma2.java | 66 +- .../graphic/SequenceDiagramTxtMaker.java | 16 +- .../sequencediagram/graphic/Stairs.java | 6 +- .../graphic/Step1Abstract.java | 6 +- .../sequencediagram/graphic/Step1Message.java | 11 +- .../graphic/Step1MessageExo.java | 7 +- .../sequencediagram/puma/FixedLink.java | 6 +- .../sequencediagram/puma/PSegment.java | 6 +- .../sequencediagram/puma/PUnivers.java | 6 +- .../sequencediagram/puma/PushDirection.java | 6 +- .../sequencediagram/puma/PushSide.java | 6 +- .../sequencediagram/puma/PushStrategy.java | 6 +- .../sequencediagram/puma/SegmentPosition.java | 6 +- .../sequencediagram/teoz/AbstractTile.java | 8 +- .../sequencediagram/teoz/Bordered.java | 6 +- .../teoz/CommunicationExoTile.java | 8 +- .../teoz/CommunicationTile.java | 12 +- .../teoz/CommunicationTileNoteBottom.java | 150 +++ .../teoz/CommunicationTileNoteLeft.java | 8 +- .../teoz/CommunicationTileNoteRight.java | 8 +- .../teoz/CommunicationTileNoteTop.java | 151 +++ .../teoz/CommunicationTileSelf.java | 8 +- .../teoz/CommunicationTileSelfNoteRight.java | 8 +- .../teoz/ComponentAdapter.java | 6 +- .../sequencediagram/teoz/DelayTile.java | 8 +- .../sequencediagram/teoz/DividerTile.java | 8 +- .../sequencediagram/teoz/ElseTile.java | 6 +- .../sequencediagram/teoz/EmptyTile.java | 6 +- .../sequencediagram/teoz/Englobers.java | 6 +- .../sequencediagram/teoz/EventsHistory.java | 6 +- .../teoz/EventsHistoryMode.java | 6 +- .../sequencediagram/teoz/GroupingTile.java | 30 +- .../sequencediagram/teoz/HSpaceTile.java | 6 +- .../sequencediagram/teoz/IntegerColored.java | 6 +- .../sequencediagram/teoz/LifeEventTile.java | 8 +- .../sequencediagram/teoz/LiveBoxFinder.java | 28 +- .../sequencediagram/teoz/LiveBoxes.java | 8 +- .../sequencediagram/teoz/LiveBoxesDrawer.java | 23 +- .../sequencediagram/teoz/LivingSpace.java | 12 +- .../sequencediagram/teoz/LivingSpaces.java | 8 +- .../sequencediagram/teoz/MutingLine.java | 8 +- .../sequencediagram/teoz/NewpageTile.java | 6 +- .../sequencediagram/teoz/NoteTile.java | 9 +- .../sequencediagram/teoz/NotesTile.java | 8 +- .../sequencediagram/teoz/PlayingSpace.java | 28 +- .../teoz/PlayingSpaceWithParticipants.java | 29 +- .../sequencediagram/teoz/ReferenceTile.java | 8 +- .../teoz/SequenceDiagramFileMakerTeoz.java | 98 +- .../sequencediagram/teoz/Stairs2.java | 6 +- .../sequencediagram/teoz/StairsPosition.java | 6 +- .../sequencediagram/teoz/TeozLayer.java | 6 +- .../plantuml/sequencediagram/teoz/Tile.java | 8 +- .../sequencediagram/teoz/TileArguments.java | 10 +- .../sequencediagram/teoz/TileBuilder.java | 12 +- .../sequencediagram/teoz/TileMarged.java | 6 +- .../sequencediagram/teoz/TileParallel.java | 15 +- .../sequencediagram/teoz/TileUtils.java | 6 +- .../teoz/TileWithCallbackY.java | 6 +- .../teoz/TileWithUpdateStairs.java | 6 +- .../teoz/UGraphicInterceptorTile.java | 6 +- .../teoz/UGraphicNewpages.java | 6 +- .../sequencediagram/teoz/YPositionedTile.java | 13 +- .../plantuml/skin/AbstractComponent.java | 10 +- .../skin/AbstractTextualComponent.java | 36 +- .../plantuml/skin/ActorAwesome.java | 106 ++ .../{StickMan.java => ActorStickMan.java} | 25 +- .../sourceforge/plantuml/skin/ActorStyle.java | 59 ++ .../net/sourceforge/plantuml/skin/Area.java | 6 +- .../sourceforge/plantuml/skin/ArrowBody.java | 6 +- .../plantuml/skin/ArrowComponent.java | 6 +- .../plantuml/skin/ArrowConfiguration.java | 16 +- .../plantuml/skin/ArrowDecoration.java | 6 +- .../plantuml/skin/ArrowDirection.java | 6 +- .../plantuml/skin/ArrowDressing.java | 6 +- .../sourceforge/plantuml/skin/ArrowHead.java | 6 +- .../sourceforge/plantuml/skin/ArrowPart.java | 6 +- .../plantuml/skin/CircleInterface.java | 22 +- .../sourceforge/plantuml/skin/Component.java | 6 +- .../plantuml/skin/ComponentType.java | 41 +- .../sourceforge/plantuml/skin/Context2D.java | 6 +- .../net/sourceforge/plantuml/skin/Padder.java | 42 +- .../plantuml/skin/SimpleContext2D.java | 6 +- .../plantuml/skin/VisibilityModifier.java | 38 +- .../skin/bluemodern/FillRoundShape.java | 75 -- .../skin/rose/AbstractComponentRoseArrow.java | 24 +- .../skin/rose/ComponentRoseActiveLine.java | 35 +- .../skin/rose/ComponentRoseActor.java | 23 +- .../skin/rose/ComponentRoseArrow.java | 45 +- .../skin/rose/ComponentRoseBoundary.java | 16 +- .../skin/rose/ComponentRoseControl.java | 15 +- .../skin/rose/ComponentRoseDatabase.java | 16 +- .../skin/rose/ComponentRoseDelayLine.java | 17 +- .../skin/rose/ComponentRoseDelayText.java | 6 +- .../skin/rose/ComponentRoseDestroy.java | 17 +- .../skin/rose/ComponentRoseDivider.java | 43 +- .../skin/rose/ComponentRoseEnglober.java | 10 +- .../skin/rose/ComponentRoseEntity.java | 14 +- .../skin/rose/ComponentRoseGroupingElse.java | 35 +- .../rose/ComponentRoseGroupingHeader.java | 36 +- .../skin/rose/ComponentRoseGroupingSpace.java | 10 +- .../plantuml/skin/rose/ComponentRoseLine.java | 22 +- .../skin/rose/ComponentRoseNewpage.java | 17 +- .../plantuml/skin/rose/ComponentRoseNote.java | 7 +- .../skin/rose/ComponentRoseNoteBox.java | 19 +- .../skin/rose/ComponentRoseNoteHexagonal.java | 13 +- .../skin/rose/ComponentRoseParticipant.java | 39 +- .../skin/rose/ComponentRoseQueue.java | 13 +- .../skin/rose/ComponentRoseReference.java | 50 +- .../skin/rose/ComponentRoseSelfArrow.java | 32 +- .../sourceforge/plantuml/skin/rose/Rose.java | 388 ++++--- .../{ugraphic => }/sprite/ColorPalette.java | 22 +- .../sprite/ColorPalette4096.java | 22 +- .../plantuml/sprite/CommandListSprite.java | 59 ++ .../plantuml/sprite/CommandStdlib.java | 62 ++ .../plantuml/sprite/ListSpriteDiagram.java | 128 +++ .../sprite/ListSpriteDiagramFactory.java | 63 ++ .../sprite/PSystemListInternalSprites.java | 18 +- .../PSystemListInternalSpritesFactory.java | 8 +- .../sprite/RessourcesUtils.java | 16 +- .../{ugraphic => }/sprite/Sprite.java | 12 +- .../{ugraphic => }/sprite/SpriteColor.java | 30 +- .../sprite/SpriteColorBuilder.java | 8 +- .../sprite/SpriteColorBuilder4096.java | 8 +- .../sprite/SpriteGrayLevel.java | 34 +- .../{ugraphic => }/sprite/SpriteImage.java | 26 +- .../sprite/SpriteMonochrome.java | 42 +- .../{ugraphic => }/sprite/SpriteSvg.java | 24 +- .../{ugraphic => }/sprite/SpriteUtils.java | 8 +- .../plantuml/sprite/StdlibDiagram.java | 168 +++ .../StdlibDiagramFactory.java} | 40 +- .../plantuml/statediagram/StateDiagram.java | 153 ++- .../statediagram/StateDiagramFactory.java | 22 +- .../statediagram/command/CommandAddField.java | 21 +- .../command/CommandConcurrentState.java | 6 +- .../command/CommandCreatePackageState.java | 19 +- .../command/CommandCreateState.java | 25 +- .../statediagram/command/CommandEndState.java | 6 +- .../command/CommandHideEmptyDescription.java | 6 +- .../command/CommandLinkState.java | 106 +- .../plantuml/stats/CreoleConverter.java | 6 +- .../plantuml/stats/FormatCounter.java | 6 +- .../plantuml/stats/HistoricalData.java | 6 +- .../plantuml/stats/HtmlConverter.java | 6 +- .../plantuml/stats/HumanDuration.java | 6 +- .../plantuml/stats/PSystemStats.java | 12 +- .../plantuml/stats/PSystemStatsFactory.java | 6 +- .../plantuml/stats/ParsedGenerated.java | 6 +- .../sourceforge/plantuml/stats/StatsImpl.java | 6 +- .../plantuml/stats/StatsLineImpl.java | 6 +- .../plantuml/stats/StatsTableImpl.java | 6 +- .../plantuml/stats/StatsUtils.java | 20 +- .../plantuml/stats/StatsUtilsIncrement.java | 15 +- .../plantuml/stats/TextConverter.java | 6 +- .../sourceforge/plantuml/stats/TextTable.java | 6 +- .../plantuml/stats/XmlConverter.java | 12 +- .../sourceforge/plantuml/stats/api/Stats.java | 6 +- .../plantuml/stats/api/StatsColumn.java | 6 +- .../plantuml/stats/api/StatsLine.java | 6 +- .../plantuml/stats/api/StatsTable.java | 6 +- .../plantuml/style/AutomaticCounter.java | 6 +- .../style/ClockwiseTopRightBottomLeft.java | 85 +- .../plantuml/style/CommandStyleImport.java | 95 ++ .../style/CommandStyleMultilines.java | 120 --- .../style/CommandStyleMultilinesCSS.java | 73 ++ .../plantuml/style/FromSkinparamToStyle.java | 221 +++- .../net/sourceforge/plantuml/style/PName.java | 11 +- .../net/sourceforge/plantuml/style/SName.java | 105 +- .../net/sourceforge/plantuml/style/Style.java | 167 ++- .../plantuml/style/StyleBuilder.java | 89 +- .../plantuml/style/StyleDefinition.java | 96 -- .../plantuml/style/StyleLoader.java | 136 ++- .../plantuml/style/StyleSignature.java | 205 ++++ .../sourceforge/plantuml/style/Styleable.java | 8 +- .../net/sourceforge/plantuml/style/Value.java | 14 +- .../plantuml/style/ValueAbstract.java | 16 +- .../plantuml/style/ValueColor.java | 23 +- .../sourceforge/plantuml/style/ValueImpl.java | 23 +- .../sourceforge/plantuml/style/ValueNull.java | 39 +- .../sourceforge/plantuml/style/WithStyle.java | 6 +- .../plantuml/svek/AbstractEntityImage.java | 16 +- .../svek/AbstractExtremityFactory.java | 6 +- .../plantuml/svek/ArithmeticStrategy.java | 6 +- .../plantuml/svek/ArithmeticStrategyMax.java | 6 +- .../plantuml/svek/ArithmeticStrategySum.java | 6 +- .../plantuml/svek/Bibliotekon.java | 58 +- .../sourceforge/plantuml/svek/Boundary.java | 12 +- .../plantuml/svek/CircleAndArrow.java | 6 +- .../plantuml/svek/CircleInterface2.java | 20 +- .../sourceforge/plantuml/svek/Cluster.java | 472 +++++---- .../plantuml/svek/ClusterDecoration.java | 12 +- .../plantuml/svek/ClusterPosition.java | 6 +- .../plantuml/svek/ColorSequence.java | 6 +- .../plantuml/svek/ConcurrentStateImage.java | 31 +- .../plantuml/svek/ConditionEndStyle.java | 6 +- .../plantuml/svek/ConditionStyle.java | 6 +- .../sourceforge/plantuml/svek/Control.java | 9 +- .../plantuml/svek/CucaDiagramFileMaker.java | 6 +- .../svek/CucaDiagramFileMakerSvek.java | 35 +- ...ucaDiagramFileMakerSvek2InternalImage.java | 27 +- .../plantuml/svek/DecorateEntityImage.java | 12 +- .../plantuml/svek/DecorateEntityImage3.java | 14 +- .../plantuml/svek/DirectionalTextBlock.java | 80 ++ .../sourceforge/plantuml/svek/DotMode.java | 6 +- .../plantuml/svek/DotStringFactory.java | 102 +- .../plantuml/svek/EmptySvgException.java | 6 +- .../plantuml/svek/EntityDomain.java | 8 +- .../plantuml/svek/EntityImageDegenerated.java | 101 ++ .../plantuml/svek/EntityImageProtected.java | 10 +- .../plantuml/svek/FrontierCalculator.java | 6 +- .../plantuml/svek/GeneralImageBuilder.java | 500 +++++---- .../plantuml/svek/GraphvizCrash.java | 33 +- .../plantuml/svek/GroupPngMakerActivity.java | 69 +- .../plantuml/svek/GroupPngMakerState.java | 49 +- .../Load.java => svek/GuideLine.java} | 14 +- .../plantuml/svek/HeaderLayout.java | 6 +- .../plantuml/svek/IEntityImage.java | 6 +- .../plantuml/svek/IShapePseudo.java | 8 +- .../plantuml/svek/InnerActivity.java | 32 +- .../plantuml/svek/InnerStateAutonom.java | 23 +- .../net/sourceforge/plantuml/svek/Line.java | 348 +++--- .../sourceforge/plantuml/svek/Margins.java | 6 +- .../sourceforge/plantuml/svek/MinFinder.java | 6 +- .../plantuml/svek/{Shape.java => Node.java} | 68 +- .../sourceforge/plantuml/svek/Oscillator.java | 6 +- .../plantuml/svek/PackageStyle.java | 16 +- .../plantuml/svek/Point2DFunction.java | 6 +- .../plantuml/svek/PointAndAngle.java | 6 +- .../plantuml/svek/PointDirected.java | 6 +- .../plantuml/svek/PointListIterator.java | 6 +- .../plantuml/svek/PointListIteratorImpl.java | 6 +- .../plantuml/svek/PortGeometry.java | 6 +- .../net/sourceforge/plantuml/svek/Ports.java | 29 +- .../plantuml/svek/RoundedContainer.java | 37 +- .../plantuml/svek/ShapePseudoImpl.java | 10 +- .../sourceforge/plantuml/svek/ShapeType.java | 6 +- .../net/sourceforge/plantuml/svek/Side.java | 6 +- .../plantuml/svek/SingleStrategy.java | 6 +- .../sourceforge/plantuml/svek/SvekResult.java | 74 +- .../sourceforge/plantuml/svek/SvekUtils.java | 15 +- .../sourceforge/plantuml/svek/SvgResult.java | 12 +- .../plantuml/svek/TextBlockBackcolored.java | 10 +- .../plantuml/svek/UGraphicForSnake.java | 8 +- .../plantuml/svek/Untranslated.java | 6 +- .../sourceforge/plantuml/svek/WithPorts.java | 6 +- .../net/sourceforge/plantuml/svek/YDelta.java | 6 +- .../plantuml/svek/extremity/Extremity.java | 6 +- .../svek/extremity/ExtremityArrow.java | 26 +- .../extremity/ExtremityArrowAndCircle.java | 23 +- .../svek/extremity/ExtremityCircle.java | 43 +- .../extremity/ExtremityCircleConnect.java | 11 +- .../svek/extremity/ExtremityCircleCross.java | 11 +- .../extremity/ExtremityCircleCrowfoot.java | 6 +- .../svek/extremity/ExtremityCircleLine.java | 6 +- .../svek/extremity/ExtremityCrowfoot.java | 6 +- .../svek/extremity/ExtremityDiamond.java | 18 +- .../svek/extremity/ExtremityDoubleLine.java | 6 +- .../svek/extremity/ExtremityExtends.java | 15 +- .../svek/extremity/ExtremityExtendsLike.java | 170 +++ .../svek/extremity/ExtremityFactory.java | 6 +- .../svek/extremity/ExtremityFactoryArrow.java | 6 +- .../ExtremityFactoryArrowAndCircle.java | 6 +- .../extremity/ExtremityFactoryCircle.java | 19 +- .../ExtremityFactoryCircleConnect.java | 6 +- .../ExtremityFactoryCircleCross.java | 6 +- .../ExtremityFactoryCircleCrowfoot.java | 6 +- .../extremity/ExtremityFactoryCircleLine.java | 6 +- .../extremity/ExtremityFactoryCrowfoot.java | 9 +- .../extremity/ExtremityFactoryDiamond.java | 12 +- .../extremity/ExtremityFactoryDoubleLine.java | 6 +- .../extremity/ExtremityFactoryExtends.java | 12 +- .../ExtremityFactoryExtendsLike.java | 68 ++ .../extremity/ExtremityFactoryHalfArrow.java | 52 + .../ExtremityFactoryLineCrowfoot.java | 6 +- .../ExtremityFactoryNotNavigable.java | 6 +- .../ExtremityFactoryParenthesis.java | 6 +- .../svek/extremity/ExtremityFactoryPlus.java | 6 +- .../extremity/ExtremityFactorySquarre.java | 6 +- .../extremity/ExtremityFactoryTriangle.java | 6 +- .../svek/extremity/ExtremityHalfArrow.java | 76 ++ .../svek/extremity/ExtremityLineCrowfoot.java | 6 +- .../svek/extremity/ExtremityNotNavigable.java | 6 +- .../svek/extremity/ExtremityOther.java | 6 +- .../svek/extremity/ExtremityParenthesis.java | 6 +- .../svek/extremity/ExtremityParenthesis2.java | 10 +- .../svek/extremity/ExtremityPlus.java | 11 +- .../svek/extremity/ExtremitySquarre.java | 11 +- .../svek/extremity/ExtremityStateLine1.java | 13 +- .../svek/extremity/ExtremityStateLine2.java | 13 +- .../svek/extremity/ExtremityTriangle.java | 13 +- .../plantuml/svek/extremity/MiddleCircle.java | 15 +- .../svek/extremity/MiddleCircleCircled.java | 22 +- .../extremity/MiddleCircleCircledMode.java | 6 +- .../svek/extremity/MiddleFactory.java | 6 +- .../svek/extremity/MiddleFactoryCircle.java | 12 +- .../extremity/MiddleFactoryCircleCircled.java | 12 +- .../svek/image/AbstractEntityImageBorder.java | 91 ++ .../plantuml/svek/image/Circle.java | 6 +- .../plantuml/svek/image/ConnectedCircle.java | 12 +- .../svek/image/ContainingEllipse.java | 6 +- .../svek/image/EntityImageActivity.java | 78 +- .../svek/image/EntityImageArcCircle.java | 8 +- .../svek/image/EntityImageAssociation.java | 14 +- .../image/EntityImageAssociationPoint.java | 13 +- .../svek/image/EntityImageBranch.java | 46 +- .../svek/image/EntityImageCircleEnd.java | 38 +- .../svek/image/EntityImageCircleStart.java | 33 +- .../plantuml/svek/image/EntityImageClass.java | 100 +- ...ader2.java => EntityImageClassHeader.java} | 49 +- .../svek/image/EntityImageDeepHistory.java | 43 + .../svek/image/EntityImageDescription.java | 84 +- .../svek/image/EntityImageEmptyPackage.java | 52 +- .../plantuml/svek/image/EntityImageGroup.java | 6 +- .../image/EntityImageLollipopInterface.java | 14 +- .../EntityImageLollipopInterfaceEye1.java | 21 +- .../EntityImageLollipopInterfaceEye2.java | 25 +- .../plantuml/svek/image/EntityImageMap.java | 213 ++++ .../plantuml/svek/image/EntityImageNote.java | 75 +- .../svek/image/EntityImageNoteLink.java | 10 +- .../svek/image/EntityImageObject.java | 40 +- .../plantuml/svek/image/EntityImagePort.java | 110 ++ .../svek/image/EntityImagePseudoState.java | 23 +- .../plantuml/svek/image/EntityImageState.java | 32 +- .../svek/image/EntityImageState2.java | 22 +- .../svek/image/EntityImageStateBorder.java | 75 +- .../EntityImageStateEmptyDescription.java | 24 +- .../svek/image/EntityImageSynchroBar.java | 33 +- .../plantuml/svek/image/EntityImageTips.java | 33 +- .../svek/image/EntityImageUseCase.java | 34 +- .../plantuml/svek/image/Footprint.java | 24 +- .../plantuml/svek/image/Opale.java | 27 +- .../svek/image/SmallestEnclosingCircle.java | 6 +- .../plantuml/svek/image/YTransformer.java | 6 +- .../net/sourceforge/plantuml/svg/SvgData.java | 6 +- .../sourceforge/plantuml/svg/SvgGraphics.java | 187 ++-- .../plantuml/swing/AboutWindow.java | 6 +- .../plantuml/swing/ImageHelper.java | 6 +- .../plantuml/swing/ImageWindow2.java | 17 +- .../plantuml/swing/LicenseWindow.java | 6 +- .../plantuml/swing/MainWindow2.java | 7 +- .../plantuml/swing/ScrollablePicture.java | 6 +- .../plantuml/swing/SimpleLine2.java | 6 +- .../plantuml/swing/SpriteWindow.java | 10 +- .../plantuml/syntax/LanguageDescriptor.java | 32 +- .../plantuml/syntax/SyntaxChecker.java | 8 +- .../plantuml/syntax/SyntaxResult.java | 6 +- .../plantuml/telnet/AcceptTelnetClient.java | 6 +- .../plantuml/telnet/TelnetServer.java | 6 +- .../plantuml/tikz/TikzGraphics.java | 29 +- .../net/sourceforge/plantuml/tim/Eater.java | 124 ++- .../plantuml/tim/EaterAffectation.java | 15 +- .../plantuml/tim/EaterAffectationDefine.java | 17 +- .../sourceforge/plantuml/tim/EaterAssert.java | 15 +- .../plantuml/tim/EaterDeclareProcedure.java | 84 ++ ...n.java => EaterDeclareReturnFunction.java} | 16 +- .../plantuml/tim/EaterDumpMemory.java | 12 +- .../sourceforge/plantuml/tim/EaterElseIf.java | 11 +- .../plantuml/tim/EaterException.java | 22 +- ...ntexts.java => EaterExceptionLocated.java} | 39 +- .../EaterForeach.java} | 70 +- .../plantuml/tim/EaterFunctionCall.java | 64 +- .../net/sourceforge/plantuml/tim/EaterIf.java | 11 +- .../sourceforge/plantuml/tim/EaterIfdef.java | 14 +- .../sourceforge/plantuml/tim/EaterIfndef.java | 15 +- .../sourceforge/plantuml/tim/EaterImport.java | 14 +- .../plantuml/tim/EaterInclude.java | 13 +- .../plantuml/tim/EaterIncludeDef.java | 13 +- .../plantuml/tim/EaterIncludesub.java | 14 +- .../plantuml/tim/EaterLegacyDefine.java | 17 +- .../plantuml/tim/EaterLegacyDefineLong.java | 17 +- .../sourceforge/plantuml/tim/EaterLog.java | 13 +- .../sourceforge/plantuml/tim/EaterReturn.java | 11 +- .../plantuml/tim/EaterStartsub.java | 14 +- .../sourceforge/plantuml/tim/EaterUndef.java | 10 +- .../sourceforge/plantuml/tim/EaterWhile.java | 55 + .../plantuml/tim/ExecutionContextForeach.java | 85 ++ ...alContext.java => ExecutionContextIf.java} | 14 +- .../plantuml/tim/ExecutionContextWhile.java | 74 ++ .../plantuml/tim/ExecutionContexts.java | 87 ++ .../plantuml/tim/FunctionsSet.java | 161 +++ .../StyleKind.java => tim/StringEater.java} | 23 +- .../sourceforge/plantuml/tim/TContext.java | 775 ++++++-------- .../sourceforge/plantuml/tim/TFunction.java | 20 +- .../plantuml/tim/TFunctionArgument.java | 6 +- .../plantuml/tim/TFunctionImpl.java | 158 +-- .../plantuml/tim/TFunctionSignature.java | 25 +- .../plantuml/tim/TFunctionType.java | 8 +- .../sourceforge/plantuml/tim/TLineType.java | 45 +- .../net/sourceforge/plantuml/tim/TMemory.java | 35 +- .../plantuml/tim/TMemoryGlobal.java | 24 +- .../plantuml/tim/TMemoryLocal.java | 114 +- .../net/sourceforge/plantuml/tim/TMode.java | 6 +- .../plantuml/tim/TVariableScope.java | 6 +- .../sourceforge/plantuml/tim/TimLoader.java | 45 +- .../net/sourceforge/plantuml/tim/Trie.java | 95 +- .../sourceforge/plantuml/tim/TrieImpl.java | 122 +++ .../plantuml/tim/VariableManager.java | 155 +++ .../plantuml/tim/expression/Expression.java | 6 +- .../plantuml/tim/expression/Knowledge.java | 11 +- .../expression/ReversePolishInterpretor.java | 37 +- .../plantuml/tim/expression/ShuntingYard.java | 30 +- .../plantuml/tim/expression/TValue.java | 16 +- .../plantuml/tim/expression/Token.java | 25 +- .../tim/expression/TokenIterator.java | 6 +- .../tim/expression/TokenOperator.java | 6 +- .../plantuml/tim/expression/TokenStack.java | 63 +- .../plantuml/tim/expression/TokenType.java | 26 +- .../iterator/AbstractCodeIterator.java} | 41 +- .../iterator/CodeIterator.java} | 29 +- .../tim/iterator/CodeIteratorAffectation.java | 94 ++ .../tim/iterator/CodeIteratorForeach.java | 127 +++ .../plantuml/tim/iterator/CodeIteratorIf.java | 159 +++ .../tim/iterator/CodeIteratorImpl.java | 94 ++ .../iterator/CodeIteratorInnerComment.java | 51 + .../iterator/CodeIteratorLegacyDefine.java | 81 ++ .../tim/iterator/CodeIteratorLongComment.java | 71 ++ .../tim/iterator/CodeIteratorProcedure.java | 92 ++ .../iterator/CodeIteratorReturnFunction.java | 96 ++ .../iterator/CodeIteratorShortComment.java} | 60 +- .../tim/iterator/CodeIteratorSub.java | 108 ++ .../tim/iterator/CodeIteratorWhile.java | 119 +++ .../iterator/CodePosition.java} | 12 +- .../plantuml/tim/stdlib/AlwaysFalse.java | 15 +- .../plantuml/tim/stdlib/AlwaysTrue.java | 15 +- .../plantuml/tim/stdlib/CallUserFunction.java | 19 +- .../plantuml/tim/stdlib/DateFunction.java | 21 +- .../plantuml/tim/stdlib/Dirpath.java | 15 +- .../plantuml/tim/stdlib/FileExists.java | 21 +- .../plantuml/tim/stdlib/Filename.java | 15 +- .../plantuml/tim/stdlib/FunctionExists.java | 16 +- .../plantuml/tim/stdlib/GetVariableValue.java | 22 +- .../plantuml/tim/stdlib/GetVersion.java | 60 ++ .../plantuml/tim/stdlib/Getenv.java | 17 +- .../plantuml/tim/stdlib/IntVal.java | 17 +- ...VoidFunction.java => InvokeProcedure.java} | 36 +- .../plantuml/tim/stdlib/LogicalNot.java | 17 +- .../plantuml/tim/stdlib/Lower.java | 57 + .../tim/stdlib/RetrieveProcedure.java | 69 ++ .../plantuml/tim/stdlib/SetVariableValue.java | 22 +- .../tim/stdlib/SimpleReturnFunction.java | 20 +- .../plantuml/tim/stdlib/StringFunction.java | 57 + .../plantuml/tim/stdlib/Strlen.java | 17 +- .../plantuml/tim/stdlib/Strpos.java | 19 +- .../plantuml/tim/stdlib/Substr.java | 23 +- .../plantuml/tim/stdlib/Upper.java | 57 + .../plantuml/tim/stdlib/VariableExists.java | 17 +- .../timingdiagram/AbstractPlayer.java | 203 ---- .../plantuml/timingdiagram/ChangeState.java | 18 +- .../plantuml/timingdiagram/Clocks.java | 8 +- .../plantuml/timingdiagram/Highlight.java | 115 ++ .../plantuml/timingdiagram/Player.java | 59 +- .../plantuml/timingdiagram/PlayerAnalog.java | 285 +++++ .../plantuml/timingdiagram/PlayerBinary.java | 125 ++- .../plantuml/timingdiagram/PlayerClock.java | 97 +- .../plantuml/timingdiagram/PlayerRobust.java | 47 - .../timingdiagram/PlayerRobustConcise.java | 192 ++++ .../timingdiagram/ReallyAbstractPlayer.java | 76 -- .../plantuml/timingdiagram/TickInPlayer.java | 6 +- .../timingdiagram/TimeConstraint.java | 58 +- .../plantuml/timingdiagram/TimeMessage.java | 10 +- .../plantuml/timingdiagram/TimeProjected.java | 7 +- .../plantuml/timingdiagram/TimeTick.java | 19 +- .../plantuml/timingdiagram/TimingDiagram.java | 228 ++-- .../timingdiagram/TimingDiagramFactory.java | 31 +- .../plantuml/timingdiagram/TimingFormat.java | 84 ++ .../plantuml/timingdiagram/TimingNote.java | 35 +- .../plantuml/timingdiagram/TimingRuler.java | 149 +-- .../plantuml/timingdiagram/TimingStyle.java | 20 +- .../plantuml/timingdiagram/TitleStrategy.java | 35 - .../timingdiagram/command/CommandAnalog.java | 89 ++ .../{ => command}/CommandAtPlayer.java | 13 +- .../{ => command}/CommandAtTime.java | 24 +- .../{ => command}/CommandBinary.java | 17 +- .../{ => command}/CommandChangeState.java | 13 +- .../CommandChangeStateByPlayerCode.java | 11 +- .../CommandChangeStateByTime.java | 13 +- .../{ => command}/CommandClock.java | 22 +- .../{ => command}/CommandConstraint.java | 11 +- .../{ => command}/CommandDefineStateLong.java | 10 +- .../CommandDefineStateShort.java | 10 +- .../{ => command}/CommandHideTimeAxis.java | 9 +- .../command/CommandHighlight.java | 89 ++ .../command/CommandModeCompact.java | 62 ++ .../{ => command}/CommandNote.java | 11 +- .../{ => command}/CommandNoteLong.java | 15 +- .../command/CommandPixelHeight.java | 74 ++ .../{ => command}/CommandRobustConcise.java | 18 +- .../{ => command}/CommandScalePixel.java | 9 +- .../timingdiagram/command/CommandTicks.java | 79 ++ .../{ => command}/CommandTimeMessage.java | 12 +- .../{ => command}/TimeTickBuilder.java | 45 +- .../{ => graphic}/HexaShape.java | 8 +- .../{ => graphic}/Histogram.java | 256 +++-- .../{ => graphic}/IntricatedPoint.java | 8 +- .../PDrawing.java} | 19 +- .../{ => graphic}/PentaAShape.java | 8 +- .../{ => graphic}/PentaBShape.java | 8 +- .../timingdiagram/graphic/PlayerFrame.java | 70 ++ .../timingdiagram/{ => graphic}/Ribbon.java | 283 +++-- .../{ => graphic}/TimeArrow.java | 14 +- .../ugraphic/AbstractCommonUGraphic.java | 55 +- .../ugraphic/AbstractPlacementStrategy.java | 6 +- .../plantuml/ugraphic/AbstractShadowable.java | 6 +- .../plantuml/ugraphic/AbstractUGraphic.java | 13 +- .../AbstractUGraphicHorizontalLine.java | 8 +- .../ugraphic/AffineTransformType.java | 48 + .../plantuml/ugraphic/ClipContainer.java | 6 +- .../ugraphic/ColorMapperIdentity.java | 63 -- .../plantuml/ugraphic/FontChecker.java | 27 +- .../plantuml/ugraphic/ImageBuilder.java | 280 +++-- .../plantuml/ugraphic/InflaterSet.java | 6 +- .../plantuml/ugraphic/LimitFinder.java | 38 +- .../sourceforge/plantuml/ugraphic/MinMax.java | 28 +- .../plantuml/ugraphic/MinMaxMutable.java | 30 +- .../MutableImage.java} | 21 +- .../plantuml/ugraphic/PixelImage.java | 169 +++ .../plantuml/ugraphic/PlacementStrategy.java | 6 +- .../ugraphic/PlacementStrategyVisibility.java | 15 +- .../ugraphic/PlacementStrategyX1X2.java | 6 +- .../ugraphic/PlacementStrategyX1Y2Y3.java | 6 +- .../ugraphic/PlacementStrategyY1Y2.java | 6 +- .../ugraphic/PlacementStrategyY1Y2Center.java | 6 +- .../ugraphic/PlacementStrategyY1Y2Left.java | 6 +- .../plantuml/ugraphic/Scalable.java | 6 +- .../plantuml/ugraphic/ShadowManager.java | 6 +- .../plantuml/ugraphic/Shadowable.java | 6 +- .../plantuml/ugraphic/TextBlockInEllipse.java | 6 +- .../plantuml/ugraphic/TextLimitFinder.java | 24 +- .../plantuml/ugraphic/UAntiAliasing.java | 6 +- .../plantuml/ugraphic/UBackground.java | 39 + .../plantuml/ugraphic/UCenteredCharacter.java | 6 +- .../plantuml/ugraphic/UChange.java | 6 +- .../plantuml/ugraphic/UChangeBackColor.java | 52 - .../sourceforge/plantuml/ugraphic/UClip.java | 10 +- .../plantuml/ugraphic/UComment.java | 6 +- .../plantuml/ugraphic/UDriver.java | 8 +- .../plantuml/ugraphic/UEllipse.java | 6 +- .../sourceforge/plantuml/ugraphic/UEmpty.java | 6 +- .../sourceforge/plantuml/ugraphic/UFont.java | 47 +- .../plantuml/ugraphic/UFontContext.java | 6 +- .../plantuml/ugraphic/UFontUser.java | 6 +- .../plantuml/ugraphic/UGraphic.java | 15 +- .../plantuml/ugraphic/UGraphic2.java | 6 +- .../plantuml/ugraphic/UGraphicFilter.java | 6 +- .../{UChangeColor.java => UGraphicNo.java} | 23 +- .../plantuml/ugraphic/UGraphicNull.java | 14 +- .../plantuml/ugraphic/UGraphicStencil.java | 6 +- .../plantuml/ugraphic/UGraphicUtils.java | 31 +- .../plantuml/ugraphic/UHidden.java | 6 +- .../plantuml/ugraphic/UHorizontalLine.java | 8 +- .../sourceforge/plantuml/ugraphic/UImage.java | 150 +-- .../plantuml/ugraphic/UImageSvg.java | 6 +- .../plantuml/ugraphic/ULayoutGroup.java | 6 +- .../sourceforge/plantuml/ugraphic/ULine.java | 14 +- .../sourceforge/plantuml/ugraphic/UMotif.java | 6 +- .../sourceforge/plantuml/ugraphic/UParam.java | 12 +- .../plantuml/ugraphic/UParamNull.java | 12 +- .../sourceforge/plantuml/ugraphic/UPath.java | 33 +- .../plantuml/ugraphic/UPattern.java | 6 +- .../sourceforge/plantuml/ugraphic/UPixel.java | 6 +- .../plantuml/ugraphic/UPolygon.java | 16 +- .../plantuml/ugraphic/URectangle.java | 112 +- .../sourceforge/plantuml/ugraphic/UScale.java | 6 +- .../plantuml/ugraphic/USegment.java | 6 +- .../plantuml/ugraphic/USegmentType.java | 6 +- .../sourceforge/plantuml/ugraphic/UShape.java | 6 +- .../UShapeIgnorableForCompression.java | 41 + .../plantuml/ugraphic/UShapeSized.java | 6 +- .../plantuml/ugraphic/UStroke.java | 6 +- .../sourceforge/plantuml/ugraphic/UText.java | 24 +- .../plantuml/ugraphic/UTranslate.java | 18 +- .../ugraphic/arc/ExtendedGeneralPath.java | 6 +- .../ugraphic/arc/ExtendedPathIterator.java | 6 +- .../ugraphic/color/AbstractColorMapper.java | 79 ++ .../{ => color}/ColorChangerMonochrome.java | 8 +- .../ugraphic/{ => color}/ColorMapper.java | 16 +- .../ugraphic/color/ColorMapperIdentity.java | 56 + .../color/ColorMapperLightnessInverse.java | 56 + .../{ => color}/ColorMapperMonochrome.java | 21 +- .../{ => color}/ColorMapperReverse.java | 22 +- .../ColorMapperTransparentWrapper.java | 22 +- .../ugraphic/{ => color}/ColorOrder.java | 8 +- .../plantuml/ugraphic/color/ColorUtils.java | 103 ++ .../color/HColor.java} | 20 +- .../ugraphic/color/HColorAbstract.java | 45 + .../color/HColorAutomatic.java} | 10 +- .../color/HColorBackground.java} | 29 +- .../color/HColorGradient.java} | 34 +- .../color/HColorMiddle.java} | 22 +- .../color/HColorNone.java} | 20 +- .../color/HColorSet.java} | 117 ++- .../color/HColorSimple.java} | 36 +- .../color/HColorUserDef.java} | 10 +- .../color/HColorUtils.java} | 119 ++- .../ugraphic/color/HUSLColorConverter.java | 432 ++++++++ .../ugraphic/comp/CompressionMode.java | 6 +- .../ugraphic/comp/CompressionTransform.java | 8 +- .../ugraphic/comp/CompressionXorYBuilder.java | 51 + .../plantuml/ugraphic/comp/Expand.java | 75 ++ .../ugraphic/comp/ExpandTransform.java | 66 ++ .../comp/ExpandType.java} | 12 +- .../comp/PiecewiseAffineComposition.java | 47 + ...java => PiecewiseAffineOnXorYBuilder.java} | 53 +- .../comp/PiecewiseAffineTransform.java} | 11 +- .../plantuml/ugraphic/comp/Slot.java | 6 +- .../plantuml/ugraphic/comp/SlotFinder.java | 73 +- .../plantuml/ugraphic/comp/SlotSet.java | 8 +- .../ugraphic/comp/UGraphicCompressOnXorY.java | 71 +- .../ugraphic/crossing/UGraphicCrossing.java | 68 +- .../eps/DriverCenteredCharacterEps.java | 10 +- .../ugraphic/eps/DriverDotPathEps.java | 10 +- .../ugraphic/eps/DriverEllipseEps.java | 12 +- .../plantuml/ugraphic/eps/DriverImageEps.java | 10 +- .../plantuml/ugraphic/eps/DriverLineEps.java | 10 +- .../plantuml/ugraphic/eps/DriverPathEps.java | 12 +- .../ugraphic/eps/DriverPolygonEps.java | 24 +- .../ugraphic/eps/DriverRectangleEps.java | 24 +- .../plantuml/ugraphic/eps/DriverTextEps.java | 28 +- .../ugraphic/eps/PathIteratorLimited.java | 6 +- .../plantuml/ugraphic/eps/UGraphicEps.java | 10 +- .../g2d/DriverCenteredCharacterG2d.java | 10 +- .../ugraphic/g2d/DriverDotPathG2d.java | 10 +- .../ugraphic/g2d/DriverEllipseG2d.java | 22 +- .../plantuml/ugraphic/g2d/DriverImageG2d.java | 26 +- .../plantuml/ugraphic/g2d/DriverLineG2d.java | 12 +- .../plantuml/ugraphic/g2d/DriverPathG2d.java | 86 +- .../ugraphic/g2d/DriverPathG2dLegacy.java | 152 --- .../ugraphic/g2d/DriverPathOldG2d.java | 152 --- .../plantuml/ugraphic/g2d/DriverPixelG2d.java | 10 +- .../ugraphic/g2d/DriverPolygonG2d.java | 64 +- .../ugraphic/g2d/DriverRectangleG2d.java | 62 +- .../ugraphic/g2d/DriverShadowedG2d.java | 110 +- .../ugraphic/g2d/DriverTextAsPathG2d.java | 26 +- .../plantuml/ugraphic/g2d/DriverTextG2d.java | 44 +- .../plantuml/ugraphic/g2d/UGraphicG2d.java | 10 +- .../plantuml/ugraphic/hand/HandJiggle.java | 6 +- .../plantuml/ugraphic/hand/UDotPathHand.java | 6 +- .../plantuml/ugraphic/hand/UEllipseHand.java | 6 +- .../ugraphic/hand/UGraphicHandwritten.java | 64 +- .../plantuml/ugraphic/hand/ULineHand.java | 6 +- .../plantuml/ugraphic/hand/UPathHand.java | 6 +- .../plantuml/ugraphic/hand/UPolygonHand.java | 6 +- .../ugraphic/hand/URectangleHand.java | 6 +- .../ugraphic/html5/DriverLineHtml5.java | 14 +- .../ugraphic/html5/DriverNopHtml5.java | 8 +- .../ugraphic/html5/DriverRectangleHtml5.java | 23 +- .../plantuml/ugraphic/html5/Html5Drawer.java | 6 +- .../ugraphic/html5/UGraphicHtml5.java | 21 +- .../svg/DriverCenteredCharacterSvg.java | 11 +- .../ugraphic/svg/DriverDotPathSvg.java | 11 +- .../ugraphic/svg/DriverEllipseSvg.java | 29 +- .../plantuml/ugraphic/svg/DriverImagePng.java | 10 +- .../ugraphic/svg/DriverImageSvgSvg.java | 8 +- .../plantuml/ugraphic/svg/DriverLineSvg.java | 23 +- .../plantuml/ugraphic/svg/DriverNoneSvg.java | 8 +- .../plantuml/ugraphic/svg/DriverPathSvg.java | 27 +- .../ugraphic/svg/DriverPolygonSvg.java | 27 +- .../ugraphic/svg/DriverRectangleSvg.java | 37 +- .../ugraphic/svg/DriverTextAsPathSvg.java | 8 +- .../plantuml/ugraphic/svg/DriverTextSvg.java | 26 +- .../plantuml/ugraphic/svg/UGraphicSvg.java | 46 +- .../ugraphic/tikz/DriverAtomTextTikz.java | 16 +- .../tikz/DriverCenteredCharacterTikz.java | 10 +- .../tikz/DriverCenteredCharacterTikz2.java | 10 +- .../ugraphic/tikz/DriverDotPathTikz.java | 10 +- .../ugraphic/tikz/DriverEllipseTikz.java | 12 +- .../ugraphic/tikz/DriverImageTikz.java | 19 +- .../ugraphic/tikz/DriverLineTikz.java | 10 +- .../ugraphic/tikz/DriverNoneTikz.java | 8 +- .../ugraphic/tikz/DriverPolygonTikz.java | 26 +- .../ugraphic/tikz/DriverRectangleTikz.java | 26 +- .../ugraphic/tikz/DriverUPathTikz.java | 26 +- .../ugraphic/tikz/DriverUTextTikz.java | 14 +- .../plantuml/ugraphic/tikz/UGraphicTikz.java | 12 +- .../plantuml/ugraphic/txt/UGraphicTxt.java | 18 +- .../ugraphic/visio/DriverDotPathVdx.java | 8 +- .../ugraphic/visio/DriverLineVdx.java | 8 +- .../ugraphic/visio/DriverNoneVdx.java | 8 +- .../ugraphic/visio/DriverPolygonVdx.java | 8 +- .../ugraphic/visio/DriverRectangleVdx.java | 8 +- .../ugraphic/visio/DriverTextVdx.java | 8 +- .../ugraphic/visio/DriverUPathVdx.java | 8 +- .../plantuml/ugraphic/visio/UGraphicVdx.java | 17 +- .../ugraphic/visio/VisioGraphics.java | 8 +- .../plantuml/ugraphic/visio/VisioLine.java | 6 +- .../ugraphic/visio/VisioRectangle.java | 6 +- .../plantuml/ugraphic/visio/VisioShape.java | 6 +- .../plantuml/ugraphic/visio/VisioText.java | 6 +- .../plantuml/utils/CharHidder.java | 11 +- .../sourceforge/plantuml/utils/Cypher.java | 8 +- .../sourceforge/plantuml/utils/MathUtils.java | 6 +- .../plantuml/utils/StartUtils.java | 8 +- .../plantuml/utils/UniqueSequence.java | 16 +- .../plantuml/version/IteratorCounter2.java | 6 +- .../version/IteratorCounter2Impl.java | 6 +- .../sourceforge/plantuml/version/License.java | 34 +- .../plantuml/version/LicenseInfo.java | 34 +- .../plantuml/version/LicenseType.java | 6 +- .../plantuml/version/PLSSignature.java | 6 +- .../plantuml/version/PSystemKeycheck.java | 30 +- .../plantuml/version/PSystemKeygen.java | 37 +- .../plantuml/version/PSystemLicense.java | 22 +- .../version/PSystemLicenseFactory.java | 6 +- .../plantuml/version/PSystemVersion.java | 118 +-- .../version/PSystemVersionFactory.java | 30 +- .../sourceforge/plantuml/version/Version.java | 18 +- .../plantuml/vizjs/GraphvizJs.java | 6 +- .../vizjs/GraphvizJsRuntimeException.java | 6 +- .../plantuml/vizjs/VizJsEngine.java | 6 +- .../plantuml/wbs/CommandWBSOrgmode.java | 6 +- .../plantuml/wbs/CommandWBSPlus.java | 6 +- .../plantuml/wbs/CommandWBSTabulation.java | 6 +- .../plantuml/wbs/{Fork2.java => Fork.java} | 20 +- .../src/net/sourceforge/plantuml/wbs/ITF.java | 8 +- .../sourceforge/plantuml/wbs/ITFComposed.java | 26 +- .../net/sourceforge/plantuml/wbs/ITFLeaf.java | 20 +- .../sourceforge/plantuml/wbs/WBSDiagram.java | 56 +- .../plantuml/wbs/WBSDiagramFactory.java | 6 +- .../plantuml/wbs/WBSTextBlock.java | 55 +- .../sourceforge/plantuml/wbs/WElement.java | 55 +- .../net/sourceforge/plantuml/wire/Block.java | 202 ++++ .../plantuml/wire/CommandComponent.java | 77 ++ .../CommandContainer.java} | 36 +- .../plantuml/wire/CommandContainerEnd.java | 59 ++ .../plantuml/wire/CommandNewColumn.java | 59 ++ .../sourceforge/plantuml/wire/CommandPin.java | 74 ++ .../plantuml/wire/CommandPinSpace.java | 66 ++ .../plantuml/wire/CommandVspace.java | 62 ++ .../plantuml/wire/WireDiagram.java | 169 +++ .../plantuml/wire/WireDiagramFactory.java | 67 ++ .../plantuml/xmi/CucaDiagramXmiMaker.java | 6 +- .../plantuml/xmi/IXmiClassDiagram.java | 6 +- .../plantuml/xmi/XmiClassDiagramAbstract.java | 20 +- .../plantuml/xmi/XmiClassDiagramArgo.java | 10 +- .../plantuml/xmi/XmiClassDiagramStandard.java | 10 +- .../plantuml/xmi/XmiClassDiagramStar.java | 10 +- .../plantuml/xmi/XmiDescriptionDiagram.java | 12 +- .../plantuml/xmi/XmiStateDiagram.java | 12 +- .../xmlsc/ScxmlStateDiagramStandard.java | 12 +- .../xmlsc/StateDiagramScxmlMaker.java | 6 +- .../plantuml/zopfli/BlockSplitter.java | 6 +- .../sourceforge/plantuml/zopfli/Buffer.java | 6 +- .../sourceforge/plantuml/zopfli/Cookie.java | 6 +- .../sourceforge/plantuml/zopfli/Deflate.java | 6 +- .../net/sourceforge/plantuml/zopfli/Hash.java | 6 +- .../plantuml/zopfli/Katajainen.java | 6 +- .../plantuml/zopfli/LongestMatchCache.java | 6 +- .../sourceforge/plantuml/zopfli/LzStore.java | 6 +- .../sourceforge/plantuml/zopfli/Options.java | 6 +- .../sourceforge/plantuml/zopfli/Squeeze.java | 6 +- .../plantuml/zopfli/SymbolStats.java | 6 +- .../net/sourceforge/plantuml/zopfli/Util.java | 6 +- .../sourceforge/plantuml/zopfli/Zopfli.java | 6 +- src/plantuml-asl/src/smetana/core/ACCESS.java | 6 +- src/plantuml-asl/src/smetana/core/AllH.java | 6 +- .../src/smetana/core/ArrayOfInteger.java | 6 +- src/plantuml-asl/src/smetana/core/Bucket.java | 6 +- .../src/smetana/core/CEnumInterpretor.java | 6 +- .../src/smetana/core/CFunction.java | 6 +- .../src/smetana/core/CFunctionImpl.java | 6 +- .../src/smetana/core/CObject.java | 6 +- .../src/smetana/core/CString.java | 6 +- src/plantuml-asl/src/smetana/core/CType.java | 6 +- .../src/smetana/core/HardcodedStruct.java | 6 +- src/plantuml-asl/src/smetana/core/JUtils.java | 6 +- .../src/smetana/core/JUtilsDebug.java | 6 +- src/plantuml-asl/src/smetana/core/Macro.java | 6 +- src/plantuml-asl/src/smetana/core/Memory.java | 6 +- .../src/smetana/core/MutableDouble.java | 6 +- .../src/smetana/core/MutableDoublePtr.java | 6 +- src/plantuml-asl/src/smetana/core/OFFSET.java | 6 +- .../src/smetana/core/STARSTAR.java | 6 +- .../src/smetana/core/StructureDefinition.java | 6 +- .../smetana/core/UnsupportedArrayOfPtr.java | 6 +- .../core/UnsupportedArrayOfStruct.java | 6 +- .../core/UnsupportedArrayOfStruct2.java | 6 +- .../src/smetana/core/UnsupportedC.java | 6 +- .../smetana/core/UnsupportedStarStruct.java | 6 +- .../src/smetana/core/UnsupportedStruct.java | 6 +- .../smetana/core/UnsupportedStructAndPtr.java | 6 +- src/plantuml-asl/src/smetana/core/Z.java | 6 +- .../smetana/core/__array_of_cstring__.java | 6 +- .../core/__array_of_cstring_impl__.java | 6 +- .../src/smetana/core/__array_of_double__.java | 6 +- .../smetana/core/__array_of_integer__.java | 6 +- .../core/__array_of_integer_impl__.java | 6 +- .../src/smetana/core/__array_of_ptr__.java | 6 +- .../src/smetana/core/__c__fields.java | 6 +- .../src/smetana/core/__ptr__.java | 6 +- .../src/smetana/core/__struct__.java | 6 +- .../src/smetana/core/amiga/Area.java | 6 +- .../src/smetana/core/amiga/AreaDouble.java | 6 +- .../src/smetana/core/amiga/AreaInt.java | 6 +- .../core/amiga/BucketToAreaFactory.java | 6 +- .../src/smetana/core/amiga/BuilderArea.java | 6 +- .../src/smetana/core/amiga/Counter.java | 6 +- .../src/smetana/core/amiga/InternalData.java | 6 +- .../core/amiga/StarArrayOfCString.java | 6 +- .../core/amiga/StarArrayOfInteger.java | 6 +- .../src/smetana/core/amiga/StarStruct.java | 6 +- .../src/smetana/core/debug/Debug.java | 6 +- .../smetana/core/gvformatter_engine_s.java | 6 +- .../src/smetana/core/jmp_buf.java | 6 +- .../src/smetana/core/pointf_s.java | 6 +- src/plantuml-asl/src/smetana/core/size_t.java | 6 +- .../core/size_t_array_of_charstars.java | 6 +- .../smetana/core/size_t_array_of_integer.java | 6 +- .../src/smetana/core/size_t_of_element.java | 6 +- .../src/smetana/core/size_t_struct.java | 6 +- src/plantuml-asl/src/smetana/core/tms.java | 6 +- .../src/sprites/archimate/assignment.png | Bin 203 -> 130 bytes .../archimate/association-unidirect.png | Bin 0 -> 127 bytes .../sprites/archimate/motivation-value.png | Bin 0 -> 137 bytes .../src/sprites/archimate/serving.png | Bin 0 -> 215 bytes .../src/sprites/archimate/specialization.png | Bin 0 -> 225 bytes .../archimate/strategy-value-stream.png | Bin 0 -> 140 bytes .../technology-communication-network.png | Bin 0 -> 262 bytes .../archimate/technology-interface.png | Bin 0 -> 248 bytes .../src/sprites/archimate/technology-path.png | Bin 0 -> 249 bytes .../sprites/archimate/technology-service.png | Bin 0 -> 224 bytes src/plantuml-asl/stdlib/archimate-abx.repx | Bin 0 -> 2406 bytes src/plantuml-asl/stdlib/archimate-dex.repx | 1 + src/plantuml-asl/stdlib/awslib-abx.repx | Bin 19066 -> 27067 bytes src/plantuml-asl/stdlib/awslib-dex.repx | Bin 122023 -> 139831 bytes src/plantuml-asl/stdlib/c4-abx.repx | Bin 1790 -> 1817 bytes src/plantuml-asl/stdlib/cloudinsight-abx.repx | Bin 802 -> 803 bytes src/plantuml-asl/stdlib/elastic-abx.repx | Bin 0 -> 1446 bytes src/plantuml-asl/stdlib/elastic-dex.repx | Bin 0 -> 6238 bytes src/plantuml-asl/stdlib/home.repx | 4 + src/plantuml-asl/stdlib/kubernetes-abx.repx | Bin 0 -> 589 bytes src/plantuml-asl/stdlib/kubernetes-dex.repx | Bin 0 -> 62783 bytes src/plantuml-asl/stdlib/logos-abx.repx | Bin 0 -> 11327 bytes src/plantuml-asl/stdlib/logos-dex.repx | Bin 0 -> 273188 bytes src/plantuml-asl/stdlib/osa-abx.repx | Bin 2617 -> 2585 bytes src/plantuml-asl/stdlib/osa-dex.repx | Bin 40617 -> 40715 bytes 2442 files changed, 45763 insertions(+), 25050 deletions(-) create mode 100644 src/plantuml-asl/skin/strictuml.skin rename src/plantuml-asl/src/net/sourceforge/plantuml/{skin/bluemodern/ShadowShape.java => ComponentStyle.java} (70%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReaderCopyCat.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{SourceFileReader2.java => SourceFileReaderHardFile.java} (70%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/CenteredText.java rename src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/{FtileHeightFixed.java => FtileHeightFixedCentered.java} (88%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixedMarged.java rename src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/{FtileMinWidth.java => FtileMinWidthCentered.java} (90%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/LaneDivider.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesA.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesB.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesC.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/AbstractParallelFtilesBuilder.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateParallel1.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateParallelAddingMargin.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit2.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelFtilesBuilder.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandImport.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/JavaClass.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/JavaFile.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{preproc/IfManagerFilter.java => code/ByteArray.java} (56%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionZlibPure.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/code/NoPlantumlCompressionException.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/code/Tokens.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmartAttic.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmartProtected.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmartProtectedPure.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/code/Upf9Decoder.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/code/Upf9Encoder.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/BitInputStream.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/ByteBitInputStream.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/ByteHistory.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/CanonicalCode.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/Decompressor.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{preproc/PreprocessorChangeModeReader.java => code/deflate/OutputStreamProtected.java} (53%) rename src/plantuml-asl/src/net/sourceforge/plantuml/command/{FactorySpriteCommand.java => CommandFactorySprite.java} (68%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesCaption.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandNamespace2.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandConstraintOnLinks.java rename src/plantuml-asl/src/net/sourceforge/plantuml/command/note/{FactoryNoteCommand.java => CommandFactoryNote.java} (85%) rename src/plantuml-asl/src/net/sourceforge/plantuml/command/note/{FactoryNoteActivityCommand.java => CommandFactoryNoteActivity.java} (81%) rename src/plantuml-asl/src/net/sourceforge/plantuml/command/note/{FactoryNoteOnEntityCommand.java => CommandFactoryNoteOnEntity.java} (77%) rename src/plantuml-asl/src/net/sourceforge/plantuml/command/note/{FactoryNoteOnLinkCommand.java => CommandFactoryNoteOnLink.java} (93%) rename src/plantuml-asl/src/net/sourceforge/plantuml/command/note/{FactoryTipOnEntityCommand.java => CommandFactoryTipOnEntity.java} (84%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/creole/Parser.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/creole/SheetBuilder.java rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => atom}/AbstractAtom.java (83%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => atom}/Atom.java (89%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => atom}/AtomHorizontalTexts.java (90%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => atom}/AtomImg.java (55%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => atom}/AtomImgSvg.java (90%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => atom}/AtomMath.java (71%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => atom}/AtomOpenIcon.java (85%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => atom}/AtomSpace.java (90%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => atom}/AtomSprite.java (75%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => atom}/AtomTable.java (80%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => atom}/AtomTree.java (83%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => atom}/AtomVerticalTexts.java (90%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => atom}/AtomWithMargin.java (67%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => atom}/Bullet.java (79%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/Command.java (82%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleColorAndSizeChange.java (86%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleColorChange.java (84%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleExposantChange.java (84%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleFontFamilyChange.java (91%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleImg.java (72%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleLatex.java (82%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleMath.java (82%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleMonospaced.java (90%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleOpenIcon.java (74%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleQrcode.java (85%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleSizeChange.java (91%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleSpace.java (90%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleSprite.java (74%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleStyle.java (85%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleSvgAttributeChange.java (91%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => command}/CommandCreoleUrl.java (80%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => legacy}/AtomText.java (70%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => legacy}/CreoleParser.java (68%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => legacy}/CreoleStripeSimpleParser.java (91%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => legacy}/PSystemCreole.java (77%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => legacy}/PSystemCreoleFactory.java (89%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => legacy}/StripeSimple.java (70%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => legacy}/StripeTable.java (76%) rename src/plantuml-asl/src/net/sourceforge/plantuml/creole/{ => legacy}/StripeTree.java (68%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/AtomText22.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/CreoleParser2.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/ReaderAbstractWiki.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/ReaderCreole.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/ReaderDokuwiki.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3/Instant.java => creole/rosetta/ReaderWiki.java} (73%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/Rosetta.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/StripeRow.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/URosetta.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/WikiLanguage.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{timingdiagram/PlayerConcise.java => creole/rosetta/WriterWiki.java} (54%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/BodierImpl.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/BodierMap.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3/Resource.java => cucadiagram/CodeImpl.java} (55%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkConstraint.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LongCode.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/MemberImpl.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/SuperGroup.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/TextBlockMap.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementParenthesis.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/Labels.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/StringWithArrow.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite029.png delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HtmlColorUserDef.java rename src/plantuml-asl/src/net/sourceforge/plantuml/graphic/{UGraphicAddAriaLabel.java => SpecialText.java} (54%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolLabel.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/math/ASCIIMathTeXImg.js create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/math/AsciiMathParser.js create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmodeMultiline.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/FingerImpl2.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/ObjectDiagramFactory.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateMap.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/preproc/IfManager.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineInstrumented.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Sub2.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorDefineApply.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorDefineLearner.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorInclude.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorUtils.java rename src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/{ReadLineAddConfig.java => ReadFilterAddConfig.java} (85%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilterMergeLines.java rename src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/{ReadLineQuoteComment.java => ReadFilterQuoteComment.java} (85%) delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadLineInsertable.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/SubPreprocessor.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project}/Arrows.java (93%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/Completion.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project}/ConstantPlan.java (83%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project}/DaysAsDates.java (68%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project}/Failable.java (91%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project}/GanttArrow.java (84%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project}/GanttConstraint.java (65%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project}/GanttDiagram.java (51%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project}/GanttDiagramFactory.java (69%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{preproc/DefinesGet.java => project/Load.java} (68%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project}/LoadPlanable.java (79%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project}/PlanUtils.java (82%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project}/Solver3.java (80%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project}/Today.java (82%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project}/Value.java (85%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandColorTask.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/command}/CommandGanttArrow.java (85%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/command}/CommandGanttArrow2.java (89%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/command}/CommandPage.java (91%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandPrintBetween.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandPrintScale.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/command}/CommandSeparator.java (89%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/command}/NaturalCommand.java (82%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/command}/NaturalCommandAnd.java (86%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/command}/NaturalCommandAndAnd.java (88%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3/InstantDay.java => project/core/AbstractTask.java} (56%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/core}/Moment.java (78%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/core}/MomentImpl.java (74%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{preproc/ReadLineSingle.java => project/core/PrintScale.java} (64%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/core/Resource.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/core}/Task.java (62%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/core}/TaskAttribute.java (86%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/core}/TaskCode.java (89%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/core}/TaskImpl.java (73%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/core}/TaskInstant.java (86%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/core}/TaskSeparator.java (71%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/AbstractTaskDraw.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/PathUtils.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/draw}/ResourceDraw.java (73%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/draw}/TaskDraw.java (77%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TaskDrawDiamond.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TaskDrawRegular.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/draw}/TaskDrawSeparator.java (67%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeader.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/Complement.java (85%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementBeforeOrAfterOrAtTaskStartOrEnd.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/ComplementClose.java (84%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/ComplementColors.java (68%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3/ComplementBeforeOrAfterOrAtTaskStartOrEnd.java => project/lang/ComplementCompleted.java} (55%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/ComplementDate.java (89%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/ComplementDates.java (80%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3/ComplementSeveralDays.java => project/lang/ComplementDayOfWeek.java} (61%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/ComplementEmpty.java (83%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/ComplementInColors.java (77%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/ComplementInColors2.java (77%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/ComplementName.java (87%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/ComplementNamed.java (84%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/ComplementOpen.java (84%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/ComplementPattern.java (82%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementSeveralDays.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementUrl.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/Subject.java (85%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/SubjectDayAsDate.java (85%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/SubjectDayOfWeek.java (85%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/SubjectDaysAsDates.java (85%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/SubjectPattern.java (85%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/SubjectProject.java (87%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/SubjectResource.java (84%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/SubjectTask.java (82%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/SubjectToday.java (85%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/Verb.java (87%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/VerbAre.java (86%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/VerbEnds.java (81%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/VerbHappens.java (78%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/VerbIsColored.java (87%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/VerbIsColoredForToday.java (87%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/VerbIsDeleted.java (86%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3/VerbProjectStarts.java => project/lang/VerbIsForTask.java} (71%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/VerbIsForToday.java (83%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsOff.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3/VerbIsOff.java => project/lang/VerbIsOn.java} (69%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/VerbIsOrAre.java (79%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/VerbIsOrAreNamed.java (84%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/VerbLasts.java (85%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbLinksTo.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/VerbPattern.java (85%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbProjectStarts.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/VerbTaskEndsAbsolute.java (82%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/VerbTaskStarts.java (81%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/lang}/VerbTaskStartsAbsolute.java (82%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/time/Day.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/time}/DayOfWeek.java (84%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3/GCalendarSimple.java => project/time/GCalendar.java} (71%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/time}/Month.java (86%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/time/MonthYear.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/time/Wink.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3 => project/timescale}/TimeScale.java (73%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/TimeScaleCompressed.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/TimeScaleDaily.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3/TimeScaleBasic.java => project/timescale/TimeScaleWink.java} (69%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3/TimeScaleWithoutWeekEnd.java => project/timescale/UnusedTimeScaleWithoutWeekEnd.java} (65%) delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project3/DayAsDate.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project3/GCalendar.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskDrawRegular.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/project3/TimeScaleBasic2.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/security/ImageIO.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/security/SFile.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/security/SURL.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/security/SecurityProfile.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/security/SecurityUtils.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteBottom.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteTop.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/skin/ActorAwesome.java rename src/plantuml-asl/src/net/sourceforge/plantuml/skin/{StickMan.java => ActorStickMan.java} (79%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/skin/ActorStyle.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/skin/bluemodern/FillRoundShape.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{ugraphic => }/sprite/ColorPalette.java (76%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{ugraphic => }/sprite/ColorPalette4096.java (80%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/sprite/CommandListSprite.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/sprite/CommandStdlib.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/sprite/ListSpriteDiagramFactory.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{ugraphic => }/sprite/PSystemListInternalSprites.java (85%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{ugraphic => }/sprite/PSystemListInternalSpritesFactory.java (89%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{ugraphic => }/sprite/RessourcesUtils.java (90%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{ugraphic => }/sprite/Sprite.java (78%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{ugraphic => }/sprite/SpriteColor.java (77%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{ugraphic => }/sprite/SpriteColorBuilder.java (93%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{ugraphic => }/sprite/SpriteColorBuilder4096.java (93%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{ugraphic => }/sprite/SpriteGrayLevel.java (91%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{ugraphic => }/sprite/SpriteImage.java (76%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{ugraphic => }/sprite/SpriteMonochrome.java (82%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{ugraphic => }/sprite/SpriteSvg.java (74%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{ugraphic => }/sprite/SpriteUtils.java (93%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{objectdiagram/ObjectDiagram.java => sprite/StdlibDiagramFactory.java} (56%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/style/CommandStyleImport.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/style/CommandStyleMultilines.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/style/CommandStyleMultilinesCSS.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/style/StyleDefinition.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/style/StyleSignature.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/svek/DirectionalTextBlock.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/svek/EntityImageDegenerated.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3/Load.java => svek/GuideLine.java} (78%) rename src/plantuml-asl/src/net/sourceforge/plantuml/svek/{Shape.java => Node.java} (82%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/svek/extremity/ExtremityExtendsLike.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryExtendsLike.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryHalfArrow.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/svek/extremity/ExtremityHalfArrow.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/svek/image/AbstractEntityImageBorder.java rename src/plantuml-asl/src/net/sourceforge/plantuml/svek/image/{EntityImageClassHeader2.java => EntityImageClassHeader.java} (79%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/svek/image/EntityImageDeepHistory.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/svek/image/EntityImageMap.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/svek/image/EntityImagePort.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/EaterDeclareProcedure.java rename src/plantuml-asl/src/net/sourceforge/plantuml/tim/{EaterDeclareFunction.java => EaterDeclareReturnFunction.java} (80%) rename src/plantuml-asl/src/net/sourceforge/plantuml/tim/{ConditionalContexts.java => EaterExceptionLocated.java} (57%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{preproc/IfManagerNegatif.java => tim/EaterForeach.java} (50%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/EaterWhile.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/ExecutionContextForeach.java rename src/plantuml-asl/src/net/sourceforge/plantuml/tim/{ConditionalContext.java => ExecutionContextIf.java} (83%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/ExecutionContextWhile.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/ExecutionContexts.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/FunctionsSet.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{style/StyleKind.java => tim/StringEater.java} (70%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/TrieImpl.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/VariableManager.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3/LoadInDays.java => tim/iterator/AbstractCodeIterator.java} (56%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{project3/Resources.java => tim/iterator/CodeIterator.java} (61%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/iterator/CodeIteratorAffectation.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/iterator/CodeIteratorForeach.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/iterator/CodeIteratorIf.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/iterator/CodeIteratorImpl.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/iterator/CodeIteratorInnerComment.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/iterator/CodeIteratorLegacyDefine.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/iterator/CodeIteratorLongComment.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/iterator/CodeIteratorProcedure.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/iterator/CodeIteratorReturnFunction.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{preproc/IfManagerPositif.java => tim/iterator/CodeIteratorShortComment.java} (51%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/iterator/CodeIteratorSub.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/iterator/CodeIteratorWhile.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{graphic/HtmlColor.java => tim/iterator/CodePosition.java} (82%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/stdlib/GetVersion.java rename src/plantuml-asl/src/net/sourceforge/plantuml/tim/stdlib/{InvokeVoidFunction.java => InvokeProcedure.java} (62%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/stdlib/Lower.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/stdlib/RetrieveProcedure.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/stdlib/StringFunction.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/tim/stdlib/Upper.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/AbstractPlayer.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/Highlight.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/PlayerRobust.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/PlayerRobustConcise.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/ReallyAbstractPlayer.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/TimingFormat.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/TitleStrategy.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/command/CommandAnalog.java rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandAtPlayer.java (85%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandAtTime.java (73%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandBinary.java (79%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandChangeState.java (87%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandChangeStateByPlayerCode.java (88%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandChangeStateByTime.java (87%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandClock.java (80%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandConstraint.java (89%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandDefineStateLong.java (89%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandDefineStateShort.java (90%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandHideTimeAxis.java (89%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/command/CommandHighlight.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/command/CommandModeCompact.java rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandNote.java (89%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandNoteLong.java (87%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/command/CommandPixelHeight.java rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandRobustConcise.java (78%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandScalePixel.java (90%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/command/CommandTicks.java rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/CommandTimeMessage.java (89%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => command}/TimeTickBuilder.java (59%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => graphic}/HexaShape.java (91%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => graphic}/Histogram.java (61%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => graphic}/IntricatedPoint.java (89%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{TimeDrawing.java => graphic/PDrawing.java} (70%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => graphic}/PentaAShape.java (92%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => graphic}/PentaBShape.java (92%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerFrame.java rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => graphic}/Ribbon.java (52%) rename src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/{ => graphic}/TimeArrow.java (91%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/AffineTransformType.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/ColorMapperIdentity.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{graphic/IHtmlColorSet.java => ugraphic/MutableImage.java} (68%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/PixelImage.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/UBackground.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/UChangeBackColor.java rename src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/{UChangeColor.java => UGraphicNo.java} (74%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/UShapeIgnorableForCompression.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/color/AbstractColorMapper.java rename src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/{ => color}/ColorChangerMonochrome.java (90%) rename src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/{ => color}/ColorMapper.java (78%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/color/ColorMapperIdentity.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/color/ColorMapperLightnessInverse.java rename src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/{ => color}/ColorMapperMonochrome.java (66%) rename src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/{ => color}/ColorMapperReverse.java (67%) rename src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/{ => color}/ColorMapperTransparentWrapper.java (71%) rename src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/{ => color}/ColorOrder.java (92%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/color/ColorUtils.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{preproc/ReadLineEmpty.java => ugraphic/color/HColor.java} (73%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/color/HColorAbstract.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{graphic/HtmlColorTransparent.java => ugraphic/color/HColorAutomatic.java} (79%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{tim/TVariable.java => ugraphic/color/HColorBackground.java} (68%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{graphic/HtmlColorGradient.java => ugraphic/color/HColorGradient.java} (69%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{graphic/HtmlColorMiddle.java => ugraphic/color/HColorMiddle.java} (74%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{graphic/HtmlColorSet.java => ugraphic/color/HColorNone.java} (71%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{graphic/HtmlColorSetSimple.java => ugraphic/color/HColorSet.java} (80%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{graphic/HtmlColorSimple.java => ugraphic/color/HColorSimple.java} (67%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{graphic/HtmlColorAutomatic.java => ugraphic/color/HColorUserDef.java} (80%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{graphic/HtmlColorUtils.java => ugraphic/color/HColorUtils.java} (51%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/color/HUSLColorConverter.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/comp/CompressionXorYBuilder.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/comp/Expand.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/comp/ExpandTransform.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{preproc2/PreprocessorMode.java => ugraphic/comp/ExpandType.java} (80%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/comp/PiecewiseAffineComposition.java rename src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/comp/{TextBlockCompressedOnXorY.java => PiecewiseAffineOnXorYBuilder.java} (55%) rename src/plantuml-asl/src/net/sourceforge/plantuml/{cucadiagram/Namespace.java => ugraphic/comp/PiecewiseAffineTransform.java} (79%) delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPathG2dLegacy.java delete mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/g2d/DriverPathOldG2d.java rename src/plantuml-asl/src/net/sourceforge/plantuml/wbs/{Fork2.java => Fork.java} (88%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/wire/Block.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/wire/CommandComponent.java rename src/plantuml-asl/src/net/sourceforge/plantuml/{classdiagram/command/CommandHideShowSpecificStereotype.java => wire/CommandContainer.java} (61%) create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/wire/CommandContainerEnd.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/wire/CommandNewColumn.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/wire/CommandPin.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/wire/CommandPinSpace.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/wire/CommandVspace.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/wire/WireDiagram.java create mode 100644 src/plantuml-asl/src/net/sourceforge/plantuml/wire/WireDiagramFactory.java create mode 100644 src/plantuml-asl/src/sprites/archimate/association-unidirect.png create mode 100644 src/plantuml-asl/src/sprites/archimate/motivation-value.png create mode 100644 src/plantuml-asl/src/sprites/archimate/serving.png create mode 100644 src/plantuml-asl/src/sprites/archimate/specialization.png create mode 100644 src/plantuml-asl/src/sprites/archimate/strategy-value-stream.png create mode 100644 src/plantuml-asl/src/sprites/archimate/technology-communication-network.png create mode 100644 src/plantuml-asl/src/sprites/archimate/technology-interface.png create mode 100644 src/plantuml-asl/src/sprites/archimate/technology-path.png create mode 100644 src/plantuml-asl/src/sprites/archimate/technology-service.png create mode 100644 src/plantuml-asl/stdlib/archimate-abx.repx create mode 100644 src/plantuml-asl/stdlib/archimate-dex.repx create mode 100644 src/plantuml-asl/stdlib/elastic-abx.repx create mode 100644 src/plantuml-asl/stdlib/elastic-dex.repx create mode 100644 src/plantuml-asl/stdlib/kubernetes-abx.repx create mode 100644 src/plantuml-asl/stdlib/kubernetes-dex.repx create mode 100644 src/plantuml-asl/stdlib/logos-abx.repx create mode 100644 src/plantuml-asl/stdlib/logos-dex.repx diff --git a/src/plantuml-asl/build.xml b/src/plantuml-asl/build.xml index 7103dcb49..8d50232dd 100644 --- a/src/plantuml-asl/build.xml +++ b/src/plantuml-asl/build.xml @@ -20,7 +20,7 @@ - + size; i++) -UNSUPPORTED("c0a4ruccwt5263vw39xrttm0y"); // if (e == L->list[i]) -UNSUPPORTED("6cprbghvenu9ldc0ez1ifc63q"); // return; +public static void safe_list_append(ST_Agedge_s e, ST_elist L) { +ENTERING("cttswsffgmw1g710jzvdd3wzn","safe_list_append"); +try { + int i; + for (i = 0; i < L.size; i++) + if (EQ(e, L.list.get(i))) + return; UNSUPPORTED("cslejjtgepjdwlcykfas4fmvz"); // elist_append(e, (*L)); -UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // } - -throw new UnsupportedOperationException(); +} finally { +LEAVING("cttswsffgmw1g710jzvdd3wzn","safe_list_append"); +} } @@ -907,13 +906,13 @@ public static void other_edge(ST_Agedge_s e) { //3 4zg1fp1b7bhnx2tbeaij8yeel // void safe_other_edge(edge_t * e) -public static Object safe_other_edge(Object... arg) { -UNSUPPORTED("3cc9ux78ad0yjajm0nkpos345"); // void safe_other_edge(edge_t * e) -UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // { -UNSUPPORTED("bn816jsdz3qke6htvbwvztrpc"); // safe_list_append(e, &(ND_other(agtail(e)))); -UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // } - -throw new UnsupportedOperationException(); +public static void safe_other_edge(ST_Agedge_s e) { +ENTERING("4zg1fp1b7bhnx2tbeaij8yeel","safe_other_edge"); +try { + safe_list_append(e, ND_other(agtail(e))); +} finally { +LEAVING("4zg1fp1b7bhnx2tbeaij8yeel","safe_other_edge"); +} } diff --git a/src/plantuml-asl/src/gen/lib/label/index__c.java b/src/plantuml-asl/src/gen/lib/label/index__c.java index 40b1fbeb2..7b38b24b7 100644 --- a/src/plantuml-asl/src/gen/lib/label/index__c.java +++ b/src/plantuml-asl/src/gen/lib/label/index__c.java @@ -379,11 +379,12 @@ public static int RTreeInsert2(ST_RTree rtp, ST_Rect_t r, __ptr__ data, ST_Node_ CombineRect((ST_Rect_t)r, (ST_Rect_t) n.branch[i].rect)); return 0; } else { /* child was split */ -UNSUPPORTED("7evrfdq7uc1smqislqm9d82l6"); // n->branch[i].rect = NodeCover(n->branch[i].child); -UNSUPPORTED("echuth2qnq0o4n5gkzgtu5bgs"); // b.child = n2; -UNSUPPORTED("50z4r9qcomgi4o7vvwq0v0xs"); // b.rect = NodeCover(n2); -UNSUPPORTED("451qw2ioqybj69k9abzvqw4mk"); // rtp->EntryCount++; -UNSUPPORTED("9uz11nbvh6yp6yq2axvo7e0fb"); // return AddBranch(rtp, &b, n, new); + n.branch[i].setStruct("rect", + NodeCover((ST_Node_t___)n.branch[i].child)); + b.child = n2[0]; + b.rect.___(NodeCover(n2[0])); + rtp.setInt("EntryCount", rtp.EntryCount+1); + return AddBranch(rtp, b, n, new_); } } else if (n.level == level) { /* at level for insertion. */ /*Add rect, split if necessary */ diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/AFile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/AFile.java index 6bb9ff2a3..74405547b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/AFile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/AFile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,20 +30,21 @@ */ package net.sourceforge.plantuml; -import java.io.File; import java.io.IOException; import java.io.InputStream; +import net.sourceforge.plantuml.security.SFile; + public interface AFile { - public InputStream open() throws IOException; + public InputStream openFile(); public boolean isOk(); public AParentFolder getParentFile(); - public String getAbsolutePath(); + public SFile getUnderlyingFile(); - public File getUnderlyingFile(); + public SFile getSystemFolder() throws IOException; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/AFileRegular.java b/src/plantuml-asl/src/net/sourceforge/plantuml/AFileRegular.java index 37ba8ccaf..99711c82e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/AFileRegular.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/AFileRegular.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,26 +30,26 @@ */ package net.sourceforge.plantuml; -import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import net.sourceforge.plantuml.security.SFile; + public class AFileRegular implements AFile { - private final File file; + private final SFile file; @Override public String toString() { - return "AFileRegular::" + file; + return "AFileRegular::" + file.getAbsolutePath(); } - public AFileRegular(File file) { + public AFileRegular(SFile file) { this.file = file; } - public InputStream open() throws IOException { - return new FileInputStream(file); + public InputStream openFile() { + return file.openFile(); } public boolean isOk() { @@ -73,12 +73,12 @@ public AParentFolder getParentFile() { return new AParentFolderRegular(file.getParentFile()); } - public String getAbsolutePath() { - return file.getAbsolutePath(); + public SFile getUnderlyingFile() { + return file; } - public File getUnderlyingFile() { - return file; + public SFile getSystemFolder() throws IOException { + return file.getParentFile().getCanonicalFile(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/AFileZipEntry.java b/src/plantuml-asl/src/net/sourceforge/plantuml/AFileZipEntry.java index 0d2353c73..a4c1b78fa 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/AFileZipEntry.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/AFileZipEntry.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,60 +30,60 @@ */ package net.sourceforge.plantuml; -import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; +import net.sourceforge.plantuml.security.SFile; + public class AFileZipEntry implements AFile { - private final File zipFile; + private final SFile zipFile; private final String entry; - public AFileZipEntry(File file, String entry) { + public AFileZipEntry(SFile file, String entry) { this.zipFile = file; this.entry = entry; } @Override public String toString() { - return "AFileZipEntry::" + zipFile + " " + entry; + return "AFileZipEntry::" + zipFile.getAbsolutePath() + " " + entry; } - public InputStream open() throws IOException { - final ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile)); - ZipEntry ze = zis.getNextEntry(); + public InputStream openFile() { + final InputStream tmp = zipFile.openFile(); + if (tmp != null) + try { + final ZipInputStream zis = new ZipInputStream(tmp); + ZipEntry ze = zis.getNextEntry(); - while (ze != null) { - final String fileName = ze.getName(); - if (ze.isDirectory()) { - } else if (fileName.trim().equalsIgnoreCase(entry.trim())) { - return zis; + while (ze != null) { + final String fileName = ze.getName(); + if (ze.isDirectory()) { + } else if (fileName.trim().equalsIgnoreCase(entry.trim())) { + return zis; + } + ze = zis.getNextEntry(); + } + zis.closeEntry(); + zis.close(); + } catch (IOException e) { + e.printStackTrace(); } - ze = zis.getNextEntry(); - } - zis.closeEntry(); - zis.close(); - throw new IOException(); + return null; } public boolean isOk() { if (zipFile.exists() && zipFile.isDirectory() == false) { - InputStream is = null; - try { - is = open(); - return true; - } catch (IOException e) { - // e.printStackTrace(); - } finally { + final InputStream is = openFile(); + if (is != null) { try { - if (is != null) { - is.close(); - } - } catch (IOException e1) { - e1.printStackTrace(); + is.close(); + return true; + } catch (IOException e) { + e.printStackTrace(); } } } @@ -108,12 +108,12 @@ public AParentFolder getParentFile() { return new AParentFolderZip(zipFile, entry); } - public String getAbsolutePath() { - return zipFile.getAbsolutePath() + "~" + entry; + public SFile getUnderlyingFile() { + return zipFile; } - public File getUnderlyingFile() { - return zipFile; + public SFile getSystemFolder() throws IOException { + return zipFile.getParentFile().getCanonicalFile(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/AParentFolder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/AParentFolder.java index 1afdfeec8..9092fb4e7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/AParentFolder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/AParentFolder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/AParentFolderRegular.java b/src/plantuml-asl/src/net/sourceforge/plantuml/AParentFolderRegular.java index f371fc098..fac3c8fd4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/AParentFolderRegular.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/AParentFolderRegular.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,33 +30,34 @@ */ package net.sourceforge.plantuml; -import java.io.File; import java.io.IOException; +import net.sourceforge.plantuml.security.SFile; + public class AParentFolderRegular implements AParentFolder { - private final File dir; + private final SFile dir; - public AParentFolderRegular(File dir) { + public AParentFolderRegular(SFile dir) { this.dir = dir; - Log.info("Creating AParentFolderRegular " + dir); + // Log.info("Creating AParentFolderRegular " + dir); } @Override public String toString() { - return "AParentFolderRegular::" + (dir == null ? "NULL" : dir.getAbsolutePath()); + return "AParentFolderRegular::" + (dir == null ? "NULL" : dir.getPrintablePath()); } public AFile getAFile(String nameOrPath) throws IOException { - final File filecurrent; - Log.info("AParentFolderRegular::looking for " + nameOrPath); - Log.info("AParentFolderRegular::dir = " + dir); + final SFile filecurrent; + // Log.info("AParentFolderRegular::looking for " + nameOrPath); + // Log.info("AParentFolderRegular::dir = " + dir); if (dir == null) { - filecurrent = new File(nameOrPath); + filecurrent = new SFile(nameOrPath); } else { - filecurrent = new File(dir.getAbsoluteFile(), nameOrPath); + filecurrent = dir.getAbsoluteFile().file(nameOrPath); } - Log.info("AParentFolderRegular::Filecurrent " + filecurrent); + // Log.info("AParentFolderRegular::Filecurrent " + filecurrent); if (filecurrent.exists()) { return new AFileRegular(filecurrent.getCanonicalFile()); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/AParentFolderZip.java b/src/plantuml-asl/src/net/sourceforge/plantuml/AParentFolderZip.java index 29bf6f596..1cd12b47d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/AParentFolderZip.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/AParentFolderZip.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,12 +30,13 @@ */ package net.sourceforge.plantuml; -import java.io.File; import java.io.IOException; +import net.sourceforge.plantuml.security.SFile; + public class AParentFolderZip implements AParentFolder { - private final File zipFile; + private final SFile zipFile; private final String parent; @Override @@ -43,7 +44,7 @@ public String toString() { return "AParentFolderZip::" + zipFile + " " + parent; } - public AParentFolderZip(File zipFile, String entry) { + public AParentFolderZip(SFile zipFile, String entry) { this.zipFile = zipFile; final int idx = entry.lastIndexOf('/'); if (idx == -1) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/AbstractPSystem.java b/src/plantuml-asl/src/net/sourceforge/plantuml/AbstractPSystem.java index d49e76754..fe151c7e2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/AbstractPSystem.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/AbstractPSystem.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -70,7 +70,12 @@ final public String getMetadata() { if (source == null) { return getVersion(); } - return source.getPlainString() + BackSlash.NEWLINE + getVersion(); + final String rawString = source.getRawString(); + final String plainString = source.getPlainString(); + if (rawString != null && rawString.equals(plainString)) { + return rawString + BackSlash.NEWLINE + getVersion(); + } + return rawString + BackSlash.NEWLINE + plainString + BackSlash.NEWLINE + getVersion(); } final public UmlSource getSource() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/AlignmentParam.java b/src/plantuml-asl/src/net/sourceforge/plantuml/AlignmentParam.java index 48c61f3a2..22bc69801 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/AlignmentParam.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/AlignmentParam.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/AnimatedGifEncoder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/AnimatedGifEncoder.java index 96a6fe711..e8a252016 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/AnimatedGifEncoder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/AnimatedGifEncoder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,8 +34,6 @@ import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.awt.image.DataBufferByte; -import java.io.BufferedOutputStream; -import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; @@ -107,23 +105,20 @@ public class AnimatedGifEncoder { protected int sample = 10; // default sample interval for quantizer /** - * Sets the delay time between each frame, or changes it for subsequent - * frames (applies to last frame added). + * Sets the delay time between each frame, or changes it for subsequent frames + * (applies to last frame added). * - * @param ms - * int delay time in milliseconds + * @param ms int delay time in milliseconds */ public void setDelay(int ms) { delay = Math.round(ms / 10.0f); } /** - * Sets the GIF frame disposal code for the last added frame and any - * subsequent frames. Default is 0 if no transparent color has been set, - * otherwise 2. + * Sets the GIF frame disposal code for the last added frame and any subsequent + * frames. Default is 0 if no transparent color has been set, otherwise 2. * - * @param code - * int disposal code. + * @param code int disposal code. */ public void setDispose(int code) { if (code >= 0) { @@ -132,12 +127,11 @@ public void setDispose(int code) { } /** - * Sets the number of times the set of GIF frames should be played. Default - * is 1; 0 means play indefinitely. Must be invoked before the first image - * is added. + * Sets the number of times the set of GIF frames should be played. Default is + * 1; 0 means play indefinitely. Must be invoked before the first image is + * added. * - * @param iter - * int number of iterations. + * @param iter int number of iterations. */ public void setRepeat(int iter) { if (iter >= 0) { @@ -148,26 +142,24 @@ public void setRepeat(int iter) { /** * Sets the transparent color for the last added frame and any subsequent * frames. Since all colors are subject to modification in the quantization - * process, the color in the final palette for each frame closest to the - * given color becomes the transparent color for that frame. May be set to - * null to indicate no transparent color. + * process, the color in the final palette for each frame closest to the given + * color becomes the transparent color for that frame. May be set to null to + * indicate no transparent color. * - * @param c - * Color to be treated as transparent on display. + * @param c Color to be treated as transparent on display. */ public void setTransparent(Color c) { transparent = c; } /** - * Adds next GIF frame. The frame is not written immediately, but is - * actually deferred until the next frame is received so that timing data - * can be inserted. Invoking finish() flushes all frames. If - * setSize was not invoked, the size of the first image is - * used for all subsequent frames. + * Adds next GIF frame. The frame is not written immediately, but is actually + * deferred until the next frame is received so that timing data can be + * inserted. Invoking finish() flushes all frames. If + * setSize was not invoked, the size of the first image is used for + * all subsequent frames. * - * @param im - * BufferedImage containing frame to write. + * @param im BufferedImage containing frame to write. * @return true if successful. */ public boolean addFrame(BufferedImage im) { @@ -241,8 +233,7 @@ public boolean finish() { * Sets frame rate in frames per second. Equivalent to * setDelay(1000/fps). * - * @param fps - * float frame rate (frames per second) + * @param fps float frame rate (frames per second) */ public void setFrameRate(float fps) { if (fps != 0f) { @@ -251,14 +242,13 @@ public void setFrameRate(float fps) { } /** - * Sets quality of color quantization (conversion of images to the maximum - * 256 colors allowed by the GIF specification). Lower values (minimum = 1) - * produce better colors, but slow processing significantly. 10 is the - * default, and produces good color mapping at reasonable speeds. Values - * greater than 20 do not yield significant improvements in speed. + * Sets quality of color quantization (conversion of images to the maximum 256 + * colors allowed by the GIF specification). Lower values (minimum = 1) produce + * better colors, but slow processing significantly. 10 is the default, and + * produces good color mapping at reasonable speeds. Values greater than 20 do + * not yield significant improvements in speed. * - * @param quality - * int greater than 0. + * @param quality int greater than 0. */ public void setQuality(int quality) { if (quality < 1) @@ -270,10 +260,8 @@ public void setQuality(int quality) { * Sets the GIF frame size. The default size is the size of the first frame * added if this method is not invoked. * - * @param w - * int frame width. - * @param h - * int frame width. + * @param w int frame width. + * @param h int frame width. */ public void setSize(int w, int h) { if (started && !firstFrame) @@ -291,8 +279,7 @@ public void setSize(int w, int h) { * Initiates GIF file creation on the given stream. The stream is not closed * automatically. * - * @param os - * OutputStream on which GIF images are written. + * @param os OutputStream on which GIF images are written. * @return false if initial write failed. */ public boolean start(OutputStream os) { @@ -309,24 +296,23 @@ public boolean start(OutputStream os) { return started = ok; } - /** - * Initiates writing of a GIF file with the specified name. - * - * @param file - * String containing output file name. - * @return false if open or initial write failed. - */ - public boolean start(String file) { - boolean ok = true; - try { - out = new BufferedOutputStream(new FileOutputStream(file)); - ok = start(out); - closeStream = true; - } catch (IOException e) { - ok = false; - } - return started = ok; - } +// /** +// * Initiates writing of a GIF file with the specified name. +// * +// * @param file String containing output file name. +// * @return false if open or initial write failed. +// */ +// public boolean start(String file) { +// boolean ok = true; +// try { +// out = SecurityUtils.createBufferedOutputStream(file); +// ok = start(out); +// closeStream = true; +// } catch (IOException e) { +// ok = false; +// } +// return started = ok; +// } /** * Analyzes image colors and creates color map. @@ -571,9 +557,9 @@ class NeuQuant { /* * Program Skeleton ---------------- [select samplefac in range 1..30] [read * image from input file] pic = (unsigned char*) malloc(3*width*height); - * initnet(pic,3*width*height,samplefac); learn(); unbiasnet(); [write - * output image header, using writecolourmap(f)] inxbuild(); write output - * image using inxsearch(b,g,r) + * initnet(pic,3*width*height,samplefac); learn(); unbiasnet(); [write output + * image header, using writecolourmap(f)] inxbuild(); write output image using + * inxsearch(b,g,r) */ /* @@ -603,8 +589,7 @@ class NeuQuant { /* defs for decreasing radius factor */ protected static final int initrad = (netsize >> 3); /* - * for 256 cols, - * radius starts + * for 256 cols, radius starts */ protected static final int radiusbiasshift = 6; /* at 32.0 biased by 6 bits */ @@ -612,9 +597,7 @@ class NeuQuant { protected static final int radiusbias = (((int) 1) << radiusbiasshift); protected static final int initradius = (initrad * radiusbias); /* - * and - * decreases - * by a + * and decreases by a */ protected static final int radiusdec = 30; /* factor of 1/30 each cycle */ @@ -702,7 +685,8 @@ public byte[] colorMap() { /* * Insertion sort of network and building of netindex[0..255] (to do after * unbias) - * ------------------------------------------------------------------------------- + * ----------------------------------------------------------------------------- + * -- */ public void inxbuild() { @@ -832,8 +816,7 @@ else if ((lengthcount % prime1) != 0) } /* - * Search for BGR values 0..255 (after net is unbiased) and return colour - * index + * Search for BGR values 0..255 (after net is unbiased) and return colour index * ---------------------------------------------------------------------------- */ public int map(int b, int g, int r) { @@ -910,9 +893,10 @@ public byte[] process() { } /* - * Unbias network to give byte values 0..255 and record position i to - * prepare for sort - * ----------------------------------------------------------------------------------- + * Unbias network to give byte values 0..255 and record position i to prepare + * for sort + * ----------------------------------------------------------------------------- + * ------ */ public void unbiasnet() { @@ -929,7 +913,8 @@ public void unbiasnet() { /* * Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in * radpower[|i-j|] - * --------------------------------------------------------------------------------- + * ----------------------------------------------------------------------------- + * ---- */ protected void alterneigh(int rad, int i, int b, int g, int r) { @@ -990,8 +975,7 @@ protected int contest(int b, int g, int r) { /* finds closest neuron (min dist) and updates freq */ /* finds best neuron (min dist-bias) and returns position */ /* - * for frequently chosen neurons, freq[i] is high and bias[i] is - * negative + * for frequently chosen neurons, freq[i] is high and bias[i] is negative */ /* bias[i] = gamma*((1/netsize)-freq[i]) */ diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/Annotated.java b/src/plantuml-asl/src/net/sourceforge/plantuml/Annotated.java index 87ffde00e..cf15fc45e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/Annotated.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/Annotated.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/AnnotatedWorker.java b/src/plantuml-asl/src/net/sourceforge/plantuml/AnnotatedWorker.java index 0464e90e2..8ce72d787 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/AnnotatedWorker.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/AnnotatedWorker.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,8 +39,6 @@ import net.sourceforge.plantuml.cucadiagram.DisplaySection; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; @@ -49,12 +47,14 @@ import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.style.StyleDefinition; +import net.sourceforge.plantuml.style.StyleSignature; 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.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class AnnotatedWorker { @@ -77,6 +77,10 @@ public TextBlockBackcolored addAdd(TextBlock result) { return (TextBlockBackcolored) result; } + public boolean hasMainFrame() { + return annotated.getMainFrame() != null; + } + public TextBlock addFrame(final TextBlock original) { final Display mainFrame = annotated.getMainFrame(); if (mainFrame == null) { @@ -88,42 +92,50 @@ public TextBlock addFrame(final TextBlock original) { final double y1 = 10; final double y2 = 10; - final SymbolContext symbolContext = new SymbolContext(getSkinParam().getBackgroundColor(), HtmlColorUtils.BLACK) - .withShadow(getSkinParam().shadowing(null)); + final SymbolContext symbolContext = new SymbolContext(getBackgroundColor(), HColorUtils.BLACK) + .withShadow(getSkinParam().shadowing(null) ? 3 : 0); + final MinMax originalMinMax = TextBlockUtils.getMinMax(original, stringBounder, false); final TextBlock title = mainFrame.create(new FontConfiguration(getSkinParam(), FontParam.CAPTION, null), HorizontalAlignment.CENTER, getSkinParam()); final Dimension2D dimTitle = title.calculateDimension(stringBounder); - final Dimension2D dimOriginal = original.calculateDimension(stringBounder); - final double width = x1 + Math.max(dimOriginal.getWidth(), dimTitle.getWidth()) + x2; - final double height = dimTitle.getHeight() + y1 + dimOriginal.getHeight() + y2; - final TextBlock result = USymbol.FRAME.asBig(title, HorizontalAlignment.LEFT, TextBlockUtils.empty(0, 0), - width, height, symbolContext, skinParam.getStereotypeAlignment()); + // 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, + height, symbolContext, skinParam.getStereotypeAlignment()); return new TextBlockBackcolored() { public void drawU(UGraphic ug) { - result.drawU(ug); + frame.drawU(ug.apply(UTranslate.dx(originalMinMax.getMinX()))); original.drawU(ug.apply(new UTranslate(x1, y1 + dimTitle.getHeight()))); + // original.drawU(ug); } public MinMax getMinMax(StringBounder stringBounder) { - return TextBlockUtils.getMinMax(result, stringBounder); + return TextBlockUtils.getMinMax(this, stringBounder, false); } public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) { - return result.getInnerPosition(member, stringBounder, strategy); + final Rectangle2D rect = original.getInnerPosition(member, stringBounder, strategy); + return new Rectangle2D.Double(rect.getX() + x1, rect.getY() + y1 + dimTitle.getHeight(), + rect.getWidth(), rect.getHeight()); } public Dimension2D calculateDimension(StringBounder stringBounder) { - return result.calculateDimension(stringBounder); + return original.calculateDimension(stringBounder); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return symbolContext.getBackColor(); } }; } + private HColor getBackgroundColor() { + return getSkinParam().getBackgroundColor(false); + } + private TextBlock addLegend(TextBlock original) { final DisplayPositionned legend = annotated.getLegend(); if (legend.isNull()) { @@ -153,8 +165,8 @@ public TextBlock getCaption() { return TextBlockUtils.empty(0, 0); } if (SkinParam.USE_STYLES()) { - final Style style = StyleDefinition.of(SName.root, SName.caption).getMergedStyle( - skinParam.getCurrentStyleBuilder()); + final Style style = StyleSignature.of(SName.root, SName.caption) + .getMergedStyle(skinParam.getCurrentStyleBuilder()); return style.createTextBlockBordered(caption.getDisplay(), skinParam.getIHtmlColorSet(), skinParam); } return caption.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.CAPTION, null), @@ -166,13 +178,18 @@ private TextBlock addTitle(TextBlock original) { if (title.isNull()) { return original; } - ISkinParam skinParam = getSkinParam(); - // if (SkinParam.USE_STYLES()) { - // throw new UnsupportedOperationException(); - // } - final FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.TITLE, null); - final TextBlock block = TextBlockUtils.title(fontConfiguration, title.getDisplay(), skinParam); + final TextBlock block; + if (SkinParam.USE_STYLES()) { + final Style style = StyleSignature.of(SName.root, SName.title) + .getMergedStyle(skinParam.getCurrentStyleBuilder()); + block = style.createTextBlockBordered(title.getDisplay(), skinParam.getIHtmlColorSet(), skinParam); + } else { + final ISkinParam skinParam = getSkinParam(); + final FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.TITLE, null); + block = TextBlockUtils.title(fontConfiguration, title.getDisplay(), skinParam); + } + return DecorateEntityImage.addTop(original, block, HorizontalAlignment.CENTER); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/BackSlash.java b/src/plantuml-asl/src/net/sourceforge/plantuml/BackSlash.java index 85663ad22..9e0a134d1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/BackSlash.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/BackSlash.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/BaseFile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/BaseFile.java index 5319f4c5d..147afa356 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/BaseFile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/BaseFile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,19 +30,19 @@ */ package net.sourceforge.plantuml; -import java.io.File; +import net.sourceforge.plantuml.security.SFile; public class BaseFile { private final String basename; - private final File basedir; + private final SFile basedir; public BaseFile() { this.basedir = null; this.basename = null; } - public BaseFile(File file) { + public BaseFile(SFile file) { this.basedir = file.getParentFile(); this.basename = extractBasename(file.getName()); } @@ -67,15 +67,15 @@ public String getBasename() { return basename; } - public File getBasedir() { + public SFile getBasedir() { return basedir; } - public File getTraceFile(String tail) { + public SFile getTraceFile(String tail) { if (basedir == null || basename == null) { - return new File(tail); + return new SFile(tail); } - return new File(basedir, basename + "_" + tail); + return basedir.file(basename + "_" + tail); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/BasicEnsureVisible.java b/src/plantuml-asl/src/net/sourceforge/plantuml/BasicEnsureVisible.java index af686e811..c89320178 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/BasicEnsureVisible.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/BasicEnsureVisible.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/BlockUml.java b/src/plantuml-asl/src/net/sourceforge/plantuml/BlockUml.java index 3ab0dca8a..47107a8ee 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/BlockUml.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/BlockUml.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,7 +35,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.HashSet; import java.util.List; +import java.util.Set; import net.sourceforge.plantuml.code.AsciiEncoder; import net.sourceforge.plantuml.code.Transcoder; @@ -44,7 +46,7 @@ import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.error.PSystemErrorPreprocessor; import net.sourceforge.plantuml.preproc.Defines; -import net.sourceforge.plantuml.preproc2.PreprocessorMode; +import net.sourceforge.plantuml.preproc.FileWithSuffix; import net.sourceforge.plantuml.preproc2.PreprocessorModeSet; import net.sourceforge.plantuml.tim.TimLoader; import net.sourceforge.plantuml.utils.StartUtils; @@ -52,11 +54,17 @@ public class BlockUml { + private final List rawSource; private final List data; private List debug; private Diagram system; private final Defines localDefines; private final ISkinSimple skinParam; + private final Set included = new HashSet(); + + public Set getIncluded() { + return Collections.unmodifiableSet(included); + } BlockUml(String... strings) { this(convert(strings), Defines.createEmpty(), null, null); @@ -93,26 +101,25 @@ public static List convert(List strings) { return result; } - private PreprocessorMode pmode = PreprocessorMode.V1_LEGACY; private boolean preprocessorError; public BlockUml(List strings, Defines defines, ISkinSimple skinParam, PreprocessorModeSet mode) { + 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) { throw new IllegalArgumentException(); } - if (mode != null && mode.getPreprocessorMode() == PreprocessorMode.V2_NEW_TIM) { - this.pmode = mode.getPreprocessorMode(); + if (mode == null) { + this.data = new ArrayList(strings); + } else { final TimLoader timLoader = new TimLoader(mode.getImportedFiles(), defines, mode.getCharset(), (DefinitionsContainer) mode); - timLoader.load(strings); - this.data = timLoader.getResult(); + this.included.addAll(timLoader.load(strings)); + this.data = timLoader.getResultList(); this.debug = timLoader.getDebug(); this.preprocessorError = timLoader.isPreprocessorError(); - } else { - this.data = new ArrayList(strings); } } @@ -148,7 +155,7 @@ public Diagram getDiagram() { if (preprocessorError) { system = new PSystemErrorPreprocessor(data, debug); } else { - system = new PSystemBuilder().createPSystem(skinParam, data); + system = new PSystemBuilder().createPSystem(skinParam, data, rawSource); } } return system; @@ -187,25 +194,14 @@ public boolean isStartDef(String name) { } public List getDefinition(boolean withHeader) { - final List data2 = new ArrayList(); + final List result = new ArrayList(); for (StringLocated s : data) { - data2.add(s.getString()); - } - if (withHeader) { - return Collections.unmodifiableList(data2); - } - return Collections.unmodifiableList(data2.subList(1, data2.size() - 1)); - } - - public List getDefinition2(boolean withHeader) { - final List data2 = new ArrayList(); - for (StringLocated s : debug) { - data2.add(s.getString()); + result.add(s.getString()); } if (withHeader) { - return Collections.unmodifiableList(data2); + return Collections.unmodifiableList(result); } - return Collections.unmodifiableList(data2.subList(1, data2.size() - 1)); + return Collections.unmodifiableList(result.subList(1, result.size() - 1)); } public Defines getLocalDefines() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/BlockUmlBuilder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/BlockUmlBuilder.java index 7f7706159..809924a93 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/BlockUmlBuilder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/BlockUmlBuilder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,7 +30,6 @@ */ package net.sourceforge.plantuml; -import java.io.File; import java.io.IOException; import java.io.Reader; import java.util.ArrayList; @@ -42,41 +41,38 @@ import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.FileWithSuffix; import net.sourceforge.plantuml.preproc.ImportedFiles; -import net.sourceforge.plantuml.preproc.PreprocessorChangeModeReader; import net.sourceforge.plantuml.preproc.ReadLineNumbered; import net.sourceforge.plantuml.preproc.ReadLineReader; import net.sourceforge.plantuml.preproc.UncommentReadLine; import net.sourceforge.plantuml.preproc2.Preprocessor; -import net.sourceforge.plantuml.preproc2.PreprocessorMode; +import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.utils.StartUtils; public final class BlockUmlBuilder implements DefinitionsContainer { - private PreprocessorMode mode = PreprocessorMode.V2_NEW_TIM; - private final List blocks = new ArrayList(); private Set usedFiles = new HashSet(); - private final UncommentReadLine reader2; + private final UncommentReadLine reader; private final Defines defines; private final ImportedFiles importedFiles; private final String charset; - public BlockUmlBuilder(List config, String charset, Defines defines, Reader reader, File newCurrentDir, + public BlockUmlBuilder(List config, String charset, Defines defines, Reader readerInit, SFile newCurrentDir, String desc) throws IOException { ReadLineNumbered includer = null; this.defines = defines; this.charset = charset; try { - this.reader2 = new UncommentReadLine(new PreprocessorChangeModeReader(ReadLineReader.create(reader, desc), - this)); + this.reader = new UncommentReadLine(ReadLineReader.create(readerInit, desc)); this.importedFiles = ImportedFiles.createImportedFiles(new AParentFolderRegular(newCurrentDir)); - includer = new Preprocessor(config, reader2, charset, defines, this, importedFiles); + includer = new Preprocessor(config, reader); init(includer); } finally { if (includer != null) { includer.close(); - usedFiles = includer.getFilesUsed(); + // usedFiles = includer.getFilesUsedTOBEREMOVED(); } + readerInit.close(); } } @@ -86,42 +82,44 @@ public BlockUmlBuilder(List config, String charset, Defines defines, Rea private void init(ReadLineNumbered includer) throws IOException { StringLocated s = null; - List current2 = null; + List current = null; boolean paused = false; while ((s = includer.readLine()) != null) { if (StartUtils.isArobaseStartDiagram(s.getString())) { - current2 = new ArrayList(); + current = new ArrayList(); paused = false; } if (StartUtils.isArobasePauseDiagram(s.getString())) { paused = true; - reader2.setPaused(true); + reader.setPaused(true); } if (StartUtils.isExit(s.getString())) { paused = true; - reader2.setPaused(true); + reader.setPaused(true); } - if (current2 != null && paused == false) { - current2.add(s); + if (current != null && paused == false) { + current.add(s); } else if (paused) { final StringLocated append = StartUtils.getPossibleAppend(s); if (append != null) { - current2.add(append); + current.add(append); } } if (StartUtils.isArobaseUnpauseDiagram(s.getString())) { paused = false; - reader2.setPaused(false); + reader.setPaused(false); } - if (StartUtils.isArobaseEndDiagram(s.getString()) && current2 != null) { + if (StartUtils.isArobaseEndDiagram(s.getString()) && current != null) { if (paused) { - current2.add(s); + current.add(s); } - blocks.add(new BlockUml(current2, defines.cloneMe(), null, this)); - current2 = null; - reader2.setPaused(false); + final BlockUml uml = new BlockUml(current, defines.cloneMe(), null, this); + usedFiles.addAll(uml.getIncluded()); + blocks.add(uml); + current = null; + reader.setPaused(false); } } } @@ -134,33 +132,15 @@ public final Set getIncludedFiles() { return Collections.unmodifiableSet(usedFiles); } - public List getDefinition1(String name) { + public List getDefinition(String name) { for (BlockUml block : blocks) { if (block.isStartDef(name)) { - this.defines.importFrom(block.getLocalDefines()); return block.getDefinition(false); } } return Collections.emptyList(); } - public List getDefinition2(String name) { - for (BlockUml block : blocks) { - if (block.isStartDef(name)) { - return block.getDefinition2(false); - } - } - return Collections.emptyList(); - } - - public PreprocessorMode getPreprocessorMode() { - return mode; - } - - public void setPreprocessorMode(PreprocessorMode mode) { - this.mode = mode; - } - public final ImportedFiles getImportedFiles() { return importedFiles; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/CMapData.java b/src/plantuml-asl/src/net/sourceforge/plantuml/CMapData.java index 580e469bc..5a7438446 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/CMapData.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/CMapData.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ClipboardLoop.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ClipboardLoop.java index c1d943148..6d1556e8b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ClipboardLoop.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ClipboardLoop.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,9 +40,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; -import javax.imageio.ImageIO; - import net.sourceforge.plantuml.core.DiagramDescription; +import net.sourceforge.plantuml.security.ImageIO; public class ClipboardLoop { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ColorParam.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ColorParam.java index 027db659f..7e86321f8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ColorParam.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ColorParam.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,164 +30,165 @@ */ package net.sourceforge.plantuml; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public enum ColorParam { - background(HtmlColorUtils.WHITE, true, ColorType.BACK), - hyperlink(HtmlColorUtils.BLUE), + background(HColorUtils.WHITE, true, ColorType.BACK), + hyperlink(HColorUtils.BLUE), - activityDiamondBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - activityDiamondBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - activityBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - activityBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - activityStart(HtmlColorUtils.BLACK), - activityEnd(HtmlColorUtils.BLACK), - activityBar(HtmlColorUtils.BLACK), - swimlaneBorder(HtmlColorUtils.BLACK), + activityDiamondBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + activityDiamondBorder(HColorUtils.MY_RED, ColorType.LINE), + activityBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + activityBorder(HColorUtils.MY_RED, ColorType.LINE), + activityStart(HColorUtils.BLACK), + activityEnd(HColorUtils.BLACK), + activityBar(HColorUtils.BLACK), + swimlaneBorder(HColorUtils.BLACK), swimlaneTitleBackground(null), - usecaseBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - usecaseBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), + usecaseBorder(HColorUtils.MY_RED, ColorType.LINE), + usecaseBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), - objectBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - objectBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + objectBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + objectBorder(HColorUtils.MY_RED, ColorType.LINE), classHeaderBackground(null, true, ColorType.BACK), - classBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - enumBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - classBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - stereotypeCBackground(HtmlColorUtils.COL_ADD1B2), - stereotypeNBackground(HtmlColorUtils.COL_E3664A), - stereotypeABackground(HtmlColorUtils.COL_A9DCDF), - stereotypeIBackground(HtmlColorUtils.COL_B4A7E5), - stereotypeEBackground(HtmlColorUtils.COL_EB937F), + classBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + enumBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + classBorder(HColorUtils.MY_RED, ColorType.LINE), + stereotypeCBackground(HColorUtils.COL_ADD1B2), + stereotypeNBackground(HColorUtils.COL_E3664A), + stereotypeABackground(HColorUtils.COL_A9DCDF), + stereotypeIBackground(HColorUtils.COL_B4A7E5), + stereotypeEBackground(HColorUtils.COL_EB937F), stereotypeCBorder(null), stereotypeNBorder(null), stereotypeABorder(null), stereotypeIBorder(null), stereotypeEBorder(null), - packageBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - packageBorder(HtmlColorUtils.BLACK, ColorType.LINE), + packageBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + packageBorder(HColorUtils.BLACK, ColorType.LINE), - partitionBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - partitionBorder(HtmlColorUtils.BLACK, ColorType.LINE), + partitionBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + partitionBorder(HColorUtils.BLACK, ColorType.LINE), - componentBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - componentBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - interfaceBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - interfaceBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - arrow(HtmlColorUtils.MY_RED, ColorType.ARROW), + componentBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + componentBorder(HColorUtils.MY_RED, ColorType.LINE), + interfaceBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + interfaceBorder(HColorUtils.MY_RED, ColorType.LINE), + arrow(HColorUtils.MY_RED, ColorType.ARROW), + arrowHead(HColorUtils.MY_RED, null), - stateBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - stateBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - stateStart(HtmlColorUtils.BLACK), - stateEnd(HtmlColorUtils.BLACK), + stateBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + stateBorder(HColorUtils.MY_RED, ColorType.LINE), + stateStart(HColorUtils.BLACK), + stateEnd(HColorUtils.BLACK), - noteBackground(HtmlColorUtils.COL_FBFB77, true, ColorType.BACK), - noteBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + noteBackground(HColorUtils.COL_FBFB77, true, ColorType.BACK), + noteBorder(HColorUtils.MY_RED, ColorType.LINE), - legendBackground(HtmlColorUtils.COL_DDDDDD, true, ColorType.BACK), - legendBorder(HtmlColorUtils.BLACK, ColorType.LINE), + legendBackground(HColorUtils.COL_DDDDDD, true, ColorType.BACK), + legendBorder(HColorUtils.BLACK, ColorType.LINE), titleBackground(null, true, ColorType.BACK), titleBorder(null, ColorType.LINE), diagramBorder(null, ColorType.LINE), - actorBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - actorBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - participantBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - participantBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - sequenceGroupBorder(HtmlColorUtils.BLACK, ColorType.LINE), - sequenceGroupBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK), - sequenceGroupBodyBackground(HtmlColorUtils.RED, true, ColorType.BACK), - sequenceReferenceBorder(HtmlColorUtils.BLACK, ColorType.LINE), - sequenceReferenceHeaderBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK), - sequenceReferenceBackground(HtmlColorUtils.WHITE, true, ColorType.BACK), - sequenceDividerBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK), - sequenceDividerBorder(HtmlColorUtils.BLACK, ColorType.LINE), - sequenceLifeLineBackground(HtmlColorUtils.WHITE, true, ColorType.BACK), - sequenceLifeLineBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - sequenceNewpageSeparator(HtmlColorUtils.BLACK, ColorType.LINE), - sequenceBoxBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - sequenceBoxBackground(HtmlColorUtils.COL_DDDDDD, true, ColorType.BACK), + actorBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + actorBorder(HColorUtils.MY_RED, ColorType.LINE), + participantBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + participantBorder(HColorUtils.MY_RED, ColorType.LINE), + sequenceGroupBorder(HColorUtils.BLACK, ColorType.LINE), + sequenceGroupBackground(HColorUtils.COL_EEEEEE, true, ColorType.BACK), + sequenceGroupBodyBackground(HColorUtils.RED, true, ColorType.BACK), + sequenceReferenceBorder(HColorUtils.BLACK, ColorType.LINE), + sequenceReferenceHeaderBackground(HColorUtils.COL_EEEEEE, true, ColorType.BACK), + sequenceReferenceBackground(HColorUtils.WHITE, true, ColorType.BACK), + sequenceDividerBackground(HColorUtils.COL_EEEEEE, true, ColorType.BACK), + sequenceDividerBorder(HColorUtils.BLACK, ColorType.LINE), + sequenceLifeLineBackground(HColorUtils.WHITE, true, ColorType.BACK), + sequenceLifeLineBorder(HColorUtils.MY_RED, ColorType.LINE), + sequenceNewpageSeparator(HColorUtils.BLACK, ColorType.LINE), + sequenceBoxBorder(HColorUtils.MY_RED, ColorType.LINE), + sequenceBoxBackground(HColorUtils.COL_DDDDDD, true, ColorType.BACK), - artifactBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - artifactBorder(HtmlColorUtils.BLACK, ColorType.LINE), - cloudBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - cloudBorder(HtmlColorUtils.BLACK, ColorType.LINE), - queueBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - queueBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - stackBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - stackBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - databaseBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - databaseBorder(HtmlColorUtils.BLACK, ColorType.LINE), - folderBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - folderBorder(HtmlColorUtils.BLACK, ColorType.LINE), - fileBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - fileBorder(HtmlColorUtils.BLACK, ColorType.LINE), - frameBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - frameBorder(HtmlColorUtils.BLACK, ColorType.LINE), - nodeBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - nodeBorder(HtmlColorUtils.BLACK, ColorType.LINE), - rectangleBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - rectangleBorder(HtmlColorUtils.BLACK, ColorType.LINE), - archimateBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - archimateBorder(HtmlColorUtils.BLACK, ColorType.LINE), - cardBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - cardBorder(HtmlColorUtils.BLACK, ColorType.LINE), - agentBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - agentBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - storageBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - storageBorder(HtmlColorUtils.BLACK, ColorType.LINE), - boundaryBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - boundaryBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - collectionsBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - collectionsBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - controlBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - controlBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - entityBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - entityBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + artifactBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + artifactBorder(HColorUtils.BLACK, ColorType.LINE), + cloudBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + cloudBorder(HColorUtils.BLACK, ColorType.LINE), + queueBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + queueBorder(HColorUtils.MY_RED, ColorType.LINE), + stackBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + stackBorder(HColorUtils.MY_RED, ColorType.LINE), + databaseBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + databaseBorder(HColorUtils.BLACK, ColorType.LINE), + folderBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + folderBorder(HColorUtils.BLACK, ColorType.LINE), + fileBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + fileBorder(HColorUtils.BLACK, ColorType.LINE), + frameBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + frameBorder(HColorUtils.BLACK, ColorType.LINE), + nodeBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + nodeBorder(HColorUtils.BLACK, ColorType.LINE), + rectangleBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + rectangleBorder(HColorUtils.BLACK, ColorType.LINE), + archimateBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + archimateBorder(HColorUtils.BLACK, ColorType.LINE), + cardBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + cardBorder(HColorUtils.BLACK, ColorType.LINE), + agentBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + agentBorder(HColorUtils.MY_RED, ColorType.LINE), + storageBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + storageBorder(HColorUtils.BLACK, ColorType.LINE), + boundaryBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + boundaryBorder(HColorUtils.MY_RED, ColorType.LINE), + collectionsBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + collectionsBorder(HColorUtils.MY_RED, ColorType.LINE), + controlBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + controlBorder(HColorUtils.MY_RED, ColorType.LINE), + entityBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), + entityBorder(HColorUtils.MY_RED, ColorType.LINE), - iconPrivate(HtmlColorUtils.COL_C82930), - iconPrivateBackground(HtmlColorUtils.COL_F24D5C), - iconPackage(HtmlColorUtils.COL_1963A0), - iconPackageBackground(HtmlColorUtils.COL_4177AF), - iconProtected(HtmlColorUtils.COL_B38D22), - iconProtectedBackground(HtmlColorUtils.COL_FFFF44), - iconPublic(HtmlColorUtils.COL_038048), - iconPublicBackground(HtmlColorUtils.COL_84BE84), - iconIEMandatory(HtmlColorUtils.BLACK), + iconPrivate(HColorUtils.COL_C82930), + iconPrivateBackground(HColorUtils.COL_F24D5C), + iconPackage(HColorUtils.COL_1963A0), + iconPackageBackground(HColorUtils.COL_4177AF), + iconProtected(HColorUtils.COL_B38D22), + iconProtectedBackground(HColorUtils.COL_FFFF44), + iconPublic(HColorUtils.COL_038048), + iconPublicBackground(HColorUtils.COL_84BE84), + iconIEMandatory(HColorUtils.BLACK), - arrowLollipop(HtmlColorUtils.WHITE), + arrowLollipop(HColorUtils.WHITE), - machineBackground(HtmlColorUtils.WHITE), - machineBorder(HtmlColorUtils.BLACK, ColorType.LINE), - requirementBackground(HtmlColorUtils.WHITE), - requirementBorder(HtmlColorUtils.BLACK, ColorType.LINE), - designedBackground(HtmlColorUtils.WHITE), - designedBorder(HtmlColorUtils.BLACK, ColorType.LINE), - domainBackground(HtmlColorUtils.WHITE), - domainBorder(HtmlColorUtils.BLACK, ColorType.LINE), - lexicalBackground(HtmlColorUtils.WHITE), - lexicalBorder(HtmlColorUtils.BLACK, ColorType.LINE), - biddableBackground(HtmlColorUtils.WHITE), - biddableBorder(HtmlColorUtils.BLACK, ColorType.LINE); + machineBackground(HColorUtils.WHITE), + machineBorder(HColorUtils.BLACK, ColorType.LINE), + requirementBackground(HColorUtils.WHITE), + requirementBorder(HColorUtils.BLACK, ColorType.LINE), + designedBackground(HColorUtils.WHITE), + designedBorder(HColorUtils.BLACK, ColorType.LINE), + domainBackground(HColorUtils.WHITE), + domainBorder(HColorUtils.BLACK, ColorType.LINE), + lexicalBackground(HColorUtils.WHITE), + lexicalBorder(HColorUtils.BLACK, ColorType.LINE), + biddableBackground(HColorUtils.WHITE), + biddableBorder(HColorUtils.BLACK, ColorType.LINE); private final boolean isBackground; - private final HtmlColor defaultValue; + private final HColor defaultValue; private final ColorType colorType; - private ColorParam(HtmlColor defaultValue, ColorType colorType) { + private ColorParam(HColor defaultValue, ColorType colorType) { this(defaultValue, false, colorType); } - private ColorParam(HtmlColor defaultValue) { + private ColorParam(HColor defaultValue) { this(defaultValue, false, null); } @@ -199,7 +200,7 @@ private ColorParam(boolean isBackground) { this(null, isBackground, null); } - private ColorParam(HtmlColor defaultValue, boolean isBackground, ColorType colorType) { + private ColorParam(HColor defaultValue, boolean isBackground, ColorType colorType) { this.isBackground = isBackground; this.defaultValue = defaultValue; this.colorType = colorType; @@ -213,7 +214,7 @@ protected boolean isBackground() { return isBackground; } - public final HtmlColor getDefaultValue() { + public final HColor getDefaultValue() { return defaultValue; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/bluemodern/ShadowShape.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ComponentStyle.java similarity index 70% rename from src/plantuml-asl/src/net/sourceforge/plantuml/skin/bluemodern/ShadowShape.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/ComponentStyle.java index 020fa5169..6f1c153a3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/bluemodern/ShadowShape.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ComponentStyle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,15 +28,24 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.skin.bluemodern; +package net.sourceforge.plantuml; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; +import net.sourceforge.plantuml.graphic.USymbol; -public class ShadowShape extends FillRoundShape { +public enum ComponentStyle { - public ShadowShape(double width, double height, double corner) { - super(width, height, HtmlColorUtils.LIGHT_GRAY, HtmlColorUtils.GRAY, corner); + UML1, UML2, RECTANGLE; + public USymbol toUSymbol() { + switch (this) { + case UML1: + return USymbol.COMPONENT1; + case UML2: + return USymbol.COMPONENT2; + case RECTANGLE: + return USymbol.RECTANGLE; + } + throw new AssertionError(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/CornerParam.java b/src/plantuml-asl/src/net/sourceforge/plantuml/CornerParam.java index 903bbf12b..6e2e65da9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/CornerParam.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/CornerParam.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/CounterOutputStream.java b/src/plantuml-asl/src/net/sourceforge/plantuml/CounterOutputStream.java index 0e9f5bec8..fdc1c120b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/CounterOutputStream.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/CounterOutputStream.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/DefinitionsContainer.java b/src/plantuml-asl/src/net/sourceforge/plantuml/DefinitionsContainer.java index e49df7ec8..d2be17163 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/DefinitionsContainer.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/DefinitionsContainer.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,7 +36,6 @@ public interface DefinitionsContainer extends PreprocessorModeSet { - public List getDefinition1(String name); - public List getDefinition2(String name); + public List getDefinition(String name); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/Dimension2DDouble.java b/src/plantuml-asl/src/net/sourceforge/plantuml/Dimension2DDouble.java index a58bc0ebd..4279eb9b5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/Dimension2DDouble.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/Dimension2DDouble.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/DirWatcher.java b/src/plantuml-asl/src/net/sourceforge/plantuml/DirWatcher.java index 1eb5c6f0c..f4e54bee8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/DirWatcher.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/DirWatcher.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/DirWatcher2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/DirWatcher2.java index b7df6be61..e3d4c76a2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/DirWatcher2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/DirWatcher2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -87,8 +87,8 @@ public List call() throws Exception { try { final List generatedImages = sourceFileReader .getGeneratedImages(); - final Set files = FileWithSuffix.convert(sourceFileReader - .getIncludedFiles()); + final Set files = FileWithSuffix + .convert(sourceFileReader.getIncludedFiles()); files.add(f); modifieds.put(f, new FileWatcher(files)); return Collections.unmodifiableList(generatedImages); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/Direction.java b/src/plantuml-asl/src/net/sourceforge/plantuml/Direction.java index 24c3875af..9cac9138c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/Direction.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/Direction.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/EmbeddedDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/EmbeddedDiagram.java index 44318b162..932ceea3f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/EmbeddedDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/EmbeddedDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,16 +37,17 @@ import java.io.IOException; import java.util.List; -import javax.imageio.ImageIO; - import net.sourceforge.plantuml.core.Diagram; -import net.sourceforge.plantuml.creole.Atom; +import net.sourceforge.plantuml.creole.atom.Atom; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.Line; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.preproc.Defines; +import net.sourceforge.plantuml.security.ImageIO; +import net.sourceforge.plantuml.ugraphic.AffineTransformType; +import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UImageSvg; @@ -83,7 +84,7 @@ public class Draw extends AbstractTextBlock implements Line, Atom { public List splitInTwo(StringBounder stringBounder, double width) { throw new UnsupportedOperationException(getClass().toString()); } - + private Draw(ISkinSimple skinParam) { this.skinParam = skinParam; } @@ -114,7 +115,7 @@ public void drawU(UGraphic ug) { return; } final BufferedImage im = getImage(); - final UShape image = new UImage(im); + final UShape image = new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR)); ug.draw(image); } catch (IOException e) { e.printStackTrace(); @@ -134,7 +135,9 @@ private String getImageSvg() throws IOException, InterruptedException { private BufferedImage getImage() throws IOException, InterruptedException { if (image == null) { + final boolean sav = SkinParam.USE_STYLES(); image = getImageSlow(); + SkinParam.setBetaStyle(sav); } return image; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/EmptyImageBuilder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/EmptyImageBuilder.java index d043ef05b..0e8af9267 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/EmptyImageBuilder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/EmptyImageBuilder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,13 +31,18 @@ package net.sourceforge.plantuml; import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.List; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.UAntiAliasing; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d; public class EmptyImageBuilder { @@ -45,11 +50,11 @@ public class EmptyImageBuilder { private final BufferedImage im; private final Graphics2D g2d; - public EmptyImageBuilder(double width, double height, Color background) { - this((int) width, (int) height, background); + public EmptyImageBuilder(String watermark, double width, double height, Color background) { + this(watermark, (int) width, (int) height, background); } - public EmptyImageBuilder(int width, int height, Color background) { + public EmptyImageBuilder(String watermark, int width, int height, Color background) { if (width > GraphvizUtils.getenvImageLimit()) { Log.info("Width too large " + width + ". You should set PLANTUML_LIMIT_SIZE"); width = GraphvizUtils.getenvImageLimit(); @@ -59,18 +64,84 @@ public EmptyImageBuilder(int width, int height, Color background) { height = GraphvizUtils.getenvImageLimit(); } Log.info("Creating image " + width + "x" + height); - im = new BufferedImage(width, height, background == null ? BufferedImage.TYPE_INT_ARGB - : BufferedImage.TYPE_INT_RGB); + im = new BufferedImage(width, height, getType(background)); g2d = im.createGraphics(); UAntiAliasing.ANTI_ALIASING_ON.apply(g2d); if (background != null) { g2d.setColor(background); g2d.fillRect(0, 0, width, height); } + if (watermark != null) { + final int gray = 200; + g2d.setColor(new Color(gray, gray, gray)); + printWatermark(watermark, width, height); + } + } + + private int getType(Color background) { + if (background == null) { + return BufferedImage.TYPE_INT_ARGB; + } + if (background.getAlpha() != 255) { + return BufferedImage.TYPE_INT_ARGB; + } + return BufferedImage.TYPE_INT_RGB; + } + + private void printWatermark(String watermark, int maxWidth, int maxHeight) { + final Font javaFont = g2d.getFont(); + final FontMetrics fm = g2d.getFontMetrics(javaFont); + final Rectangle2D rect = fm.getStringBounds(watermark, g2d); + final int height = (int) rect.getHeight(); + final int width = (int) rect.getWidth(); + if (height < 2 || width < 2) { + return; + } + if (width <= maxWidth) + for (int y = height; y < maxHeight; y += height + 1) { + for (int x = 0; x < maxWidth; x += width + 10) { + g2d.drawString(watermark, x, y); + } + } + else { + final List withBreaks = withBreaks(watermark, javaFont, fm, maxWidth); + int y = 0; + while (y < maxHeight) { + for (String s : withBreaks) { + g2d.drawString(s, 0, y); + y += (int) fm.getStringBounds(s, g2d).getHeight(); + } + y += 10; + } + } + } + + private int getWidth(String line, Font javaFont, FontMetrics fm) { + final Rectangle2D rect = fm.getStringBounds(line, g2d); + return (int) rect.getWidth(); + } + + private List withBreaks(String watermark, Font javaFont, FontMetrics fm, int maxWidth) { + final String[] words = watermark.split("\\s+"); + final List result = new ArrayList(); + String pending = ""; + for (String word : words) { + final String candidate = pending.length() == 0 ? word : pending + " " + word; + if (getWidth(candidate, javaFont, fm) < maxWidth) { + pending = candidate; + } else { + result.add(pending); + pending = word; + } + } + if (pending.length() > 0) { + result.add(pending); + } + return result; } - public EmptyImageBuilder(int width, int height, Color background, double dpiFactor) { - this(width * dpiFactor, height * dpiFactor, background); + public EmptyImageBuilder(String watermark, int width, int height, Color background, double dpiFactor) { + this(watermark, width * dpiFactor, height * dpiFactor, background); if (dpiFactor != 1.0) { g2d.setTransform(AffineTransform.getScaleInstance(dpiFactor, dpiFactor)); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/EnsureVisible.java b/src/plantuml-asl/src/net/sourceforge/plantuml/EnsureVisible.java index 63734dd1f..cfdc4fa99 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/EnsureVisible.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/EnsureVisible.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ErrorStatus.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ErrorStatus.java index 8686de3a7..c890ebe6b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ErrorStatus.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ErrorStatus.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ErrorUml.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ErrorUml.java index 7cf350348..c802511d5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ErrorUml.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ErrorUml.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ErrorUmlType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ErrorUmlType.java index ea4870cfe..c44bc5871 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ErrorUmlType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ErrorUmlType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/FileFormat.java b/src/plantuml-asl/src/net/sourceforge/plantuml/FileFormat.java index e85df914c..65879129a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/FileFormat.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/FileFormat.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,14 +33,18 @@ import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics2D; +import java.awt.RenderingHints; import java.awt.geom.Dimension2D; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; -import java.io.File; +import java.io.IOException; import net.sourceforge.plantuml.braille.BrailleCharFactory; import net.sourceforge.plantuml.braille.UGraphicBraille; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.png.MetadataTag; +import net.sourceforge.plantuml.security.SFile; +import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.ugraphic.UFont; /** @@ -50,7 +54,8 @@ * */ public enum FileFormat { - PNG, SVG, EPS, EPS_TEXT, ATXT, UTXT, XMI_STANDARD, XMI_STAR, XMI_ARGO, SCXML, PDF, MJPEG, ANIMATED_GIF, HTML, HTML5, VDX, LATEX, LATEX_NO_PREAMBLE, BASE64, BRAILLE_PNG, PREPROC; + PNG, SVG, EPS, EPS_TEXT, ATXT, UTXT, XMI_STANDARD, XMI_STAR, XMI_ARGO, SCXML, PDF, MJPEG, ANIMATED_GIF, HTML, HTML5, + VDX, LATEX, LATEX_NO_PREAMBLE, BASE64, BRAILLE_PNG, PREPROC; /** * Returns the file format to be used for that format. @@ -80,7 +85,11 @@ public String getFileSuffix() { } final static private BufferedImage imDummy = new BufferedImage(800, 100, BufferedImage.TYPE_INT_RGB); - final static private Graphics2D gg = imDummy.createGraphics(); + final static public Graphics2D gg = imDummy.createGraphics(); + static { + // KEY_FRACTIONALMETRICS + gg.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + } public StringBounder getDefaultStringBounder(TikzFontDistortion tikzFontDistortion) { if (this == LATEX || this == LATEX_NO_PREAMBLE) { @@ -170,16 +179,16 @@ public String changeName(String fileName, int cpt) { if (cpt == 0) { return changeName(fileName, getFileSuffix()); } - return changeName(fileName, OptionFlags.getInstance().getFileSeparator() + String.format("%03d", cpt) - + getFileSuffix()); + return changeName(fileName, + OptionFlags.getInstance().getFileSeparator() + String.format("%03d", cpt) + getFileSuffix()); } - private File computeFilename(File pngFile, int i) { + private SFile computeFilename(SFile pngFile, int i) { if (i == 0) { return pngFile; } - final File dir = pngFile.getParentFile(); - return new File(dir, computeFilenameInternal(pngFile.getName(), i)); + final SFile dir = pngFile.getParentFile(); + return dir.file(computeFilenameInternal(pngFile.getName(), i)); } private String changeName(String fileName, String replacement) { @@ -197,4 +206,36 @@ private String computeFilenameInternal(String name, int i) { return name.replaceAll("\\" + getFileSuffix() + "$", OptionFlags.getInstance().getFileSeparator() + String.format("%03d", i) + getFileSuffix()); } + + public boolean doesSupportMetadata() { + return this == PNG || this == SVG; + } + + public boolean equalsMetadata(String currentMetadata, SFile existingFile) { + try { + if (this == PNG) { + final MetadataTag tag = new MetadataTag(existingFile, "plantuml"); + final String previousMetadata = tag.getData(); + final boolean sameMetadata = currentMetadata.equals(previousMetadata); + return sameMetadata; + } + if (this == SVG) { + final String svg = FileUtils.readSvg(existingFile); + if (svg == null) { + return false; + } + final String currentSignature = SvgGraphics.getMD5Hex(currentMetadata); + final int idx = svg.lastIndexOf(SvgGraphics.MD5_HEADER); + if (idx != -1) { + final String part = svg.substring(idx + SvgGraphics.MD5_HEADER.length()); + return part.startsWith(currentSignature); + } + + } + } catch (IOException e) { + e.printStackTrace(); + } + return false; + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/FileFormatOption.java b/src/plantuml-asl/src/net/sourceforge/plantuml/FileFormatOption.java index 4c82753ac..4887d657f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/FileFormatOption.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/FileFormatOption.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -52,35 +52,27 @@ public final class FileFormatOption implements Serializable { private final String hoverColor; private final TikzFontDistortion tikzFontDistortion; private final double scale; + private final String preserveAspectRatio; + private final String watermark; public double getScaleCoef() { return scale; } public FileFormatOption(FileFormat fileFormat) { - this(fileFormat, null, true, false, "_top", false, null, TikzFontDistortion.getDefault(), 1.0); - } - - public StringBounder getDefaultStringBounder() { - return fileFormat.getDefaultStringBounder(tikzFontDistortion); - } - - public String getSvgLinkTarget() { - return svgLinkTarget; - } - - public final boolean isWithMetadata() { - return withMetadata; + this(fileFormat, null, true, false, "_top", false, null, TikzFontDistortion.getDefault(), 1.0, "none", null); } public FileFormatOption(FileFormat fileFormat, boolean withMetadata) { - this(fileFormat, null, false, false, "_top", false, null, TikzFontDistortion.getDefault(), 1.0); + this(fileFormat, null, withMetadata, false, "_top", false, null, TikzFontDistortion.getDefault(), 1.0, "none", + null); } private FileFormatOption(FileFormat fileFormat, AffineTransform at, boolean withMetadata, boolean useRedForError, String svgLinkTarget, boolean debugsvek, String hoverColor, TikzFontDistortion tikzFontDistortion, - double scale) { + double scale, String preserveAspectRatio, String watermark) { this.hoverColor = hoverColor; + this.watermark = watermark; this.fileFormat = fileFormat; this.affineTransform = at; this.withMetadata = withMetadata; @@ -89,34 +81,61 @@ private FileFormatOption(FileFormat fileFormat, AffineTransform at, boolean with this.debugsvek = debugsvek; this.tikzFontDistortion = tikzFontDistortion; this.scale = scale; + this.preserveAspectRatio = preserveAspectRatio; if (tikzFontDistortion == null) { throw new IllegalArgumentException(); } } + public StringBounder getDefaultStringBounder() { + return fileFormat.getDefaultStringBounder(tikzFontDistortion); + } + + public String getSvgLinkTarget() { + return svgLinkTarget; + } + + public final boolean isWithMetadata() { + return withMetadata; + } + + public final String getPreserveAspectRatio() { + return preserveAspectRatio; + } + public FileFormatOption withUseRedForError() { return new FileFormatOption(fileFormat, affineTransform, withMetadata, true, svgLinkTarget, debugsvek, - hoverColor, tikzFontDistortion, scale); + hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); } public FileFormatOption withTikzFontDistortion(TikzFontDistortion tikzFontDistortion) { return new FileFormatOption(fileFormat, affineTransform, withMetadata, true, svgLinkTarget, debugsvek, - hoverColor, tikzFontDistortion, scale); + hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); } public FileFormatOption withSvgLinkTarget(String svgLinkTarget) { - return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, svgLinkTarget, - debugsvek, hoverColor, tikzFontDistortion, scale); + return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, svgLinkTarget, debugsvek, + hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); + } + + public FileFormatOption withPreserveAspectRatio(String preserveAspectRatio) { + return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, svgLinkTarget, debugsvek, + hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); } public FileFormatOption withHoverColor(String hoverColor) { - return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, svgLinkTarget, - debugsvek, hoverColor, tikzFontDistortion, scale); + return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, svgLinkTarget, debugsvek, + hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); } public FileFormatOption withScale(double scale) { - return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, svgLinkTarget, - debugsvek, hoverColor, tikzFontDistortion, scale); + return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, svgLinkTarget, debugsvek, + hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); + } + + public FileFormatOption withWartermark(String watermark) { + return new FileFormatOption(fileFormat, affineTransform, withMetadata, useRedForError, svgLinkTarget, debugsvek, + hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); } @Override @@ -158,4 +177,8 @@ public final TikzFontDistortion getTikzFontDistortion() { return tikzFontDistortion; } + public final String getWatermark() { + return watermark; + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/FileGroup.java b/src/plantuml-asl/src/net/sourceforge/plantuml/FileGroup.java index 44dd83d85..e1d4b2059 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/FileGroup.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/FileGroup.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/FileImageData.java b/src/plantuml-asl/src/net/sourceforge/plantuml/FileImageData.java index 6c2aeb7ca..45c9d8309 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/FileImageData.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/FileImageData.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,24 +30,23 @@ */ package net.sourceforge.plantuml; -import java.io.File; - import net.sourceforge.plantuml.core.ImageData; +import net.sourceforge.plantuml.security.SFile; public class FileImageData { public static final int ERROR = 400; public static final int CRASH = 503; - private final File file; + private final SFile file; private final ImageData imageData; - public FileImageData(File file, ImageData imageData) { + public FileImageData(SFile file, ImageData imageData) { this.file = file; this.imageData = imageData; } - public File getFile() { + public SFile getFile() { return file; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/FileSystem.java b/src/plantuml-asl/src/net/sourceforge/plantuml/FileSystem.java index 1fbf8ec6a..e1d796438 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/FileSystem.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/FileSystem.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,17 +30,16 @@ */ package net.sourceforge.plantuml; -import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; + +import net.sourceforge.plantuml.security.SFile; +import net.sourceforge.plantuml.security.SecurityUtils; public class FileSystem { private final static FileSystem singleton = new FileSystem(); - private final ThreadLocal currentDir = new ThreadLocal(); + private final ThreadLocal currentDir = new ThreadLocal(); private FileSystem() { reset(); @@ -50,70 +49,63 @@ public static FileSystem getInstance() { return singleton; } - public void setCurrentDir(File dir) { + public void setCurrentDir(SFile dir) { // if (dir == null) { // throw new IllegalArgumentException(); // } - Log.info("Setting current dir: " + dir); + if (dir != null) { + Log.info("Setting current dir: " + dir.getAbsolutePath()); + } this.currentDir.set(dir); } - public File getCurrentDir() { + public SFile getCurrentDir() { return this.currentDir.get(); } - public File getFile(String nameOrPath) throws IOException { - final File dir = currentDir.get(); - if (dir == null || isAbsolute(nameOrPath)) { - return new File(nameOrPath).getCanonicalFile(); - } - final File filecurrent = new File(dir.getAbsoluteFile(), nameOrPath); - if (filecurrent.exists()) { - return filecurrent.getCanonicalFile(); + public SFile getFile(String nameOrPath) throws IOException { + if (isAbsolute(nameOrPath)) { + return new SFile(nameOrPath).getCanonicalFile(); } - for (File d : getPath("plantuml.include.path", true)) { - if (d.isDirectory()) { - final File file = new File(d, nameOrPath); - if (file.exists()) { - return file.getCanonicalFile(); - } - } - } - for (File d : getPath("java.class.path", true)) { - if (d.isDirectory()) { - final File file = new File(d, nameOrPath); - if (file.exists()) { - return file.getCanonicalFile(); - } + final SFile dir = currentDir.get(); + SFile filecurrent = null; + if (dir != null) { + filecurrent = dir.getAbsoluteFile().file(nameOrPath); + if (filecurrent.exists()) { + return filecurrent.getCanonicalFile(); + } } - return filecurrent; - } + for (SFile d : SecurityUtils.getPath("plantuml.include.path")) { + assert d.isDirectory(); + final SFile file = d.file(nameOrPath); + if (file.exists()) { + return file.getCanonicalFile(); - public static List getPath(String prop, boolean onlyDir) { - final List result = new ArrayList(); - String paths = System.getProperty(prop); - if (paths == null) { - return result; + } } - paths = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(paths); - final StringTokenizer st = new StringTokenizer(paths, System.getProperty("path.separator")); - while (st.hasMoreTokens()) { - final File f = new File(st.nextToken()); - if (f.exists() && (onlyDir == false || f.isDirectory())) { - result.add(f); + for (SFile d : SecurityUtils.getPath("java.class.path")) { + assert d.isDirectory(); + final SFile file = d.file(nameOrPath); + if (file.exists()) { + return file.getCanonicalFile(); } } - return result; + if (dir == null) { + assert filecurrent == null; + return new SFile(nameOrPath).getCanonicalFile(); + } + assert filecurrent != null; + return filecurrent; } private boolean isAbsolute(String nameOrPath) { - final File f = new File(nameOrPath); + final SFile f = new SFile(nameOrPath); return f.isAbsolute(); } public void reset() { - setCurrentDir(new File(".")); + setCurrentDir(new SFile(".")); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/FileUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/FileUtils.java index 71aab3789..ee9bf1e11 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/FileUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/FileUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,23 +30,19 @@ */ package net.sourceforge.plantuml; -import java.awt.Image; -import java.awt.image.BufferedImage; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.FileReader; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; -import java.net.URL; import java.util.concurrent.atomic.AtomicInteger; -import javax.swing.ImageIcon; +import net.sourceforge.plantuml.security.SFile; // Used by the Eclipse Plugin, so do not change package location. public class FileUtils { @@ -57,7 +53,7 @@ public static void resetCounter() { counter = new AtomicInteger(0); } - static public File createTempFile(String prefix, String suffix) throws IOException { + static public File createTempFileLegacy(String prefix, String suffix) throws IOException { if (suffix.startsWith(".") == false) { throw new IllegalArgumentException(); } @@ -76,6 +72,25 @@ static public File createTempFile(String prefix, String suffix) throws IOExcepti return f; } + static public SFile createTempFile(String prefix, String suffix) throws IOException { + if (suffix.startsWith(".") == false) { + throw new IllegalArgumentException(); + } + if (prefix == null) { + throw new IllegalArgumentException(); + } + final SFile f; + if (counter == null) { + f = SFile.createTempFile(prefix, suffix); + } else { + final String name = prefix + counter.addAndGet(1) + suffix; + f = new SFile(name); + } + Log.info("Creating temporary file: " + f); + f.deleteOnExit(); + return f; + } + private static void copyInternal(final InputStream fis, final OutputStream fos) throws IOException { final byte[] buf = new byte[10240]; int len; @@ -86,12 +101,24 @@ private static void copyInternal(final InputStream fis, final OutputStream fos) fis.close(); } - static public void copyToFile(File src, File dest) throws IOException { + static public void copyToFile(SFile src, SFile dest) throws IOException { if (dest.isDirectory()) { - dest = new File(dest, src.getName()); + dest = dest.file(src.getName()); } - final InputStream fis = new BufferedInputStream(new FileInputStream(src)); - final OutputStream fos = new BufferedOutputStream(new FileOutputStream(dest)); + final InputStream fis = src.openFile(); + if (fis == null) { + throw new FileNotFoundException(); + } + final OutputStream fos = dest.createBufferedOutputStream(); + copyInternal(fis, fos); + } + + static public void copyToStream(SFile src, OutputStream os) throws IOException { + final InputStream fis = src.openFile(); + if (fis == null) { + throw new FileNotFoundException(); + } + final OutputStream fos = new BufferedOutputStream(os); copyInternal(fis, fos); } @@ -107,14 +134,17 @@ static public void copyToStream(InputStream is, OutputStream os) throws IOExcept copyInternal(fis, fos); } - static public void copyToFile(byte[] src, File dest) throws IOException { - final OutputStream fos = new BufferedOutputStream(new FileOutputStream(dest)); + static public void copyToFile(byte[] src, SFile dest) throws IOException { + final OutputStream fos = dest.createBufferedOutputStream(); fos.write(src); fos.close(); } - static public String readSvg(File svgFile) throws IOException { - final BufferedReader br = new BufferedReader(new FileReader(svgFile)); + static public String readSvg(SFile svgFile) throws IOException { + final BufferedReader br = svgFile.openBufferedReader(); + if (br == null) { + return null; + } return readSvg(br, false, true); } @@ -123,12 +153,15 @@ static public String readSvg(InputStream is) throws IOException { return readSvg(br, false, false); } - static public String readFile(File svgFile) throws IOException { - final BufferedReader br = new BufferedReader(new FileReader(svgFile)); + static public String readFile(SFile svgFile) throws IOException { + final BufferedReader br = svgFile.openBufferedReader(); + if (br == null) { + return null; + } return readSvg(br, true, true); } - private static String readSvg(final BufferedReader br, boolean withNewline, boolean withClose) throws IOException { + private static String readSvg(BufferedReader br, boolean withNewline, boolean withClose) throws IOException { final StringBuilder sb = new StringBuilder(); String s; while ((s = br.readLine()) != null) { @@ -143,38 +176,4 @@ private static String readSvg(final BufferedReader br, boolean withNewline, bool return sb.toString(); } - // public static BufferedImage ImageIO_read(File f) throws IOException { - // return ImageIO.read(f); - // } - - // http://forum.plantuml.net/9048/img-tag-for-sequence-diagram-participants-does-always-render - - public synchronized static BufferedImage ImageIO_read(File f) { - // https://www.experts-exchange.com/questions/26171948/Why-are-ImageIO-read-images-losing-their-transparency.html - // https://stackoverflow.com/questions/18743790/can-java-load-images-with-transparency - - try { - return readImage(new ImageIcon(f.getAbsolutePath())); - } catch (Exception e) { - return null; - } - } - - public synchronized static BufferedImage ImageIO_read(URL url) { - try { - return readImage(new ImageIcon(url)); - } catch (Exception e) { - return null; - } - } - - private synchronized static BufferedImage readImage(final ImageIcon imageIcon) { - final Image tmpImage = imageIcon.getImage(); - final BufferedImage image = new BufferedImage(imageIcon.getIconWidth(), imageIcon.getIconHeight(), - BufferedImage.TYPE_INT_ARGB); - image.getGraphics().drawImage(tmpImage, 0, 0, null); - tmpImage.flush(); - return image; - } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/FileWatcher.java b/src/plantuml-asl/src/net/sourceforge/plantuml/FileWatcher.java index d95d7c296..5b6ffe1b1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/FileWatcher.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/FileWatcher.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/FontParam.java b/src/plantuml-asl/src/net/sourceforge/plantuml/FontParam.java index 30df4a6c7..c60bae497 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/FontParam.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/FontParam.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,7 +34,7 @@ import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.style.SName; -import net.sourceforge.plantuml.style.StyleDefinition; +import net.sourceforge.plantuml.style.StyleSignature; interface FontParamConstant { String FAMILY = "SansSerif"; @@ -89,11 +89,11 @@ public enum FontParam { SEQUENCE_GROUP_HEADER(13, Font.BOLD), // PARTICIPANT(14, Font.PLAIN), // PARTICIPANT_STEREOTYPE(14, Font.ITALIC), // - SEQUENCE_TITLE(14, Font.BOLD), // STATE(14, Font.PLAIN), // STATE_ATTRIBUTE(12, Font.PLAIN), // LEGEND(14, Font.PLAIN), // TITLE(18, Font.PLAIN), // + // SEQUENCE_TITLE(14, Font.BOLD), // CAPTION(14, Font.PLAIN), // SWIMLANE_TITLE(18, Font.PLAIN), // FOOTER(10, Font.PLAIN, "#888888", FontParamConstant.FAMILY), // @@ -176,18 +176,25 @@ public FontConfiguration getFontConfiguration(ISkinParam skinParam) { return new FontConfiguration(skinParam, this, null); } - public StyleDefinition getStyleDefinition() { + public StyleSignature getStyleDefinition(SName diagramType) { if (this == FOOTER) { - return StyleDefinition.of(SName.root, SName.footer); + return StyleSignature.of(SName.root, SName.footer); } if (this == HEADER) { - return StyleDefinition.of(SName.root, SName.header); + return StyleSignature.of(SName.root, SName.header); } if (this == TITLE) { - return StyleDefinition.of(SName.root, SName.title); + return StyleSignature.of(SName.root, SName.title); } - System.err.println("Warning " + this); - return null; + if (this == CLASS_ATTRIBUTE) { + return StyleSignature.of(SName.root, SName.element, SName.classDiagram, SName.class_); + } + if (this == RECTANGLE || this == NODE) { + return StyleSignature.of(SName.root, SName.element, SName.componentDiagram, SName.component); + } + return StyleSignature.of(SName.root, SName.element, diagramType, SName.component); +// System.err.println("Warning " + this); +// throw new UnsupportedOperationException(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/GeneratedImage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/GeneratedImage.java index 20b5b1163..cc428d53f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/GeneratedImage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/GeneratedImage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/GeneratedImageImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/GeneratedImageImpl.java index af90ca001..344a17535 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/GeneratedImageImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/GeneratedImageImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,13 +31,15 @@ package net.sourceforge.plantuml; import java.io.File; +import java.io.IOException; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.error.PSystemError; +import net.sourceforge.plantuml.security.SFile; public class GeneratedImageImpl implements GeneratedImage { - private final File pngFile; + private final SFile pngFile; private final String description; private final BlockUml blockUml; private final int status; @@ -46,7 +48,7 @@ public final int getStatus() { return status; } - public GeneratedImageImpl(File pngFile, String description, BlockUml blockUml, int status) { + public GeneratedImageImpl(SFile pngFile, String description, BlockUml blockUml, int status) { this.blockUml = blockUml; this.pngFile = pngFile; this.description = description; @@ -54,7 +56,7 @@ public GeneratedImageImpl(File pngFile, String description, BlockUml blockUml, i } public File getPngFile() { - return pngFile; + return pngFile.internal; } public String getDescription() { @@ -71,13 +73,17 @@ public int lineErrorRaw() { @Override public String toString() { - return pngFile.getAbsolutePath() + " " + description; + return pngFile.getPrintablePath() + " " + description; } public int compareTo(GeneratedImage this2) { - final int cmp = this.pngFile.compareTo(this2.getPngFile()); - if (cmp != 0) { - return cmp; + try { + final int cmp = this.getPngFile().getCanonicalPath().compareTo(this2.getPngFile().getCanonicalPath()); + if (cmp != 0) { + return cmp; + } + } catch (IOException e) { + e.printStackTrace(); } return this.description.compareTo(this2.getDescription()); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/Guillemet.java b/src/plantuml-asl/src/net/sourceforge/plantuml/Guillemet.java index 1fbe65501..ce1c13483 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/Guillemet.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/Guillemet.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/Hideable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/Hideable.java index 75e5dbb05..a8afde1f8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/Hideable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/Hideable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ISkinParam.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ISkinParam.java index c167b48ac..2daf6ebc7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ISkinParam.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ISkinParam.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,13 +30,15 @@ */ package net.sourceforge.plantuml; +import java.util.Collection; + import net.sourceforge.plantuml.cucadiagram.Rankdir; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.DotSplines; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.skin.ActorStyle; import net.sourceforge.plantuml.skin.ArrowDirection; import net.sourceforge.plantuml.skin.Padder; import net.sourceforge.plantuml.style.Style; @@ -46,22 +48,23 @@ import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public interface ISkinParam extends ISkinSimple { public static final int SWIMLANE_WIDTH_SAME = -1; - public HtmlColor getHyperlinkColor(); + public HColor getHyperlinkColor(); public boolean useUnderlineForHyperlink(); - public HtmlColor getBackgroundColor(); + public HColor getBackgroundColor(boolean replaceTransparentByWhite); - public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable); + public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable); public Colors getColors(ColorParam param, Stereotype stereotype); - public HtmlColor getFontHtmlColor(Stereotype stereotype, FontParam... param); + public HColor getFontHtmlColor(Stereotype stereotype, FontParam... param); public UStroke getThickness(LineParam param, Stereotype stereotype); @@ -88,9 +91,9 @@ public HorizontalAlignment getHorizontalAlignment(AlignmentParam param, ArrowDir public boolean shadowing2(Stereotype stereotype, SkinParameter skinParameter); - public PackageStyle getPackageStyle(); + public PackageStyle packageStyle(); - public boolean useUml2ForComponent(); + public ComponentStyle componentStyle(); public boolean stereotypePositionTop(); @@ -134,6 +137,8 @@ public HorizontalAlignment getHorizontalAlignment(AlignmentParam param, ArrowDir public String getSvgLinkTarget(); + public String getPreserveAspectRatio(); + public int getTabSize(); public int maxAsciiMessageLength(); @@ -146,7 +151,7 @@ public HorizontalAlignment getHorizontalAlignment(AlignmentParam param, ArrowDir public UmlDiagramType getUmlDiagramType(); - public HtmlColor getHoverPathColor(); + public HColor hoverPathColor(); public TikzFontDistortion getTikzFontDistortion(); @@ -166,10 +171,18 @@ public HorizontalAlignment getHorizontalAlignment(AlignmentParam param, ArrowDir public boolean isUseVizJs(); - public Padder getSequenceDiagramPadder(); + public Padder sequenceDiagramPadder(); public StyleBuilder getCurrentStyleBuilder(); public void muteStyle(Style modifiedStyle); + public Collection getAllSpriteNames(); + + public String getDefaultSkin(); + + public void setDefaultSkin(String newSkin); + + public ActorStyle actorStyle(); + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ISkinSimple.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ISkinSimple.java index c7d98663a..64157c7a0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ISkinSimple.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ISkinSimple.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,8 +32,8 @@ import java.util.Map; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; -import net.sourceforge.plantuml.ugraphic.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public interface ISkinSimple extends SpriteContainer { @@ -47,7 +47,7 @@ public interface ISkinSimple extends SpriteContainer { public int getTabSize(); - public IHtmlColorSet getIHtmlColorSet(); + public HColorSet getIHtmlColorSet(); public int getDpi(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ISourceFileReader.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ISourceFileReader.java index 72218f067..9c5ea9fd0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ISourceFileReader.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ISourceFileReader.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ImageSelection.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ImageSelection.java index dc13f33d2..4942da528 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ImageSelection.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ImageSelection.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/LineBreakStrategy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/LineBreakStrategy.java index d2bf1c29d..f7a83fc20 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/LineBreakStrategy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/LineBreakStrategy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,6 +39,11 @@ public class LineBreakStrategy { public LineBreakStrategy(String value) { this.value = value; } + + @Override + public String toString() { + return value; + } public boolean isAuto() { return "auto".equalsIgnoreCase(value); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/LineConfigurable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/LineConfigurable.java index c7f7677c7..198b7605c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/LineConfigurable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/LineConfigurable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,15 +30,15 @@ */ package net.sourceforge.plantuml; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.ugraphic.color.HColor; public interface LineConfigurable { public Colors getColors(ISkinParam skinParam); - public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color); + public void setSpecificColorTOBEREMOVED(ColorType type, HColor color); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/LineLocation.java b/src/plantuml-asl/src/net/sourceforge/plantuml/LineLocation.java index 0f23540d0..ea663c2e9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/LineLocation.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/LineLocation.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/LineLocationImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/LineLocationImpl.java index b0c7e29ee..b4962309d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/LineLocationImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/LineLocationImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/LineParam.java b/src/plantuml-asl/src/net/sourceforge/plantuml/LineParam.java index 757588c84..bfd96ca86 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/LineParam.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/LineParam.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -53,6 +53,7 @@ public enum LineParam { archimateBorder, componentBorder, cardBorder, + queueBorder, agentBorder, domainBorder, designedDomainBorder, machineBorder, requirementBorder; // sequenceBoxBorder(0.1); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/Log.java b/src/plantuml-asl/src/net/sourceforge/plantuml/Log.java index 4704d3e2c..96487bf73 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/Log.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/Log.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -92,16 +92,16 @@ private static String format(String s) { } public static void println(Object s) { - if (header2.get() == null) { - System.err.println("L = " + s); - } else { - System.err.println(header2.get() + " " + s); - } + // if (header2.get() == null) { + // System.err.println("L = " + s); + // } else { + // System.err.println(header2.get() + " " + s); + // } } - private static final ThreadLocal header2 = new ThreadLocal(); - + // private static final ThreadLocal header2 = new ThreadLocal(); + // public static void header(String s) { - header2.set(s); + // header2.set(s); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/NamedOutputStream.java b/src/plantuml-asl/src/net/sourceforge/plantuml/NamedOutputStream.java index 407f0a6f8..80cf27cd1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/NamedOutputStream.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/NamedOutputStream.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,20 +30,19 @@ */ package net.sourceforge.plantuml; -import java.io.BufferedOutputStream; -import java.io.File; import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; +import net.sourceforge.plantuml.security.SFile; + public class NamedOutputStream extends OutputStream { private final OutputStream os; private final BaseFile basefile; - public NamedOutputStream(File file) throws FileNotFoundException { - this.os = new BufferedOutputStream(new FileOutputStream(file)); + public NamedOutputStream(SFile file) throws FileNotFoundException { + this.os = file.createBufferedOutputStream(); this.basefile = new BaseFile(file); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/NewpagedDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/NewpagedDiagram.java index a97888b07..bbb149049 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/NewpagedDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/NewpagedDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/NullOutputStream.java b/src/plantuml-asl/src/net/sourceforge/plantuml/NullOutputStream.java index 909a365d4..370f01e75 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/NullOutputStream.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/NullOutputStream.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/Option.java b/src/plantuml-asl/src/net/sourceforge/plantuml/Option.java index ae76c4ec1..373c12ad2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/Option.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/Option.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -47,6 +47,7 @@ import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; import net.sourceforge.plantuml.preproc.Defines; +import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.stats.StatsUtils; public class Option { @@ -262,8 +263,8 @@ public Option(String... arg) throws InterruptedException, IOException { if (i == arg.length) { continue; } - OptionFlags.getInstance().setLogData( - new File(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg[i]))); + OptionFlags.getInstance() + .setLogData(new SFile(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg[i]))); } else if (s.equalsIgnoreCase("-word")) { OptionFlags.getInstance().setWord(true); OptionFlags.getInstance().setQuiet(true); @@ -276,8 +277,6 @@ public Option(String... arg) throws InterruptedException, IOException { OptionPrint.printVersion(); } else if (s.matches("(?i)^-li[sc][ea]n[sc]e\\s*$")) { OptionPrint.printLicense(); - } else if (s.equalsIgnoreCase("-checkversion")) { - OptionPrint.checkVersion(); } else if (s.startsWith("-DPLANTUML_LIMIT_SIZE=")) { final String v = s.substring("-DPLANTUML_LIMIT_SIZE=".length()); if (v.matches("\\d+")) { @@ -289,7 +288,8 @@ public Option(String... arg) throws InterruptedException, IOException { manageSkinParam(s.substring(2)); } else if (s.equalsIgnoreCase("-testdot")) { OptionPrint.printTestDot(); - } else if (s.equalsIgnoreCase("-about") || s.equalsIgnoreCase("-author") || s.equalsIgnoreCase("-authors")) { + } else if (s.equalsIgnoreCase("-about") || s.equalsIgnoreCase("-author") + || s.equalsIgnoreCase("-authors")) { OptionPrint.printAbout(); } else if (s.equalsIgnoreCase("-help") || s.equalsIgnoreCase("-h") || s.equalsIgnoreCase("-?")) { OptionPrint.printHelp(); @@ -385,23 +385,23 @@ public int getFtpPort() { return ftpPort; } - private void addInConfig(final FileReader source) throws IOException { - BufferedReader br = null; + private void addInConfig(BufferedReader br) throws IOException { + if (br == null) { + return; + } try { - br = new BufferedReader(source); String s = null; while ((s = br.readLine()) != null) { config.add(s); } } finally { - if (br != null) { - br.close(); - } + br.close(); } } public void initConfig(String filename) throws IOException { - addInConfig(new FileReader(filename)); + final BufferedReader br = new BufferedReader(new FileReader(filename)); + addInConfig(br); } private void initInclude(String filename) throws IOException { @@ -409,16 +409,16 @@ private void initInclude(String filename) throws IOException { return; } if (filename.contains("*")) { - final FileGroup group = new FileGroup(filename, Collections. emptyList(), null); + final FileGroup group = new FileGroup(filename, Collections.emptyList(), null); for (File f : group.getFiles()) { if (f.exists() && f.canRead()) { - addInConfig(new FileReader(f)); + addInConfig(new BufferedReader(new FileReader(f))); } } } else { final File f = new File(filename); if (f.exists() && f.canRead()) { - addInConfig(new FileReader(f)); + addInConfig(new BufferedReader(new FileReader(f))); } } } @@ -451,7 +451,7 @@ public final File getOutputDir() { } public final static String getPattern() { - return "(?i)^.*\\.(txt|tex|java|htm|html|c|h|cpp|apt|pu|pump|hpp|hh)$"; + return "(?i)^.*\\.(txt|tex|java|htm|html|c|h|cpp|apt|pu|puml|hpp|hh)$"; } public void setOutputDir(File f) { @@ -462,10 +462,26 @@ public final List getExcludes() { return Collections.unmodifiableList(excludes); } - public Defines getDefaultDefines(File f) { + public Defines getDefaultDefines(SFile f) { final Defines result = Defines.createWithFileName(f); for (Map.Entry ent : defines.entrySet()) { - result.define(ent.getKey(), Arrays.asList(ent.getValue()), false, null); + String value = ent.getValue(); + if (value == null) { + value = ""; + } + result.define(ent.getKey(), Arrays.asList(value), false, null); + } + return result; + } + + public Defines getDefaultDefines(java.io.File f) { + final Defines result = Defines.createWithFileName(f); + for (Map.Entry ent : defines.entrySet()) { + String value = ent.getValue(); + if (value == null) { + value = ""; + } + result.define(ent.getKey(), Arrays.asList(value), false, null); } return result; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/OptionFlags.java b/src/plantuml-asl/src/net/sourceforge/plantuml/OptionFlags.java index ff9e1d8f7..0520592a1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/OptionFlags.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/OptionFlags.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,14 +30,14 @@ */ package net.sourceforge.plantuml; -import java.io.File; import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.PrintStream; import java.util.concurrent.atomic.AtomicBoolean; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; +import net.sourceforge.plantuml.security.SFile; +import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.ugraphic.ImageBuilder; public class OptionFlags { @@ -50,6 +50,10 @@ public class OptionFlags { static public boolean ALLOW_INCLUDE = true; + static public void setAllowIncludeFalse() { + ALLOW_INCLUDE = false; + } + static public void setMaxPixel(int max) { ImageBuilder.setMaxPixel(max); } @@ -120,7 +124,7 @@ public boolean useJavaInsteadOfDot() { private boolean clipboard; private String fileSeparator = "_"; private long timeoutMs = 15 * 60 * 1000L; // 15 minutes - private File logData; + private SFile logData; public static OptionFlags getInstance() { return singleton; @@ -184,7 +188,7 @@ public final void setCheckDotError(boolean checkDotError) { private final AtomicBoolean logDataInitized = new AtomicBoolean(false); - public void logData(File file, Diagram system) { + public void logData(final SFile file, Diagram system) { final String warnOrError = system.getWarningOrError(); if (warnOrError == null) { return; @@ -193,7 +197,7 @@ public void logData(File file, Diagram system) { if (logData == null && logDataInitized.get() == false) { final String s = GraphvizUtils.getenvLogData(); if (s != null) { - setLogData(new File(s)); + setLogData(new SFile(s)); } logDataInitized.set(true); } @@ -204,7 +208,7 @@ public void logData(File file, Diagram system) { // final PSystemError systemError = (PSystemError) system; PrintStream ps = null; try { - ps = new PrintStream(new FileOutputStream(logData, true)); + ps = SecurityUtils.createPrintStream(logData.createFileOutputStream(true)); ps.println("Start of " + file.getName()); ps.println(warnOrError); ps.println("End of " + file.getName()); @@ -220,12 +224,12 @@ public void logData(File file, Diagram system) { } } - public final void setLogData(File logData) { + public final void setLogData(SFile logData) { this.logData = logData; logData.delete(); PrintStream ps = null; try { - ps = new PrintStream(new FileOutputStream(logData)); + ps = SecurityUtils.createPrintStream(logData.createFileOutputStream()); ps.println(); } catch (FileNotFoundException e) { Log.error("Cannot open " + logData); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/OptionPreprocOutputMode.java b/src/plantuml-asl/src/net/sourceforge/plantuml/OptionPreprocOutputMode.java index e1641f2f8..8a06d958d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/OptionPreprocOutputMode.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/OptionPreprocOutputMode.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/OptionPrint.java b/src/plantuml-asl/src/net/sourceforge/plantuml/OptionPrint.java index 179f90d15..00695dc1a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/OptionPrint.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/OptionPrint.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,7 +30,6 @@ */ package net.sourceforge.plantuml; -import java.io.File; import java.net.InetAddress; import java.nio.charset.Charset; import java.util.ArrayList; @@ -43,6 +42,9 @@ import java.util.Properties; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; +import net.sourceforge.plantuml.security.SFile; +import net.sourceforge.plantuml.security.SecurityProfile; +import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.syntax.LanguageDescriptor; import net.sourceforge.plantuml.version.License; import net.sourceforge.plantuml.version.PSystemVersion; @@ -73,8 +75,8 @@ static public void printHelp() throws InterruptedException { System.out.println("\t(to process files or directories)"); System.out.println(); System.out.println("You can use the following wildcards in files/dirs:"); - System.out.println("\t*\tmeans any characters but '" + File.separator + "'"); - System.out.println("\t?\tone and only one character but '" + File.separator + "'"); + System.out.println("\t*\tmeans any characters but '" + SFile.separator + "'"); + System.out.println("\t?\tone and only one character but '" + SFile.separator + "'"); System.out.println("\t**\tmeans any characters (used to recurse through directories)"); System.out.println(); System.out.println("where options include:"); @@ -95,19 +97,19 @@ static public void printHelp() throws InterruptedException { System.out.println(" -DVAR1=value\tTo set a preprocessing variable as if '!define VAR1 value' were used"); System.out.println(" -Sparam1=value\tTo set a skin parameter as if 'skinparam param1 value' were used"); System.out.println(" -r[ecurse]\t\trecurse through directories"); - // System.out.println(" -config \"file\"\tTo read the provided config file before each diagram"); - final char separator = File.separatorChar; + // System.out.println(" -config \"file\"\tTo read the provided config file + // before each diagram"); + final char separator = SFile.separatorChar; System.out.println(" -I" + separator + "path" + separator + "to" + separator + "file\tTo include file as if '!include file' were used"); - System.out.println(" -I" + separator + "path" + separator + "to" + separator - + "*.puml\tTo include files with pattern"); + System.out.println( + " -I" + separator + "path" + separator + "to" + separator + "*.puml\tTo include files with pattern"); System.out.println(" -charset xxx\tTo use a specific charset (default is " + charset + ")"); System.out.println(" -e[x]clude pattern\tTo exclude files that match the provided pattern"); System.out.println(" -metadata\t\tTo retrieve PlantUML sources from PNG images"); System.out.println(" -nometadata\t\tTo NOT export metadata in PNG/SVG generated files"); System.out.println(" -checkmetadata\t\tSkip PNG files that don't need to be regenerated"); System.out.println(" -version\t\tTo display information about PlantUML and Java versions"); - System.out.println(" -checkversion\tTo check if a newer version is available for download"); System.out.println(" -v[erbose]\t\tTo have log information"); System.out.println(" -quiet\t\tTo NOT print error message into the console"); System.out.println(" -debugsvek\t\tTo generate intermediate svek files"); @@ -115,13 +117,14 @@ static public void printHelp() throws InterruptedException { System.out.println(" -testdot\t\tTo test the installation of graphviz"); System.out.println(" -graphvizdot \"exe\"\tTo specify dot executable"); System.out.println(" -p[ipe]\t\tTo use stdin for PlantUML source and stdout for PNG/SVG/EPS generation"); - System.out - .println(" -encodesprite 4|8|16[z] \"file\"\tTo encode a sprite at gray level (z for compression) from an image"); + System.out.println( + " -encodesprite 4|8|16[z] \"file\"\tTo encode a sprite at gray level (z for compression) from an image"); System.out.println(" -computeurl|-encodeurl\tTo compute the encoded URL of a PlantUML source file"); System.out.println(" -decodeurl\t\tTo retrieve the PlantUML source from an encoded URL"); System.out.println(" -syntax\t\tTo report any syntax error from standard input without generating images"); System.out.println(" -language\t\tTo print the list of PlantUML keywords"); - // System.out.println(" -nosuggestengine\tTo disable the suggest engine when errors in diagrams"); + // System.out.println(" -nosuggestengine\tTo disable the suggest engine when + // errors in diagrams"); System.out.println(" -checkonly\t\tTo check the syntax of files without generating images"); System.out.println(" -failfast\t\tTo stop processing as soon as a syntax error in diagram occurs"); System.out.println(" -failfast2\t\tTo do a first syntax check before processing files, to fail even faster"); @@ -187,12 +190,22 @@ public static void printVersion() throws InterruptedException { public static Collection interestingProperties() { final Properties p = System.getProperties(); - final List all = withIp() ? Arrays.asList("java.runtime.name", "Java Runtime", "java.vm.name", "JVM", - "java.runtime.version", "Java Version", "os.name", "Operating System", "file.encoding", - "Default Encoding", "user.language", "Language", "user.country", "Country") : Arrays.asList( - "java.runtime.name", "Java Runtime", "java.vm.name", "JVM", "java.runtime.version", "Java Version", - "os.name", "Operating System", "os.version", "OS Version", "file.encoding", "Default Encoding", - "user.language", "Language", "user.country", "Country"); +// final List list1 = Arrays.asList("java.runtime.name", "Java Runtime", "java.vm.name", "JVM", +// "java.runtime.version", "Java Version", "os.name", "Operating System", "file.encoding", +// "Default Encoding", "user.language", "Language", "user.country", "Country"); +// final List list2 = Arrays.asList("java.runtime.name", "Java Runtime", "java.vm.name", "JVM", +// "java.runtime.version", "Java Version", "os.name", "Operating System", /* "os.version", "OS Version", */ +// "file.encoding", "Default Encoding", "user.language", "Language", "user.country", "Country"); +// final List all = withIp() ? list1 : list2; + final List all; + if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) { + all = Arrays.asList("java.runtime.name", "Java Runtime", "java.vm.name", "JVM", "java.runtime.version", + "Java Version", "os.name", "Operating System", "os.version", "OS Version", "file.encoding", + "Default Encoding", "user.language", "Language", "user.country", "Country"); + } else { + all = Arrays.asList("java.runtime.name", "Java Runtime", "java.vm.name", "JVM", "file.encoding", + "Default Encoding", "user.language", "Language", "user.country", "Country"); + } final List result = new ArrayList(); for (int i = 0; i < all.size(); i += 2) { result.add(all.get(i + 1) + ": " + p.getProperty(all.get(i))); @@ -202,27 +215,33 @@ public static Collection interestingProperties() { public static Collection interestingValues() { final List strings = new ArrayList(); - if (withIp() == false) { - strings.add("Machine: " + getHostName()); - } +// if (withIp() == false) { +// strings.add("Machine: " + getHostName()); +// } +// strings.add(" "); +// strings.add("Current Security Profile: " + SecurityUtils.getSecurityProfile()); +// strings.add(SecurityUtils.getSecurityProfile().longDescription()); + strings.add(" "); strings.add("PLANTUML_LIMIT_SIZE: " + GraphvizUtils.getenvImageLimit()); - strings.add("Processors: " + Runtime.getRuntime().availableProcessors()); - final long freeMemory = Runtime.getRuntime().freeMemory(); - final long maxMemory = Runtime.getRuntime().maxMemory(); - final long totalMemory = Runtime.getRuntime().totalMemory(); - final long usedMemory = totalMemory - freeMemory; - final int threadActiveCount = Thread.activeCount(); - strings.add("Max Memory: " + format(maxMemory)); - strings.add("Total Memory: " + format(totalMemory)); - strings.add("Free Memory: " + format(freeMemory)); - strings.add("Used Memory: " + format(usedMemory)); - strings.add("Thread Active Count: " + threadActiveCount); + if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) { + strings.add("Processors: " + Runtime.getRuntime().availableProcessors()); + final long freeMemory = Runtime.getRuntime().freeMemory(); + final long maxMemory = Runtime.getRuntime().maxMemory(); + final long totalMemory = Runtime.getRuntime().totalMemory(); + final long usedMemory = totalMemory - freeMemory; + final int threadActiveCount = Thread.activeCount(); + strings.add("Max Memory: " + format(maxMemory)); + strings.add("Total Memory: " + format(totalMemory)); + strings.add("Free Memory: " + format(freeMemory)); + strings.add("Used Memory: " + format(usedMemory)); + strings.add("Thread Active Count: " + threadActiveCount); + } return Collections.unmodifiableCollection(strings); } - private static boolean withIp() { - return getHostName().startsWith("ip-"); - } +// private static boolean withIp() { +// return getHostName().startsWith("ip-"); +// } private static String hostname; @@ -252,30 +271,6 @@ private static String format(final long value) { return String.format(Locale.US, "%,d", value); } - public static void checkVersion() throws InterruptedException { - System.out.println(Version.fullDescription()); - System.out.println(); - final int lastversion = PSystemVersion.extractDownloadableVersion(null, null); - if (lastversion == -1) { - System.out.println("Error"); - System.out.println("Cannot connect to http://plantuml.com/"); - System.out.println("Maybe you should set your proxy ?"); - } else if (lastversion == 0) { - System.out.println("Error"); - System.out.println("Cannot retrieve last version from http://plantuml.com/"); - } else { - System.out.println("Last available version for download : " + lastversion); - System.out.println(); - if (Version.version() >= lastversion) { - System.out.println("Your version is up to date."); - } else { - System.out.println("A newer version is available for download."); - } - } - - exit(0); - } - public static void printAbout() throws InterruptedException { for (String s : PSystemVersion.getAuthorsStrings(false)) { System.out.println(s); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/PSystemBuilder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/PSystemBuilder.java index 4052193ea..b21731d9a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/PSystemBuilder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/PSystemBuilder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,22 +33,17 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; import net.sourceforge.plantuml.activitydiagram.ActivityDiagramFactory; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagramFactory3; import net.sourceforge.plantuml.api.PSystemFactory; import net.sourceforge.plantuml.bpm.BpmDiagramFactory; import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory; -import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.command.regex.RegexConcat; -import net.sourceforge.plantuml.compositediagram.CompositeDiagramFactory; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; -import net.sourceforge.plantuml.creole.PSystemCreoleFactory; +import net.sourceforge.plantuml.creole.legacy.PSystemCreoleFactory; import net.sourceforge.plantuml.dedication.PSystemDedicationFactory; import net.sourceforge.plantuml.definition.PSystemDefinitionFactory; import net.sourceforge.plantuml.descdiagram.DescriptionDiagramFactory; @@ -60,6 +55,7 @@ import net.sourceforge.plantuml.eggs.PSystemCharlieFactory; import net.sourceforge.plantuml.eggs.PSystemColorsFactory; import net.sourceforge.plantuml.eggs.PSystemEggFactory; +import net.sourceforge.plantuml.eggs.PSystemPathFactory; import net.sourceforge.plantuml.eggs.PSystemRIPFactory; import net.sourceforge.plantuml.eggs.PSystemWelcomeFactory; import net.sourceforge.plantuml.error.PSystemError; @@ -74,39 +70,45 @@ import net.sourceforge.plantuml.openiconic.PSystemListOpenIconicFactory; import net.sourceforge.plantuml.openiconic.PSystemOpenIconicFactory; import net.sourceforge.plantuml.oregon.PSystemOregonFactory; -import net.sourceforge.plantuml.project3.GanttDiagramFactory; +import net.sourceforge.plantuml.project.GanttDiagramFactory; import net.sourceforge.plantuml.salt.PSystemSaltFactory; +import net.sourceforge.plantuml.security.SecurityProfile; +import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory; +import net.sourceforge.plantuml.sprite.ListSpriteDiagramFactory; +import net.sourceforge.plantuml.sprite.PSystemListInternalSpritesFactory; +import net.sourceforge.plantuml.sprite.StdlibDiagramFactory; import net.sourceforge.plantuml.statediagram.StateDiagramFactory; import net.sourceforge.plantuml.stats.StatsUtilsIncrement; import net.sourceforge.plantuml.timingdiagram.TimingDiagramFactory; -import net.sourceforge.plantuml.ugraphic.sprite.PSystemListInternalSpritesFactory; import net.sourceforge.plantuml.version.License; import net.sourceforge.plantuml.version.PSystemLicenseFactory; import net.sourceforge.plantuml.version.PSystemVersionFactory; import net.sourceforge.plantuml.wbs.WBSDiagramFactory; +import net.sourceforge.plantuml.wire.WireDiagramFactory; public class PSystemBuilder { public static final long startTime = System.currentTimeMillis(); - final public Diagram createPSystem(ISkinSimple skinParam, final List strings2) { + final public Diagram createPSystem(ISkinSimple skinParam, List source, + List rawSource) { final long now = System.currentTimeMillis(); Diagram result = null; try { - final DiagramType type = DiagramType.getTypeFromArobaseStart(strings2.get(0).getString()); - final UmlSource umlSource = new UmlSource(strings2, type == DiagramType.UML); + final DiagramType type = DiagramType.getTypeFromArobaseStart(source.get(0).getString()); + final UmlSource umlSource = new UmlSource(source, type == DiagramType.UML, rawSource); - for (StringLocated s : strings2) { + for (StringLocated s : source) { if (s.getPreprocessorError() != null) { // Dead code : should not append + assert false; Log.error("Preprocessor Error: " + s.getPreprocessorError()); final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, s.getPreprocessorError(), /* cpt */ - s.getLocation()); - // return PSystemErrorUtils.buildV1(umlSource, err, Collections. emptyList()); - return PSystemErrorUtils.buildV2(umlSource, err, Collections. emptyList(), strings2); + s.getLocation()); + return PSystemErrorUtils.buildV2(umlSource, err, Collections.emptyList(), source); } } @@ -147,7 +149,7 @@ private static List getAllFactories(ISkinSimple skinParam) { factories.add(new DescriptionDiagramFactory(skinParam)); factories.add(new StateDiagramFactory(skinParam)); factories.add(new ActivityDiagramFactory3(skinParam)); - factories.add(new CompositeDiagramFactory(skinParam)); + // factories.add(new CompositeDiagramFactory(skinParam)); factories.add(new BpmDiagramFactory(DiagramType.BPM)); // factories.add(new PostIdDiagramFactory()); factories.add(new PSystemLicenseFactory()); @@ -168,6 +170,8 @@ private static List getAllFactories(ISkinSimple skinParam) { factories.add(new PSystemDitaaFactory(DiagramType.DITAA)); factories.add(new PSystemDitaaFactory(DiagramType.UML)); factories.add(new PSystemDefinitionFactory()); + factories.add(new ListSpriteDiagramFactory(skinParam)); + factories.add(new StdlibDiagramFactory(skinParam)); factories.add(new PSystemMathFactory(DiagramType.MATH)); factories.add(new PSystemLatexFactory(DiagramType.LATEX)); // factories.add(new PSystemStatsFactory()); @@ -176,7 +180,9 @@ private static List getAllFactories(ISkinSimple skinParam) { factories.add(new PSystemAppleTwoFactory()); factories.add(new PSystemRIPFactory()); // factories.add(new PSystemLostFactory()); - // factories.add(new PSystemPathFactory()); + if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) { + factories.add(new PSystemPathFactory()); + } factories.add(new PSystemOregonFactory()); factories.add(new PSystemCharlieFactory()); factories.add(new GanttDiagramFactory(DiagramType.GANTT)); @@ -187,6 +193,7 @@ private static List getAllFactories(ISkinSimple skinParam) { factories.add(new PSystemDedicationFactory()); factories.add(new TimingDiagramFactory()); factories.add(new HelpFactory()); + factories.add(new WireDiagramFactory()); return factories; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/PSystemUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/PSystemUtils.java index 7f7e770d7..ad72a6e8d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/PSystemUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/PSystemUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,9 +30,6 @@ */ package net.sourceforge.plantuml; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; @@ -44,12 +41,12 @@ import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.html.CucaDiagramHtmlMaker; -import net.sourceforge.plantuml.png.MetadataTag; import net.sourceforge.plantuml.png.PngSplitter; -import net.sourceforge.plantuml.project3.GanttDiagram; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemUtils { @@ -61,19 +58,19 @@ public static List exportDiagrams(Diagram system, SuggestedFile s public static List exportDiagrams(Diagram system, SuggestedFile suggestedFile, FileFormatOption fileFormatOption, boolean checkMetadata) throws IOException { - final File existing = suggestedFile.getFile(0); - if (checkMetadata && existing.exists() && system.getNbImages() == 1) { - final MetadataTag tag = new MetadataTag(existing, "plantuml"); - final String previousMetadata = tag.getData(); + final SFile existingFile = suggestedFile.getFile(0); + if (checkMetadata && fileFormatOption.getFileFormat().doesSupportMetadata() && existingFile.exists() + && system.getNbImages() == 1) { // final String version = Version.versionString(); // System.out.println(system.getMetadata()); // System.out.println(data); // System.out.println(version); // System.out.println(data.contains(version)); - final boolean sameMetadata = system.getMetadata().equals(previousMetadata); + final boolean sameMetadata = fileFormatOption.getFileFormat().equalsMetadata(system.getMetadata(), + existingFile); if (sameMetadata) { - Log.info("Skipping " + existing.getAbsolutePath() + " because metadata has not changed."); - return Arrays.asList(new FileImageData(existing, null)); + Log.info("Skipping " + existingFile.getPrintablePath() + " because metadata has not changed."); + return Arrays.asList(new FileImageData(existingFile, null)); } } @@ -101,11 +98,11 @@ private static List exportDiagramsNewpaged(NewpagedDiagram system final int nbImages = system.getNbImages(); for (int i = 0; i < nbImages; i++) { - final File f = suggestedFile.getFile(i); + final SFile f = suggestedFile.getFile(i); if (canFileBeWritten(f) == false) { return result; } - final OutputStream fos = new BufferedOutputStream(new FileOutputStream(f)); + final OutputStream fos = f.createBufferedOutputStream(); ImageData cmap = null; try { system.exportDiagram(fos, i, fileFormat); @@ -121,8 +118,8 @@ private static List exportDiagramsNewpaged(NewpagedDiagram system return result; } - public static boolean canFileBeWritten(final File f) { - Log.info("Creating file: " + f); + public static boolean canFileBeWritten(final SFile f) { + Log.info("Creating file: " + f.getAbsolutePath()); if (f.exists() && f.canWrite() == false) { if (OptionFlags.getInstance().isOverwrite()) { Log.info("Overwrite " + f); @@ -130,7 +127,7 @@ public static boolean canFileBeWritten(final File f) { f.delete(); return true; } - Log.error("Cannot write to file " + f); + Log.error("Cannot write to file " + f.getAbsolutePath()); return false; } return true; @@ -147,7 +144,7 @@ static private List exportDiagramsDefault(Diagram system, Suggest if (PSystemUtils.canFileBeWritten(suggestedFile.getFile(0)) == false) { return Collections.emptyList(); } - os = new BufferedOutputStream(new FileOutputStream(suggestedFile.getFile(0))); + os = suggestedFile.getFile(0).createBufferedOutputStream(); // system.exportDiagram(os, null, 0, fileFormat); imageData = system.exportDiagram(os, 0, fileFormat); } finally { @@ -170,7 +167,7 @@ static private List exportDiagramsActivityDiagram3(ActivityDiagra if (PSystemUtils.canFileBeWritten(suggestedFile.getFile(0)) == false) { return Collections.emptyList(); } - os = new BufferedOutputStream(new FileOutputStream(suggestedFile.getFile(0))); + os = suggestedFile.getFile(0).createBufferedOutputStream(); imageData = cmap = system.exportDiagram(os, 0, fileFormat); } finally { if (os != null) { @@ -189,11 +186,11 @@ private static List exportDiagramsSequence(SequenceDiagram system final int nbImages = system.getNbImages(); for (int i = 0; i < nbImages; i++) { - final File f = suggestedFile.getFile(i); + final SFile f = suggestedFile.getFile(i); if (PSystemUtils.canFileBeWritten(suggestedFile.getFile(i)) == false) { return result; } - final OutputStream fos = new BufferedOutputStream(new FileOutputStream(f)); + final OutputStream fos = f.createBufferedOutputStream(); ImageData cmap = null; try { cmap = system.exportDiagram(fos, i, fileFormat); @@ -226,7 +223,7 @@ static private List exportDiagramsCuca(CucaDiagram system, Sugges return Collections.emptyList(); } // System.err.println("FOO11=" + suggestedFile); - // os = new BufferedOutputStream(new FileOutputStream(suggestedFile)); + // os = SecurityUtils.BufferedOutputStream(suggestedFile)); os = new NamedOutputStream(suggestedFile.getFile(0)); cmap = system.exportDiagram(os, 0, fileFormat); } finally { @@ -234,7 +231,7 @@ static private List exportDiagramsCuca(CucaDiagram system, Sugges os.close(); } } - List result = Arrays.asList(suggestedFile.getFile(0)); + List result = Arrays.asList(suggestedFile.getFile(0)); if (cmap != null && cmap.containsCMapData()) { system.exportCmap(suggestedFile, 0, cmap); @@ -246,16 +243,18 @@ static private List exportDiagramsCuca(CucaDiagram system, Sugges system.getSkinParam().getSplitParam()).getFiles(); } final List result2 = new ArrayList(); - for (File f : result) { + for (SFile f : result) { result2.add(new FileImageData(f, cmap)); } return result2; } - // static private List exportDiagramsGantt1(GanttDiagram system, SuggestedFile suggestedFile, + // static private List exportDiagramsGantt1(GanttDiagram system, + // SuggestedFile suggestedFile, // FileFormatOption fileFormat) throws IOException { - // if (suggestedFile.getFile(0).exists() && suggestedFile.getFile(0).isDirectory()) { + // if (suggestedFile.getFile(0).exists() && + // suggestedFile.getFile(0).isDirectory()) { // throw new IllegalArgumentException("File is a directory " + suggestedFile); // } // OutputStream os = null; @@ -264,7 +263,7 @@ static private List exportDiagramsCuca(CucaDiagram system, Sugges // if (PSystemUtils.canFileBeWritten(suggestedFile.getFile(0)) == false) { // return Collections.emptyList(); // } - // os = new BufferedOutputStream(new FileOutputStream(suggestedFile.getFile(0))); + // os = SecurityUtils.BufferedOutputStream(suggestedFile.getFile(0))); // imageData = system.exportDiagram(os, 0, fileFormat); // } finally { // if (os != null) { @@ -293,16 +292,16 @@ static private List exportDiagramsGantt2(GanttDiagram system, Sug os.close(); } } - List result = Arrays.asList(suggestedFile.getFile(0)); + List result = Arrays.asList(suggestedFile.getFile(0)); if (fileFormat.getFileFormat() == FileFormat.PNG) { - final SplitParam splitParam = new SplitParam(HtmlColorUtils.BLACK, null, 5); + final SplitParam splitParam = new SplitParam(HColorUtils.BLACK, null, 5); result = new PngSplitter(suggestedFile, system.getHorizontalPages(), system.getVerticalPages(), system.getMetadata(), system.getDpi(fileFormat), fileFormat.isWithMetadata(), splitParam) - .getFiles(); + .getFiles(); } final List result2 = new ArrayList(); - for (File f : result) { + for (SFile f : result) { result2.add(new FileImageData(f, cmap)); } return result2; @@ -313,7 +312,7 @@ private static List createFilesHtml(CucaDiagram system, Suggested throws IOException { final String name = suggestedFile.getName(); final int idx = name.lastIndexOf('.'); - final File dir = new File(suggestedFile.getParentFile(), name.substring(0, idx)); + final SFile dir = suggestedFile.getParentFile().file(name.substring(0, idx)); final CucaDiagramHtmlMaker maker = new CucaDiagramHtmlMaker(system, dir); return maker.create(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/PaddingParam.java b/src/plantuml-asl/src/net/sourceforge/plantuml/PaddingParam.java index 5e3fb042d..3d3f0d152 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/PaddingParam.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/PaddingParam.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/Pipe.java b/src/plantuml-asl/src/net/sourceforge/plantuml/Pipe.java index 9eff216a8..f4d0aa655 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/Pipe.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/Pipe.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -95,11 +95,13 @@ public void managePipe(ErrorStatus error) throws IOException { } else if (option.isPipeMap()) { final String result = sourceStringReader.getCMapData(option.getImageIndex(), option.getFileFormatOption()); + // https://forum.plantuml.net/10049/2019-pipemap-diagrams-containing-links-give-zero-exit-code + // We don't check errors + error.goOk(); if (result == null) { ps.println(); } else { ps.println(result); - error.goOk(); } } else { final OutputStream os = noStdErr ? new ByteArrayOutputStream() : ps; @@ -146,6 +148,8 @@ private String readOneDiagram() throws IOException { final String s = readOneLine(); if (s == null) { closed = true; + } else if (s.startsWith("@@@format ")) { + manageFormat(s); } else { sb.append(s); sb.append(BackSlash.NEWLINE); @@ -164,6 +168,14 @@ private String readOneDiagram() throws IOException { return source; } + private void manageFormat(String s) { + if (s.contains("png")) { + option.setFileFormatOption(new FileFormatOption(FileFormat.PNG)); + } else if (s.contains("svg")) { + option.setFileFormatOption(new FileFormatOption(FileFormat.SVG)); + } + } + private String readOneLine() throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); while (true) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/Pragma.java b/src/plantuml-asl/src/net/sourceforge/plantuml/Pragma.java index bc1109b4b..896730da6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/Pragma.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/Pragma.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -57,6 +57,14 @@ public boolean horizontalLineBetweenDifferentPackageAllowed() { return isDefine("horizontallinebetweendifferentpackageallowed"); } + public boolean backToLegacyPackage() { + return isDefine("backtolegacypackage"); + } + + public boolean useNewPackage() { + return isDefine("usenewpackage"); + } + public boolean useVerticalIf() { final String teoz = getValue("useverticalif"); return "true".equalsIgnoreCase(teoz) || "on".equalsIgnoreCase(teoz); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ProgressBar.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ProgressBar.java index 7e3c497fc..1df3edc8a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ProgressBar.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ProgressBar.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/Removeable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/Removeable.java index 2397e1404..9f9551536 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/Removeable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/Removeable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/Run.java b/src/plantuml-asl/src/net/sourceforge/plantuml/Run.java index 01715559e..49d8c675e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/Run.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/Run.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -47,26 +47,28 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import javax.imageio.ImageIO; import javax.swing.UIManager; import net.sourceforge.plantuml.activitydiagram.ActivityDiagramFactory; import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory; +import net.sourceforge.plantuml.code.NoPlantumlCompressionException; import net.sourceforge.plantuml.code.Transcoder; import net.sourceforge.plantuml.code.TranscoderUtil; import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.descdiagram.DescriptionDiagramFactory; import net.sourceforge.plantuml.ftp.FtpServer; -import net.sourceforge.plantuml.objectdiagram.ObjectDiagramFactory; import net.sourceforge.plantuml.png.MetadataTag; import net.sourceforge.plantuml.preproc.Stdlib; +import net.sourceforge.plantuml.security.ImageIO; +import net.sourceforge.plantuml.security.SFile; +import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory; +import net.sourceforge.plantuml.sprite.SpriteGrayLevel; +import net.sourceforge.plantuml.sprite.SpriteUtils; import net.sourceforge.plantuml.statediagram.StateDiagramFactory; import net.sourceforge.plantuml.stats.StatsUtils; import net.sourceforge.plantuml.swing.MainWindow2; import net.sourceforge.plantuml.syntax.LanguageDescriptor; -import net.sourceforge.plantuml.ugraphic.sprite.SpriteGrayLevel; -import net.sourceforge.plantuml.ugraphic.sprite.SpriteUtils; import net.sourceforge.plantuml.utils.Cypher; import net.sourceforge.plantuml.version.Version; @@ -74,7 +76,8 @@ public class Run { private static Cypher cypher; - public static void main(String[] argsArray) throws IOException, InterruptedException { + public static void main(String[] argsArray) + throws NoPlantumlCompressionException, IOException, InterruptedException { System.setProperty("log4j.debug", "false"); final long start = System.currentTimeMillis(); if (argsArray.length > 0 && argsArray[0].equalsIgnoreCase("-headless")) { @@ -115,6 +118,7 @@ public static void main(String[] argsArray) throws IOException, InterruptedExcep encodeSprite(option.getResult()); return; } + Log.info("SecurityProfile " + SecurityUtils.getSecurityProfile()); if (OptionFlags.getInstance().isVerbose()) { Log.info("PlantUML Version " + Version.versionString()); Log.info("GraphicsEnvironment.isHeadless() " + GraphicsEnvironment.isHeadless()); @@ -265,15 +269,19 @@ private static void encodeSprite(List result) throws IOException { final URL source; final String lowerPath = StringUtils.goLowerCase(path); if (lowerPath.startsWith(httpProtocol) || lowerPath.startsWith(httpsProtocol)) { - source = new URL(path); + source = new java.net.URL(path); final String p = source.getPath(); fileName = p.substring(p.lastIndexOf('/') + 1, p.length()); } else { - final File f = new File(path); + final SFile f = new SFile(path); source = f.toURI().toURL(); fileName = f.getName(); } + if (source == null) { + return; + } + InputStream stream = null; final BufferedImage im; try { @@ -286,8 +294,8 @@ private static void encodeSprite(List result) throws IOException { } final String name = getSpriteName(fileName); - final String s = compressed ? SpriteUtils.encodeCompressed(im, name, level) : SpriteUtils.encode(im, name, - level); + final String s = compressed ? SpriteUtils.encodeCompressed(im, name, level) + : SpriteUtils.encode(im, name, level); System.out.println(s); } @@ -321,8 +329,8 @@ private static void goFtp(Option option) throws IOException { public static void printFonts() { final Font fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); for (Font f : fonts) { - System.out.println("f=" + f + "/" + f.getPSName() + "/" + f.getName() + "/" + f.getFontName() + "/" - + f.getFamily()); + System.out.println( + "f=" + f + "/" + f.getPSName() + "/" + f.getName() + "/" + f.getFontName() + "/" + f.getFamily()); } final String name[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); for (String n : name) { @@ -337,7 +345,7 @@ private static void managePattern() { printPattern(new DescriptionDiagramFactory(null)); // printPattern(new ComponentDiagramFactory()); printPattern(new StateDiagramFactory(null)); - printPattern(new ObjectDiagramFactory(null)); + // printPattern(new ObjectDiagramFactory(null)); } private static void printPattern(UmlDiagramFactory factory) { @@ -354,15 +362,16 @@ private static void managePipe(Option option, ErrorStatus error) throws IOExcept new Pipe(option, System.out, System.in, charset).managePipe(error); } - private static void manageAllFiles(Option option, ErrorStatus error) throws IOException, InterruptedException { + private static void manageAllFiles(Option option, ErrorStatus error) + throws NoPlantumlCompressionException, InterruptedException { - File lockFile = null; + SFile lockFile = null; try { if (OptionFlags.getInstance().isWord()) { - final File dir = new File(option.getResult().get(0)); - final File javaIsRunningFile = new File(dir, "javaisrunning.tmp"); + final SFile dir = new SFile(option.getResult().get(0)); + final SFile javaIsRunningFile = dir.file("javaisrunning.tmp"); javaIsRunningFile.delete(); - lockFile = new File(dir, "javaumllock.tmp"); + lockFile = dir.file("javaumllock.tmp"); } processArgs(option, error); } finally { @@ -373,7 +382,8 @@ private static void manageAllFiles(Option option, ErrorStatus error) throws IOEx } - private static void processArgs(Option option, ErrorStatus error) throws IOException, InterruptedException { + private static void processArgs(Option option, ErrorStatus error) + throws NoPlantumlCompressionException, InterruptedException { if (option.isDecodeurl() == false && option.getNbThreads() > 1 && option.isCheckOnly() == false && OptionFlags.getInstance().isExtractFromMetadata() == false) { multithread(option, error); @@ -453,9 +463,9 @@ private static void incTotal(int nb) { ProgressBar.incTotal(nb); } - private static void manageFileInternal(File f, Option option, ErrorStatus error) throws IOException, - InterruptedException { - Log.info("Working on " + f.getAbsolutePath()); + private static void manageFileInternal(File f, Option option, ErrorStatus error) + throws IOException, InterruptedException { + Log.info("Working on " + f.getPath()); if (OptionFlags.getInstance().isExtractFromMetadata()) { System.out.println("------------------------"); System.out.println(f); @@ -463,8 +473,8 @@ private static void manageFileInternal(File f, Option option, ErrorStatus error) System.out.println(); error.goOk(); final String data = new MetadataTag(f, "plantuml").getData(); - // File file = new File("tmp.txt"); - // PrintWriter pw = new PrintWriter(file, "UTF-8"); + // File file = SecurityUtils.File("tmp.txt"); + // PrintWriter pw = SecurityUtils.PrintWriter(file, "UTF-8"); // pw.println(NastyEncoder.fromISO_8859_1(data)); // pw.close(); @@ -474,10 +484,18 @@ private static void manageFileInternal(File f, Option option, ErrorStatus error) } final ISourceFileReader sourceFileReader; if (option.getOutputFile() == null) { - sourceFileReader = new SourceFileReader(option.getDefaultDefines(f), f, option.getOutputDir(), - option.getConfig(), option.getCharset(), option.getFileFormatOption()); + File outputDir = option.getOutputDir(); + if (outputDir != null && outputDir.getPath().endsWith("$")) { + final String path = outputDir.getPath(); + outputDir = new File(path.substring(0, path.length() - 1)).getAbsoluteFile(); + sourceFileReader = new SourceFileReaderCopyCat(option.getDefaultDefines(f), f, outputDir, + option.getConfig(), option.getCharset(), option.getFileFormatOption()); + } else { + sourceFileReader = new SourceFileReader(option.getDefaultDefines(f), f, outputDir, option.getConfig(), + option.getCharset(), option.getFileFormatOption()); + } } else { - sourceFileReader = new SourceFileReader2(option.getDefaultDefines(f), f, option.getOutputFile(), + sourceFileReader = new SourceFileReaderHardFile(option.getDefaultDefines(f), f, option.getOutputFile(), option.getConfig(), option.getCharset(), option.getFileFormatOption()); } sourceFileReader.setCheckMetadata(option.isCheckMetadata()); @@ -507,7 +525,7 @@ private static void manageFileInternal(File f, Option option, ErrorStatus error) final List result = sourceFileReader.getGeneratedImages(); final Stdrpt rpt = option.getStdrpt(); if (result.size() == 0) { - Log.error("Warning: no image in " + f.getCanonicalPath()); + Log.error("Warning: no image in " + f.getPath()); rpt.printInfo(System.err, null); // error.goNoData(); return; @@ -524,12 +542,22 @@ private static void extractPreproc(Option option, final ISourceFileReader source for (BlockUml blockUml : sourceFileReader.getBlocks()) { final SuggestedFile suggested = ((SourceFileReaderAbstract) sourceFileReader).getSuggestedFile(blockUml) .withPreprocFormat(); - final File file = suggested.getFile(0); - Log.info("Export preprocessing source to " + file.getAbsolutePath()); - final PrintWriter pw = charset == null ? new PrintWriter(file) : new PrintWriter(file, charset); - for (CharSequence s : blockUml.getDefinition(true)) { + final SFile file = suggested.getFile(0); + Log.info("Export preprocessing source to " + file.getPrintablePath()); + final PrintWriter pw = charset == null ? file.createPrintWriter() : file.createPrintWriter(charset); + int level = 0; + for (CharSequence cs : blockUml.getDefinition(true)) { + String s = cs.toString(); if (cypher != null) { - s = cypher.cypher(s.toString()); + if (s.contains("skinparam") && s.contains("{")) { + level++; + } + if (level == 0 && s.contains("skinparam") == false) { + s = cypher.cypher(s); + } + if (level > 0 && s.contains("}")) { + level--; + } } pw.println(s); } @@ -545,7 +573,7 @@ private static void hasErrors(File f, final List list, ErrorStat for (GeneratedImage i : list) { final int lineError = i.lineErrorRaw(); if (lineError != -1) { - Log.error("Error line " + lineError + " in file: " + f.getCanonicalPath()); + Log.error("Error line " + lineError + " in file: " + f.getPath()); error.goWithError(); return; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/Scale.java b/src/plantuml-asl/src/net/sourceforge/plantuml/Scale.java index 34e7019ee..f308ddd21 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/Scale.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/Scale.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleHeight.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleHeight.java index 6df262548..b8843bd50 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleHeight.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleHeight.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleMaxHeight.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleMaxHeight.java index e7c4d25b0..925549c66 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleMaxHeight.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleMaxHeight.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleMaxWidth.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleMaxWidth.java index fb81e8428..78bb4b89d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleMaxWidth.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleMaxWidth.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleMaxWidthAndHeight.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleMaxWidthAndHeight.java index 4a3a94bc3..378f49f69 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleMaxWidthAndHeight.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleMaxWidthAndHeight.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleProtected.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleProtected.java index 8e2307b1e..7f7397ec9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleProtected.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleProtected.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleSimple.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleSimple.java index e6cf70080..80facc2e5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleSimple.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleSimple.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleWidth.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleWidth.java index e88593fd6..2d3f948b6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleWidth.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleWidth.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleWidthAndHeight.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleWidthAndHeight.java index 35666e2b1..c6cd1a45f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleWidthAndHeight.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ScaleWidthAndHeight.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SignatureUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SignatureUtils.java index 495bfb10e..1030aea2c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SignatureUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SignatureUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,8 +30,7 @@ */ package net.sourceforge.plantuml; -import java.io.File; -import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; @@ -44,16 +43,19 @@ import javax.crypto.spec.PBEKeySpec; import net.sourceforge.plantuml.code.AsciiEncoder; +import net.sourceforge.plantuml.security.SFile; public class SignatureUtils { -// private static byte[] salting(String pass, byte[] salt) throws NoSuchAlgorithmException, InvalidKeySpecException, -// UnsupportedEncodingException { -// final byte[] tmp = salting2(pass, salt); -// return SignatureUtils.getSHA512raw(tmp); -// } + // private static byte[] salting(String pass, byte[] salt) throws + // NoSuchAlgorithmException, InvalidKeySpecException, + // UnsupportedEncodingException { + // final byte[] tmp = salting2(pass, salt); + // return SignatureUtils.getSHA512raw(tmp); + // } - public static byte[] salting(String pass, byte[] salt) throws NoSuchAlgorithmException, InvalidKeySpecException { + public static synchronized byte[] salting(String pass, byte[] salt) + throws NoSuchAlgorithmException, InvalidKeySpecException { final int iterations = 500; final int keyLength = 512; final SecretKeyFactory skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); @@ -117,7 +119,8 @@ public static String getSHA512Hex(String s) { } } - public static byte[] getMD5raw(String s) throws NoSuchAlgorithmException, UnsupportedEncodingException { + public static synchronized byte[] getMD5raw(String s) + throws NoSuchAlgorithmException, UnsupportedEncodingException { final MessageDigest msgDigest = MessageDigest.getInstance("MD5"); msgDigest.update(s.getBytes("UTF-8")); return msgDigest.digest(); @@ -127,14 +130,15 @@ public static byte[] getSHA512raw(String s) throws NoSuchAlgorithmException, Uns return getSHA512raw(s.getBytes("UTF-8")); } - public static byte[] getSHA512raw(byte data[]) throws NoSuchAlgorithmException, UnsupportedEncodingException { + public static synchronized byte[] getSHA512raw(byte data[]) + throws NoSuchAlgorithmException, UnsupportedEncodingException { final MessageDigest msgDigest = MessageDigest.getInstance("SHA-512"); msgDigest.update(data); return msgDigest.digest(); } - public static String getSignatureSha512(File f) throws IOException { - final InputStream is = new FileInputStream(f); + public static String getSignatureSha512(SFile f) throws IOException { + final InputStream is = f.openFile(); try { return getSignatureSha512(is); } finally { @@ -142,7 +146,7 @@ public static String getSignatureSha512(File f) throws IOException { } } - public static String getSignatureSha512(InputStream is) throws IOException { + public static synchronized String getSignatureSha512(InputStream is) throws IOException { try { final MessageDigest msgDigest = MessageDigest.getInstance("SHA-512"); int read = 0; @@ -173,10 +177,13 @@ public static String purge(String s) { return s; } - public static String getSignature(File f) throws IOException { + public static synchronized String getSignature(SFile f) throws IOException { try { final MessageDigest msgDigest = MessageDigest.getInstance("MD5"); - final FileInputStream is = new FileInputStream(f); + final InputStream is = f.openFile(); + if (is == null) { + throw new FileNotFoundException(); + } int read = -1; while ((read = is.read()) != -1) { msgDigest.update((byte) read); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SingleLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SingleLine.java index c182b4fa8..5cfd77076 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SingleLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SingleLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParam.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParam.java index d5a011128..3d58a44a3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParam.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParam.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,6 +32,7 @@ import java.awt.Font; import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -42,23 +43,23 @@ import java.util.Set; import java.util.TreeSet; +import net.sourceforge.plantuml.command.BlocLines; 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.creole.CommandCreoleMonospaced; +import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.cucadiagram.LinkStyle; import net.sourceforge.plantuml.cucadiagram.Rankdir; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.DotSplines; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.skin.ActorStyle; import net.sourceforge.plantuml.skin.ArrowDirection; import net.sourceforge.plantuml.skin.Padder; +import net.sourceforge.plantuml.sprite.Sprite; +import net.sourceforge.plantuml.sprite.SpriteImage; import net.sourceforge.plantuml.style.FromSkinparamToStyle; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; @@ -66,31 +67,96 @@ import net.sourceforge.plantuml.svek.ConditionEndStyle; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.PackageStyle; -import net.sourceforge.plantuml.ugraphic.ColorMapper; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; -import net.sourceforge.plantuml.ugraphic.ColorMapperMonochrome; -import net.sourceforge.plantuml.ugraphic.ColorMapperReverse; -import net.sourceforge.plantuml.ugraphic.ColorOrder; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UStroke; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; -import net.sourceforge.plantuml.ugraphic.sprite.SpriteImage; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperLightnessInverse; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperMonochrome; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperReverse; +import net.sourceforge.plantuml.ugraphic.color.ColorOrder; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class SkinParam implements ISkinParam { - public static final String DEFAULT_STYLE = "plantuml.skin"; + // private String skin = "debug.skin"; - // public static final String DEFAULT_STYLE = "debug.skin"; + private String skin = "plantuml.skin"; - static public boolean USE_STYLES() { - return USE_STYLE2.get(); + private SkinParam(UmlDiagramType type) { + USE_STYLE2.set(false); + this.type = type; + if (type == UmlDiagramType.MINDMAP) { + USE_STYLE2.set(true); + } + if (type == UmlDiagramType.WBS) { + USE_STYLE2.set(true); + } + if (type == UmlDiagramType.SEQUENCE) { + // skin = "debug.skin"; + // USE_STYLE2.set(true); + } + // if (type == UmlDiagramType.ACTIVITY) { + // // skin = "debug.skin"; + // USE_STYLE2.set(true); + // } + } + + private StyleBuilder styleBuilder; + + public StyleBuilder getCurrentStyleBuilder() { + if (styleBuilder == null && SkinParam.USE_STYLES()) { + try { + this.styleBuilder = getCurrentStyleBuilderInternal(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return styleBuilder; + } + + public void muteStyle(Style modifiedStyle) { + if (SkinParam.USE_STYLES()) { + styleBuilder = getCurrentStyleBuilder().muteStyle(modifiedStyle); + } + } + + public String getDefaultSkin() { + return skin; + } + + public void setDefaultSkin(String newSkin) { + this.skin = newSkin; + } + + public StyleBuilder getCurrentStyleBuilderInternal() throws IOException { + final StyleLoader tmp = new StyleLoader(this); + StyleBuilder result = tmp.loadSkin(this.getDefaultSkin()); + if (result == null) { + result = tmp.loadSkin("plantuml.skin"); + } + + return result; } private static ThreadLocal USE_STYLE2 = new ThreadLocal(); - private SkinParam(UmlDiagramType type) { - USE_STYLE2.set(false); - this.type = type; + static public boolean USE_STYLES() { + final Boolean result = USE_STYLE2.get(); + if (result == null) { + return false; + } + return result; + } + + static public void setBetaStyle(boolean betastyle) { + USE_STYLE2.set(betastyle); + } + + public static int zeroMargin(int defaultValue) { + return defaultValue; } private static final String stereoPatternString = "\\<\\<(.*?)\\>\\>"; @@ -113,16 +179,30 @@ public void setParam(String key, String value) { for (String key2 : cleanForKey(key)) { params.put(key2, StringUtils.trin(value)); if (key2.startsWith("usebetastyle")) { - USE_STYLE2.set("true".equalsIgnoreCase(value)); + final boolean betastyle = "true".equalsIgnoreCase(value); + setBetaStyle(betastyle); } if (USE_STYLES()) { final FromSkinparamToStyle convertor = new FromSkinparamToStyle(key2, value, getCurrentStyleBuilder()); - final Style style = convertor.getStyle(); - if (style != null) { + for (Style style : convertor.getStyles()) { muteStyle(style); } } } + if ("style".equalsIgnoreCase(key) && "strictuml".equalsIgnoreCase(value)) { + if (USE_STYLES()) { + final InputStream internalIs = StyleLoader.class.getResourceAsStream("/skin/strictuml.skin"); + final StyleBuilder styleBuilder = this.getCurrentStyleBuilder(); + try { + final BlocLines lines = BlocLines.load(internalIs, null); + for (Style modifiedStyle : StyleLoader.getDeclaredStyles(lines, styleBuilder)) { + this.muteStyle(modifiedStyle); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } } public static SkinParam create(UmlDiagramType type) { @@ -179,18 +259,21 @@ private static String replaceSmart(String s, String src, String target) { return s.replaceAll(src, target); } - public HtmlColor getHyperlinkColor() { - final HtmlColor result = getHtmlColor(ColorParam.hyperlink, null, false); + public HColor getHyperlinkColor() { + final HColor result = getHtmlColor(ColorParam.hyperlink, null, false); if (result == null) { - return HtmlColorUtils.BLUE; + return HColorUtils.BLUE; } return result; } - public HtmlColor getBackgroundColor() { - final HtmlColor result = getHtmlColor(ColorParam.background, null, false); + public HColor getBackgroundColor(boolean replaceTransparentByWhite) { + final HColor result = getHtmlColor(ColorParam.background, null, false); if (result == null) { - return HtmlColorUtils.WHITE; + return HColorUtils.WHITE; + } + if (replaceTransparentByWhite && HColorUtils.transparent().equals(result)) { + return HColorUtils.WHITE; } return result; } @@ -220,7 +303,7 @@ static String humanName(String key) { return sb.toString(); } - public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { + public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { if (stereotype != null) { checkStereotype(stereotype); for (String s : stereotype.getMultipleLabels()) { @@ -234,9 +317,17 @@ public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean c if (value == null) { return null; } - final boolean acceptTransparent = param == ColorParam.background - || param == ColorParam.sequenceGroupBodyBackground || param == ColorParam.sequenceBoxBackground; - return getIHtmlColorSet().getColorIfValid(value, acceptTransparent); + if ((param == ColorParam.background || param == ColorParam.arrowHead) + && (value.equalsIgnoreCase("transparent") || value.equalsIgnoreCase("none"))) { + return HColorUtils.transparent(); + } + if (param == ColorParam.background) { + return getIHtmlColorSet().getColorIfValid(value); + } + assert param != ColorParam.background; +// final boolean acceptTransparent = param == ColorParam.background +// || param == ColorParam.sequenceGroupBodyBackground || param == ColorParam.sequenceBoxBackground; + return getIHtmlColorSet().getColorIfValid(value, getBackgroundColor(false)); } public char getCircledCharacter(Stereotype stereotype) { @@ -276,7 +367,8 @@ private String getParamName(ColorParam param, boolean clickable) { } private void checkStereotype(Stereotype stereotype) { - // if (stereotype.startsWith("<<") == false || stereotype.endsWith(">>") == false) { + // if (stereotype.startsWith("<<") == false || stereotype.endsWith(">>") == + // false) { // throw new IllegalArgumentException(); // } } @@ -323,7 +415,7 @@ private String getFontFamily(Stereotype stereotype, FontParam... param) { return param[0].getDefaultFamily(); } - public HtmlColor getFontHtmlColor(Stereotype stereotype, FontParam... param) { + public HColor getFontHtmlColor(Stereotype stereotype, FontParam... param) { String value = null; if (stereotype != null) { checkStereotype(stereotype); @@ -608,6 +700,9 @@ public ColorMapper getColorMapper() { if (value == null) { return new ColorMapperIdentity(); } + if ("dark".equalsIgnoreCase(value)) { + return new ColorMapperLightnessInverse(); + } final ColorOrder order = ColorOrder.fromString(value); if (order == null) { return new ColorMapperIdentity(); @@ -680,17 +775,12 @@ public boolean shadowing2(Stereotype stereotype, SkinParameter skinParameter) { return true; } - public PackageStyle getPackageStyle() { - final String value = getValue("packageStyle"); - final PackageStyle p = PackageStyle.fromString(value); - if (p == null) { - return PackageStyle.FOLDER; - } - return p; - } - private final Map sprites = new HashMap(); + public Collection getAllSpriteNames() { + return Collections.unmodifiableCollection(new TreeSet(sprites.keySet())); + } + public void addSprite(String name, Sprite sprite) { sprites.put(name, sprite); } @@ -703,12 +793,27 @@ public Sprite getSprite(String name) { return result; } - public boolean useUml2ForComponent() { + public PackageStyle packageStyle() { + final String value = getValue("packageStyle"); + final PackageStyle p = PackageStyle.fromString(value); + if (p == null) { + return PackageStyle.FOLDER; + } + return p; + } + + public ComponentStyle componentStyle() { if (strictUmlStyle()) { - return true; + return ComponentStyle.UML2; } final String value = getValue("componentstyle"); - return "uml2".equalsIgnoreCase(value); + if ("uml1".equalsIgnoreCase(value)) + return ComponentStyle.UML1; + if ("uml2".equalsIgnoreCase(value)) + return ComponentStyle.UML2; + if ("rectangle".equalsIgnoreCase(value)) + return ComponentStyle.RECTANGLE; + return ComponentStyle.UML2; } public boolean stereotypePositionTop() { @@ -796,14 +901,14 @@ public UStroke getThickness(LineParam param, Stereotype stereotype) { if (stereotype != null) { checkStereotype(stereotype); - final String styleValue = getValue(param.name() + "style" - + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); + final String styleValue = getValue( + param.name() + "style" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); if (styleValue != null) { style = LinkStyle.fromString2(styleValue); } - final String value2 = getValue(param.name() + "thickness" - + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); + final String value2 = getValue( + param.name() + "thickness" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); if (value2 != null && value2.matches("[\\d.]+")) { if (style == null) { style = LinkStyle.NORMAL(); @@ -920,9 +1025,9 @@ public boolean useOctagonForActivity(Stereotype stereotype) { return false; } - private final IHtmlColorSet htmlColorSet = new HtmlColorSetSimple(); + private final HColorSet htmlColorSet = HColorSet.instance(); - public IHtmlColorSet getIHtmlColorSet() { + public HColorSet getIHtmlColorSet() { return htmlColorSet; } @@ -967,10 +1072,18 @@ public String getSvgLinkTarget() { return value; } + public String getPreserveAspectRatio() { + final String value = getValue("preserveaspectratio"); + if (value == null) { + return "none"; + } + return value; + } + public String getMonospacedFamily() { final String value = getValue("defaultMonospacedFontName"); if (value == null) { - return CommandCreoleMonospaced.MONOSPACED; + return Parser.MONOSPACED; } return value; } @@ -1028,12 +1141,12 @@ public UmlDiagramType getUmlDiagramType() { return type; } - public HtmlColor getHoverPathColor() { + public HColor hoverPathColor() { final String value = getValue("pathhovercolor"); if (value == null) { return null; } - return getIHtmlColorSet().getColorIfValid(value, false); + return getIHtmlColorSet().getColorIfValid(value, null); } public double getPadding() { @@ -1103,7 +1216,7 @@ public boolean isUseVizJs() { return useVizJs; } - public Padder getSequenceDiagramPadder() { + public Padder sequenceDiagramPadder() { final double padding = getAsDouble("SequenceMessagePadding"); final double margin = getAsDouble("SequenceMessageMargin"); final String borderColor = getValue("SequenceMessageBorderColor"); @@ -1111,29 +1224,19 @@ public Padder getSequenceDiagramPadder() { if (padding == 0 && margin == 0 && borderColor == null && backgroundColor == null) { return Padder.NONE; } - final HtmlColor border = getIHtmlColorSet().getColorIfValid(borderColor); - final HtmlColor background = getIHtmlColorSet().getColorIfValid(backgroundColor); + final HColor border = getIHtmlColorSet().getColorIfValid(borderColor); + final HColor background = getIHtmlColorSet().getColorIfValid(backgroundColor); final double roundCorner = getRoundCorner(CornerParam.DEFAULT, null); return Padder.NONE.withMargin(margin).withPadding(padding).withBackgroundColor(background) .withBorderColor(border).withRoundCorner(roundCorner); } - private StyleBuilder styleBuilder; - - public StyleBuilder getCurrentStyleBuilder() { - if (styleBuilder == null && SkinParam.USE_STYLES()) { - try { - this.styleBuilder = StyleLoader.mainStyle(this); - } catch (IOException e) { - e.printStackTrace(); - } + public ActorStyle actorStyle() { + final String value = getValue("actorstyle"); + if ("awesome".equalsIgnoreCase(value)) { + return ActorStyle.AWESOME; } - return styleBuilder; + return ActorStyle.STICKMAN; } - public void muteStyle(Style modifiedStyle) { - if (SkinParam.USE_STYLES()) { - styleBuilder = getCurrentStyleBuilder().muteStyle(modifiedStyle); - } - } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamBackcolored.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamBackcolored.java index edb3dede1..2de0ab2c9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamBackcolored.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamBackcolored.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,23 +34,23 @@ import java.util.Map; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SkinParamBackcolored extends SkinParamDelegator { - final private HtmlColor backColorElement; - final private HtmlColor backColorGeneral; + final private HColor backColorElement; + final private HColor backColorGeneral; final private boolean forceClickage; - public SkinParamBackcolored(ISkinParam skinParam, HtmlColor backColorElement) { + public SkinParamBackcolored(ISkinParam skinParam, HColor backColorElement) { this(skinParam, backColorElement, null, false); } - public SkinParamBackcolored(ISkinParam skinParam, HtmlColor backColorElement, boolean forceClickage) { + public SkinParamBackcolored(ISkinParam skinParam, HColor backColorElement, boolean forceClickage) { this(skinParam, backColorElement, null, forceClickage); } - public SkinParamBackcolored(ISkinParam skinParam, HtmlColor backColorElement, HtmlColor backColorGeneral) { + public SkinParamBackcolored(ISkinParam skinParam, HColor backColorElement, HColor backColorGeneral) { this(skinParam, backColorElement, backColorGeneral, false); } @@ -59,7 +59,7 @@ public String toString() { return super.toString() + " " + backColorElement + " " + backColorGeneral; } - public SkinParamBackcolored(ISkinParam skinParam, HtmlColor backColorElement, HtmlColor backColorGeneral, + public SkinParamBackcolored(ISkinParam skinParam, HColor backColorElement, HColor backColorGeneral, boolean forceClickage) { super(skinParam); this.forceClickage = forceClickage; @@ -68,35 +68,35 @@ public SkinParamBackcolored(ISkinParam skinParam, HtmlColor backColorElement, Ht } @Override - public HtmlColor getBackgroundColor() { + public HColor getBackgroundColor(boolean replaceTransparentByWhite) { if (backColorGeneral != null) { return backColorGeneral; } - return super.getBackgroundColor(); + return super.getBackgroundColor(replaceTransparentByWhite); } @Override - public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { + public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { if (param.isBackground() && backColorElement != null) { return backColorElement; } if (forceClickage) { - final HtmlColor c1 = super.getHtmlColor(param, stereotype, true); + final HColor c1 = super.getHtmlColor(param, stereotype, true); if (c1 != null) { return c1; } // clickable = true; } - final HtmlColor forcedColor = forced.get(param); + final HColor forcedColor = forced.get(param); if (forcedColor != null) { return forcedColor; } return super.getHtmlColor(param, stereotype, clickable); } - private final Map forced = new EnumMap(ColorParam.class); + private final Map forced = new EnumMap(ColorParam.class); - public void forceColor(ColorParam param, HtmlColor color) { + public void forceColor(ColorParam param, HColor color) { forced.put(param, color); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamBackcoloredReference.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamBackcoloredReference.java index e8496ae5d..9bc6ef574 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamBackcoloredReference.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamBackcoloredReference.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,22 +31,22 @@ package net.sourceforge.plantuml; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SkinParamBackcoloredReference extends SkinParamDelegator { - final private HtmlColor sequenceReferenceHeaderBackground; - final private HtmlColor sequenceReferenceBackground; + final private HColor sequenceReferenceHeaderBackground; + final private HColor sequenceReferenceBackground; - public SkinParamBackcoloredReference(ISkinParam skinParam, HtmlColor sequenceReferenceHeaderBackground, - HtmlColor sequenceReferenceBackground) { + public SkinParamBackcoloredReference(ISkinParam skinParam, HColor sequenceReferenceHeaderBackground, + HColor sequenceReferenceBackground) { super(skinParam); this.sequenceReferenceBackground = sequenceReferenceBackground; this.sequenceReferenceHeaderBackground = sequenceReferenceHeaderBackground; } @Override - public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { + public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { if (param == ColorParam.sequenceReferenceHeaderBackground && sequenceReferenceHeaderBackground != null) { return sequenceReferenceHeaderBackground; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamColors.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamColors.java index 89ea5091a..63360d77b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamColors.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamColors.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,12 +31,16 @@ package net.sourceforge.plantuml; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SkinParamColors extends SkinParamDelegator { + public final Colors getColors() { + return colors; + } + final private Colors colors; public SkinParamColors(ISkinParam skinParam, Colors colors) { @@ -58,8 +62,8 @@ public boolean shadowing(Stereotype stereotype) { } @Override - public HtmlColor getFontHtmlColor(Stereotype stereotype, FontParam... param) { - final HtmlColor value = colors.getColor(ColorType.TEXT); + public HColor getFontHtmlColor(Stereotype stereotype, FontParam... param) { + final HColor value = colors.getColor(ColorType.TEXT); if (value == null) { return super.getFontHtmlColor(stereotype, param); } @@ -67,12 +71,12 @@ public HtmlColor getFontHtmlColor(Stereotype stereotype, FontParam... param) { } @Override - public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { + public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { final ColorType type = param.getColorType(); if (type == null) { return super.getHtmlColor(param, stereotype, clickable); } - final HtmlColor value = colors.getColor(type); + final HColor value = colors.getColor(type); if (value != null) { return value; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamDelegator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamDelegator.java index ffe21dfd9..52a1b3fb1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamDelegator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamDelegator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,27 +30,29 @@ */ package net.sourceforge.plantuml; +import java.util.Collection; import java.util.Map; import net.sourceforge.plantuml.cucadiagram.Rankdir; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.DotSplines; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.skin.ActorStyle; import net.sourceforge.plantuml.skin.ArrowDirection; import net.sourceforge.plantuml.skin.Padder; +import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.svek.ConditionEndStyle; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.PackageStyle; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UStroke; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class SkinParamDelegator implements ISkinParam { @@ -60,12 +62,12 @@ public SkinParamDelegator(ISkinParam skinParam) { this.skinParam = skinParam; } - public HtmlColor getHyperlinkColor() { + public HColor getHyperlinkColor() { return skinParam.getHyperlinkColor(); } - public HtmlColor getBackgroundColor() { - return skinParam.getBackgroundColor(); + public HColor getBackgroundColor(boolean replaceTransparentByWhite) { + return skinParam.getBackgroundColor(replaceTransparentByWhite); } public int getCircledCharacterRadius() { @@ -76,11 +78,11 @@ public UFont getFont(Stereotype stereotype, boolean inPackageTitle, FontParam... return skinParam.getFont(stereotype, false, fontParam); } - public HtmlColor getFontHtmlColor(Stereotype stereotype, FontParam... param) { + public HColor getFontHtmlColor(Stereotype stereotype, FontParam... param) { return skinParam.getFontHtmlColor(stereotype, param); } - public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { + public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { return skinParam.getHtmlColor(param, stereotype, clickable); } @@ -117,16 +119,16 @@ public boolean shadowing2(Stereotype stereotype, SkinParameter skinParameter) { return skinParam.shadowing2(stereotype, skinParameter); } - public PackageStyle getPackageStyle() { - return skinParam.getPackageStyle(); + public PackageStyle packageStyle() { + return skinParam.packageStyle(); } public Sprite getSprite(String name) { return skinParam.getSprite(name); } - public boolean useUml2ForComponent() { - return skinParam.useUml2ForComponent(); + public ComponentStyle componentStyle() { + return skinParam.componentStyle(); } public boolean stereotypePositionTop() { @@ -197,7 +199,7 @@ public boolean useOctagonForActivity(Stereotype stereotype) { return skinParam.useOctagonForActivity(stereotype); } - public IHtmlColorSet getIHtmlColorSet() { + public HColorSet getIHtmlColorSet() { return skinParam.getIHtmlColorSet(); } @@ -229,6 +231,10 @@ public String getSvgLinkTarget() { return skinParam.getSvgLinkTarget(); } + public String getPreserveAspectRatio() { + return skinParam.getPreserveAspectRatio(); + } + public String getMonospacedFamily() { return skinParam.getMonospacedFamily(); } @@ -265,8 +271,8 @@ public UmlDiagramType getUmlDiagramType() { return skinParam.getUmlDiagramType(); } - public HtmlColor getHoverPathColor() { - return skinParam.getHoverPathColor(); + public HColor hoverPathColor() { + return skinParam.hoverPathColor(); } public double getPadding(PaddingParam param) { @@ -325,8 +331,8 @@ public HorizontalAlignment getStereotypeAlignment() { return skinParam.getStereotypeAlignment(); } - public Padder getSequenceDiagramPadder() { - return skinParam.getSequenceDiagramPadder(); + public Padder sequenceDiagramPadder() { + return skinParam.sequenceDiagramPadder(); } public StyleBuilder getCurrentStyleBuilder() { @@ -337,4 +343,20 @@ public void muteStyle(Style modifiedStyle) { skinParam.muteStyle(modifiedStyle); } + public Collection getAllSpriteNames() { + return skinParam.getAllSpriteNames(); + } + + public String getDefaultSkin() { + return skinParam.getDefaultSkin(); + } + + public void setDefaultSkin(String newFileName) { + skinParam.setDefaultSkin(newFileName); + } + + public ActorStyle actorStyle() { + return skinParam.actorStyle(); + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamForceColor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamForceColor.java index 9d84b3d85..637175c54 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamForceColor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamForceColor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,21 +31,21 @@ package net.sourceforge.plantuml; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SkinParamForceColor extends SkinParamDelegator { final private ColorParam colorParam;; - final private HtmlColor color; + final private HColor color; - public SkinParamForceColor(ISkinParam skinParam, ColorParam colorParam, HtmlColor color) { + public SkinParamForceColor(ISkinParam skinParam, ColorParam colorParam, HColor color) { super(skinParam); this.color = color; this.colorParam = colorParam; } @Override - public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { + public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { if (colorParam == param) { return color; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamForecolored.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamForecolored.java index 72a5ba806..f6fc004c8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamForecolored.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamForecolored.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,19 +31,19 @@ package net.sourceforge.plantuml; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SkinParamForecolored extends SkinParamDelegator { - final private HtmlColor forecolor; + final private HColor forecolor; - public SkinParamForecolored(ISkinParam skinParam, HtmlColor forecolor) { + public SkinParamForecolored(ISkinParam skinParam, HColor forecolor) { super(skinParam); this.forecolor = forecolor; } @Override - public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { + public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { return forecolor; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamSameClassWidth.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamSameClassWidth.java index e68f02a55..02e769ed2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamSameClassWidth.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamSameClassWidth.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamUtils.java index 8d0c03580..f4d759aa9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SkinParamUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,9 +31,9 @@ package net.sourceforge.plantuml; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SkinParamUtils { @@ -43,11 +43,11 @@ public static UFont getFont(ISkinParam skinParam, FontParam fontParam, Stereotyp return skinParam.getFont(stereo, false, fontParam); } - public static HtmlColor getFontColor(ISkinParam skinParam, FontParam fontParam, Stereotype stereo) { + public static HColor getFontColor(ISkinParam skinParam, FontParam fontParam, Stereotype stereo) { return skinParam.getFontHtmlColor(stereo, fontParam); } - public static HtmlColor getColor(ISkinParam skinParam, Stereotype stereo, ColorParam... colorParam) { + public static HColor getColor(ISkinParam skinParam, Stereotype stereo, ColorParam... colorParam) { return rose.getHtmlColor(skinParam, stereo, colorParam); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReader.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReader.java index 2b40f89a6..b29d77523 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReader.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReader.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,12 +31,15 @@ package net.sourceforge.plantuml; import java.io.File; +import java.io.FileNotFoundException; import java.io.IOException; +import java.io.Reader; import java.util.Collections; import java.util.List; import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.FileWithSuffix; +import net.sourceforge.plantuml.security.SFile; public class SourceFileReader extends SourceFileReaderAbstract implements ISourceFileReader { @@ -45,44 +48,45 @@ public SourceFileReader(File file) throws IOException { } public SourceFileReader(File file, File outputDirectory, String charset) throws IOException { - this(Defines.createWithFileName(file), file, outputDirectory, Collections. emptyList(), charset, + this(Defines.createWithFileName(file), file, outputDirectory, Collections.emptyList(), charset, new FileFormatOption(FileFormat.PNG)); } public SourceFileReader(final File file, File outputDirectory) throws IOException { - this(Defines.createWithFileName(file), file, outputDirectory, Collections. emptyList(), null, + this(Defines.createWithFileName(file), file, outputDirectory, Collections.emptyList(), null, new FileFormatOption(FileFormat.PNG)); } public SourceFileReader(final File file, File outputDirectory, FileFormatOption fileFormatOption) throws IOException { - this(Defines.createWithFileName(file), file, outputDirectory, Collections. emptyList(), null, + this(Defines.createWithFileName(file), file, outputDirectory, Collections.emptyList(), null, fileFormatOption); } - public SourceFileReader(Defines defines, final File file, File outputDirectory, List config, - String charset, FileFormatOption fileFormatOption) throws IOException { + public SourceFileReader(Defines defines, final File file, File outputDirectory, List config, String charset, + FileFormatOption fileFormatOption) throws IOException { this.file = file; this.fileFormatOption = fileFormatOption; if (file.exists() == false) { throw new IllegalArgumentException(); } - FileSystem.getInstance().setCurrentDir(file.getAbsoluteFile().getParentFile()); + FileSystem.getInstance().setCurrentDir(SFile.fromFile(file.getAbsoluteFile().getParentFile())); if (outputDirectory == null) { outputDirectory = file.getAbsoluteFile().getParentFile(); } else if (outputDirectory.isAbsolute() == false) { - outputDirectory = FileSystem.getInstance().getFile(outputDirectory.getPath()); + outputDirectory = FileSystem.getInstance().getFile(outputDirectory.getPath()).conv(); } if (outputDirectory.exists() == false) { outputDirectory.mkdirs(); } this.outputDirectory = outputDirectory; - builder = new BlockUmlBuilder(config, charset, defines, getReader(charset), file.getAbsoluteFile() - .getParentFile(), FileWithSuffix.getFileName(file)); + final Reader reader = getReader(charset); + builder = new BlockUmlBuilder(config, charset, defines, reader, + SFile.fromFile(file.getAbsoluteFile().getParentFile()), FileWithSuffix.getFileName(file)); } - private File getDirIfDirectory(String newName) { + private File getDirIfDirectory(String newName) throws FileNotFoundException { Log.info("Checking=" + newName); if (endsWithSlashOrAntislash(newName)) { Log.info("It ends with / so it looks like a directory"); @@ -130,7 +134,7 @@ private File getDirIfDirectory(String newName) { } @Override - protected SuggestedFile getSuggestedFile(BlockUml blockUml) { + protected SuggestedFile getSuggestedFile(BlockUml blockUml) throws FileNotFoundException { final String newName = blockUml.getFileOrDirname(); SuggestedFile suggested = null; if (newName != null) { @@ -155,5 +159,4 @@ protected SuggestedFile getSuggestedFile(BlockUml blockUml) { return suggested; } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReaderAbstract.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReaderAbstract.java index d7e847c3d..25f75c686 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReaderAbstract.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReaderAbstract.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,11 +30,10 @@ */ package net.sourceforge.plantuml; -import java.io.BufferedOutputStream; +import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; @@ -49,6 +48,8 @@ import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.error.PSystemError; import net.sourceforge.plantuml.preproc.FileWithSuffix; +import net.sourceforge.plantuml.security.SFile; +import net.sourceforge.plantuml.security.SecurityUtils; public abstract class SourceFileReaderAbstract { @@ -80,10 +81,10 @@ public List getBlocks() { protected Reader getReader(String charset) throws FileNotFoundException, UnsupportedEncodingException { if (charset == null) { Log.info("Using default charset"); - return new InputStreamReader(new FileInputStream(file)); + return new InputStreamReader(new BufferedInputStream(new FileInputStream(file))); } Log.info("Using charset " + charset); - return new InputStreamReader(new FileInputStream(file), charset); + return new InputStreamReader(new BufferedInputStream(new FileInputStream(file)), charset); } public final Set getIncludedFiles() { @@ -98,11 +99,11 @@ protected boolean endsWithSlashOrAntislash(String newName) { return newName.endsWith("/") || newName.endsWith("\\"); } - private List getCrashedImage(BlockUml blockUml, Throwable t, File outputFile) throws IOException { + private List getCrashedImage(BlockUml blockUml, Throwable t, SFile outputFile) throws IOException { final GeneratedImage image = new GeneratedImageImpl(outputFile, "Crash Error", blockUml, FileImageData.CRASH); OutputStream os = null; try { - os = new BufferedOutputStream(new FileOutputStream(outputFile)); + os = outputFile.createBufferedOutputStream(); UmlDiagram.exportDiagramError(os, t, fileFormatOption, 42, null, blockUml.getFlashData(), UmlDiagram.getFailureText2(t, blockUml.getFlashData())); } finally { @@ -114,13 +115,13 @@ private List getCrashedImage(BlockUml blockUml, Throwable t, Fil return Collections.singletonList(image); } - protected void exportWarnOrErrIfWord(final File f, final Diagram system) throws FileNotFoundException { + protected void exportWarnOrErrIfWord(final SFile f, final Diagram system) throws FileNotFoundException { if (OptionFlags.getInstance().isWord()) { final String warnOrError = system.getWarningOrError(); if (warnOrError != null) { final String name = f.getName().substring(0, f.getName().length() - 4) + ".err"; - final File errorFile = new File(f.getParentFile(), name); - final PrintStream ps = new PrintStream(new FileOutputStream(errorFile)); + final SFile errorFile = f.getParentFile().file(name); + final PrintStream ps = SecurityUtils.createPrintStream(errorFile.createFileOutputStream()); ps.print(warnOrError); ps.close(); } @@ -142,6 +143,7 @@ final public List getGeneratedImages() throws IOException { try { system = blockUml.getDiagram(); } catch (Throwable t) { + t.printStackTrace(); return getCrashedImage(blockUml, t, suggested.getFile(0)); } @@ -149,7 +151,7 @@ final public List getGeneratedImages() throws IOException { continue; } - OptionFlags.getInstance().logData(file, system); + OptionFlags.getInstance().logData(SFile.fromFile(file), system); final List exportDiagrams = PSystemUtils.exportDiagrams(system, suggested, fileFormatOption, checkMetadata); if (exportDiagrams.size() > 1) { @@ -158,7 +160,7 @@ final public List getGeneratedImages() throws IOException { for (FileImageData fdata : exportDiagrams) { final String desc = "[" + file.getName() + "] " + system.getDescription(); - final File f = fdata.getFile(); + final SFile f = fdata.getFile(); exportWarnOrErrIfWord(f, system); final GeneratedImage generatedImage = new GeneratedImageImpl(f, desc, blockUml, fdata.getStatus()); result.add(generatedImage); @@ -171,6 +173,6 @@ final public List getGeneratedImages() throws IOException { return Collections.unmodifiableList(result); } - abstract protected SuggestedFile getSuggestedFile(BlockUml blockUml); + abstract protected SuggestedFile getSuggestedFile(BlockUml blockUml) throws FileNotFoundException; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReaderCopyCat.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReaderCopyCat.java new file mode 100644 index 000000000..b50f733f2 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReaderCopyCat.java @@ -0,0 +1,81 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml; + +import java.io.File; +import java.io.IOException; +import java.util.List; + +import net.sourceforge.plantuml.preproc.Defines; +import net.sourceforge.plantuml.preproc.FileWithSuffix; +import net.sourceforge.plantuml.security.SFile; + +public class SourceFileReaderCopyCat extends SourceFileReaderAbstract implements ISourceFileReader { + + public SourceFileReaderCopyCat(Defines defines, final File file, File outputDirectory, List config, + String charset, FileFormatOption fileFormatOption) throws IOException { + this.file = file; + this.fileFormatOption = fileFormatOption; + if (file.exists() == false) { + throw new IllegalArgumentException(); + } + final String path = file.getParentFile().getPath(); + // System.err.println("SourceFileReaderCopyCat::path=" + path); + // System.err.println("SourceFileReaderCopyCat::outputDirectory=" + + // outputDirectory); + this.outputDirectory = new File(outputDirectory, path).getAbsoluteFile(); + if (outputDirectory.exists() == false) { + outputDirectory.mkdirs(); + } + // System.err.println("SourceFileReaderCopyCat=" + + // this.outputDirectory.getPath() + " " + // + this.outputDirectory.getAbsolutePath()); + builder = new BlockUmlBuilder(config, charset, defines, getReader(charset), + SFile.fromFile(file.getAbsoluteFile().getParentFile()), FileWithSuffix.getFileName(file)); + } + + @Override + protected SuggestedFile getSuggestedFile(BlockUml blockUml) { + final String newName = blockUml.getFileOrDirname(); + SuggestedFile suggested = null; + if (newName == null) { + suggested = SuggestedFile.fromOutputFile(new File(outputDirectory, file.getName()), + fileFormatOption.getFileFormat(), cpt++); + } else { + suggested = SuggestedFile.fromOutputFile(new File(outputDirectory, newName), + fileFormatOption.getFileFormat(), cpt++); + } + // System.err.println("SourceFileReaderCopyCat::suggested=" + suggested); + suggested.getParentFile().mkdirs(); + return suggested; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReader2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReaderHardFile.java similarity index 70% rename from src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReader2.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReaderHardFile.java index 262630e64..6ada973f5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReader2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SourceFileReaderHardFile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,21 +36,23 @@ import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.FileWithSuffix; +import net.sourceforge.plantuml.security.SFile; -public class SourceFileReader2 extends SourceFileReaderAbstract implements ISourceFileReader { +public class SourceFileReaderHardFile extends SourceFileReaderAbstract implements ISourceFileReader { - public SourceFileReader2(Defines defines, final File file, File outputFile, List config, String charset, - FileFormatOption fileFormatOption) throws IOException { + public SourceFileReaderHardFile(Defines defines, final File file, File outputFile, List config, + String charset, FileFormatOption fileFormatOption) throws IOException { this.file = file; this.fileFormatOption = fileFormatOption; this.outputFile = outputFile; if (file.exists() == false) { throw new IllegalArgumentException(); } - FileSystem.getInstance().setCurrentDir(file.getAbsoluteFile().getParentFile()); + FileSystem.getInstance().setCurrentDir(SFile.fromFile(file.getAbsoluteFile().getParentFile())); - builder = new BlockUmlBuilder(config, charset, defines, getReader(charset), file.getAbsoluteFile() - .getParentFile(), FileWithSuffix.getFileName(file)); + final SFile parentFile = SFile.fromFile(file.getAbsoluteFile().getParentFile()); + builder = new BlockUmlBuilder(config, charset, defines, getReader(charset), parentFile, + FileWithSuffix.getFileName(file)); } @Override diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SourceStringReader.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SourceStringReader.java index f201e1014..8f3ecfd76 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SourceStringReader.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SourceStringReader.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,9 +30,6 @@ */ package net.sourceforge.plantuml; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.StringReader; @@ -45,35 +42,40 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.preproc.Defines; +import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class SourceStringReader { final private List blocks; public SourceStringReader(String source) { - this(Defines.createEmpty(), source, Collections. emptyList()); + this(Defines.createEmpty(), source, Collections.emptyList()); } public SourceStringReader(String source, String charset) { - this(Defines.createEmpty(), source, "UTF-8", Collections. emptyList()); + this(Defines.createEmpty(), source, "UTF-8", Collections.emptyList()); } public SourceStringReader(Defines defines, String source, List config) { this(defines, source, "UTF-8", config); } - public SourceStringReader(String source, File newCurrentDir) { - this(Defines.createEmpty(), source, "UTF-8", Collections. emptyList(), newCurrentDir); + public SourceStringReader(Defines defines, String source) { + this(defines, source, "UTF-8", Collections.emptyList()); + } + + public SourceStringReader(String source, SFile newCurrentDir) { + this(Defines.createEmpty(), source, "UTF-8", Collections.emptyList(), newCurrentDir); } public SourceStringReader(Defines defines, String source, String charset, List config) { this(defines, source, charset, config, FileSystem.getInstance().getCurrentDir()); } - public SourceStringReader(Defines defines, String source, String charset, List config, File newCurrentDir) { + public SourceStringReader(Defines defines, String source, String charset, List config, SFile newCurrentDir) { // // WARNING GLOBAL LOCK HERE // synchronized (SourceStringReader.class) { try { @@ -97,12 +99,12 @@ public DiagramDescription outputImage(OutputStream os) throws IOException { } @Deprecated - public String generateImage(File f) throws IOException { + public String generateImage(SFile f) throws IOException { return outputImage(f).getDescription(); } - public DiagramDescription outputImage(File f) throws IOException { - final OutputStream os = new BufferedOutputStream(new FileOutputStream(f)); + public DiagramDescription outputImage(SFile f) throws IOException { + final OutputStream os = f.createBufferedOutputStream(); DiagramDescription result = null; try { result = outputImage(os, 0); @@ -148,7 +150,8 @@ public DiagramDescription outputImage(OutputStream os, int numImage, FileFormatO // final CMapData cmap = new CMapData(); final ImageData imageData = system.exportDiagram(os, numImage, fileFormatOption); // if (imageData.containsCMapData()) { - // return system.getDescription().getDescription() + BackSlash.BS_N + imageData.getCMapData("plantuml"); + // return system.getDescription().getDescription() + BackSlash.BS_N + + // imageData.getCMapData("plantuml"); // } return system.getDescription(); } @@ -167,9 +170,11 @@ public DiagramDescription generateDiagramDescription(int numImage, FileFormatOpt final Diagram system = b.getDiagram(); final int nbInSystem = system.getNbImages(); if (numImage < nbInSystem) { - // final ImageData imageData = system.exportDiagram(os, numImage, fileFormatOption); + // final ImageData imageData = system.exportDiagram(os, numImage, + // fileFormatOption); // if (imageData.containsCMapData()) { - // return system.getDescription().withCMapData(imageData.getCMapData("plantuml")); + // return + // system.getDescription().withCMapData(imageData.getCMapData("plantuml")); // } return system.getDescription(); } @@ -212,10 +217,10 @@ public String getCMapData(int numImage, FileFormatOption fileFormatOption) throw } private void noStartumlFound(OutputStream os, FileFormatOption fileFormatOption, long seed) throws IOException { - final TextBlockBackcolored error = GraphicStrings.createForError(Arrays.asList("No @startuml found"), + final TextBlockBackcolored error = GraphicStrings.createForError(Arrays.asList("No @startuml/@enduml found"), fileFormatOption.isUseRedForError()); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, error.getBackcolor(), null, - null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, null, null, 1.0, + error.getBackcolor()); imageBuilder.setUDrawable(error); imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed, os); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SpecificBackcolorable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SpecificBackcolorable.java index 2fc0adb4e..8ded29e03 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SpecificBackcolorable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SpecificBackcolorable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/Splash.java b/src/plantuml-asl/src/net/sourceforge/plantuml/Splash.java index eb3f16c4b..b78aa785b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/Splash.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/Splash.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -114,7 +114,8 @@ public void mouseMoved(MouseEvent event) { private void updateLinkColor(final Color newLink) { if (link != newLink) { link = newLink; - this.setCursor(link == LINK_NORMAL ? Cursor.getDefaultCursor() : Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + this.setCursor( + link == LINK_NORMAL ? Cursor.getDefaultCursor() : Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); repaint(); } } @@ -131,7 +132,7 @@ public void mousePressed(MouseEvent event) { public void mouseClicked(MouseEvent event) { if (link != LINK_NORMAL) { try { - Desktop.getDesktop().browse(new URL("http://plantuml.com").toURI()); + Desktop.getDesktop().browse(new URL("https://plantuml.com").toURI()); } catch (Exception e) { e.printStackTrace(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SplitParam.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SplitParam.java index e9c718dd8..a2a244fd9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SplitParam.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SplitParam.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,20 +32,20 @@ import java.awt.Color; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; public class SplitParam { - private final HtmlColor borderColor; - private final HtmlColor externalColor; + private final HColor borderColor; + private final HColor externalColor; private final int externalMargin; public SplitParam() { this(null, null, 0); } - public SplitParam(HtmlColor borderColor, HtmlColor externalColor, int externalMargin) { + public SplitParam(HColor borderColor, HColor externalColor, int externalMargin) { if (borderColor != null && externalMargin == 0) { externalMargin = 1; } @@ -66,14 +66,14 @@ public Color getBorderColor() { if (borderColor == null) { return null; } - return ((HtmlColorSimple) borderColor).getColor999(); + return ((HColorSimple) borderColor).getColor999(); } public Color getExternalColor() { if (externalColor == null) { return null; } - return ((HtmlColorSimple) externalColor).getColor999(); + return ((HColorSimple) externalColor).getColor999(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SpriteContainer.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SpriteContainer.java index 9982454c3..2aa3b676b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SpriteContainer.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SpriteContainer.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,7 +30,7 @@ */ package net.sourceforge.plantuml; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; +import net.sourceforge.plantuml.sprite.Sprite; public interface SpriteContainer { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SpriteContainerEmpty.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SpriteContainerEmpty.java index 14b396269..07936b733 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SpriteContainerEmpty.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SpriteContainerEmpty.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,13 +32,12 @@ import java.util.Map; -import net.sourceforge.plantuml.creole.CommandCreoleMonospaced; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; -import net.sourceforge.plantuml.ugraphic.ColorMapper; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; -import net.sourceforge.plantuml.ugraphic.sprite.SpriteImage; +import net.sourceforge.plantuml.creole.Parser; +import net.sourceforge.plantuml.sprite.Sprite; +import net.sourceforge.plantuml.sprite.SpriteImage; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple { @@ -59,15 +58,15 @@ public Guillemet guillemet() { } public String getMonospacedFamily() { - return CommandCreoleMonospaced.MONOSPACED; + return Parser.MONOSPACED; } public int getTabSize() { return 8; } - public IHtmlColorSet getIHtmlColorSet() { - return new HtmlColorSetSimple(); + public HColorSet getIHtmlColorSet() { + return HColorSet.instance(); } public int getDpi() { @@ -81,15 +80,13 @@ public LineBreakStrategy wrapWidth() { public ColorMapper getColorMapper() { return new ColorMapperIdentity(); } - + public void copyAllFrom(ISkinSimple other) { throw new UnsupportedOperationException(); } - + public Map values() { throw new UnsupportedOperationException(); } - - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/Stdrpt.java b/src/plantuml-asl/src/net/sourceforge/plantuml/Stdrpt.java index b9a566738..26480ebbf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/Stdrpt.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/Stdrpt.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/StdrptNull.java b/src/plantuml-asl/src/net/sourceforge/plantuml/StdrptNull.java index 4076f1a1b..f549ef901 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/StdrptNull.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/StdrptNull.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/StdrptPipe0.java b/src/plantuml-asl/src/net/sourceforge/plantuml/StdrptPipe0.java index 45b07ebc5..55805024d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/StdrptPipe0.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/StdrptPipe0.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/StdrptV1.java b/src/plantuml-asl/src/net/sourceforge/plantuml/StdrptV1.java index 8b4adfe96..a2c5b729b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/StdrptV1.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/StdrptV1.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/StringLocated.java b/src/plantuml-asl/src/net/sourceforge/plantuml/StringLocated.java index 08c04ab24..6a02e9b05 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/StringLocated.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/StringLocated.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,6 +31,7 @@ package net.sourceforge.plantuml; import net.sourceforge.plantuml.command.regex.FoxSignature; +import net.sourceforge.plantuml.tim.TLineType; final public class StringLocated { @@ -38,13 +39,28 @@ final public class StringLocated { private final LineLocation location; private final String preprocessorError; + private StringLocated trimmed; + private long fox = -1; + private TLineType type; + public StringLocated(String s, LineLocation location) { this(s, location, null); } @Override public String toString() { - return super.toString() + " " + s; + return s; + } + + public StringLocated append(String endOfLine) { + return new StringLocated(s + endOfLine, location, preprocessorError); + } + + public StringLocated mergeEndBackslash(StringLocated next) { + if (StringUtils.endsWithBackslash(s) == false) { + throw new IllegalArgumentException(); + } + return new StringLocated(s.substring(0, s.length() - 1) + next.s, location, preprocessorError); } public StringLocated(String s, LineLocation location, String preprocessorError) { @@ -60,12 +76,14 @@ public StringLocated withErrorPreprocessor(String preprocessorError) { return new StringLocated(s, location, preprocessorError); } - public StringLocated sub(int start, int end) { + public StringLocated substring(int start, int end) { return new StringLocated(this.getString().substring(start, end), this.getLocation(), this.getPreprocessorError()); } - private StringLocated trimmed; + public StringLocated substring(int start) { + return new StringLocated(this.getString().substring(start), this.getLocation(), this.getPreprocessorError()); + } public StringLocated getTrimmed() { if (trimmed == null) { @@ -76,6 +94,10 @@ public StringLocated getTrimmed() { return trimmed; } +// public StringLocated getTrimmedRight() { +// return new StringLocated(StringUtils.trinEnding(this.getString()), location, preprocessorError); +// } + public StringLocated removeInnerComment() { final String string = s.toString(); final String trim = string.replace('\t', ' ').trim(); @@ -118,12 +140,18 @@ public String getPreprocessorError() { return preprocessorError; } - private long fox = -1; - public long getFoxSignature() { if (fox == -1) { fox = FoxSignature.getFoxSignature(getString()); } return fox; } + + public TLineType getType() { + if (type == null) { + type = TLineType.getFromLineInternal(s); + } + return type; + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/StringUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/StringUtils.java index d5c3506f7..80e373f8a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/StringUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/StringUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,8 +30,6 @@ */ package net.sourceforge.plantuml; -import java.awt.Color; -import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -44,17 +42,10 @@ import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorTransparent; -import net.sourceforge.plantuml.ugraphic.ColorMapper; // Do not move public class StringUtils { - public static String getPlateformDependentAbsolutePath(File file) { - return file.getAbsolutePath(); - } - final static public List getSplit(Pattern2 pattern, String line) { final Matcher2 m = pattern.matcher(line); if (m.find() == false) { @@ -65,7 +56,6 @@ final static public List getSplit(Pattern2 pattern, String line) { result.add(m.group(i)); } return result; - } public static boolean isNotEmpty(String input) { @@ -227,6 +217,9 @@ public static Direction getQueueDirection(String s) { // } public static String eventuallyRemoveStartingAndEndingDoubleQuote(String s, String format) { + if (s == null) { + return null; + } if (format.contains("\"") && s.length() > 1 && isDoubleQuote(s.charAt(0)) && isDoubleQuote(s.charAt(s.length() - 1))) { return s.substring(1, s.length() - 1); @@ -313,28 +306,37 @@ public static int getHeight(Display stringsToDisplay) { } public static boolean isDiagramCacheable(String uml) { - uml = uml.toLowerCase(); - if (uml.startsWith("@startuml\nversion\n")) { - return false; - } - if (uml.startsWith("@startuml\nlicense\n")) { - return false; - } - if (uml.startsWith("@startuml\nlicence\n")) { - return false; - } - if (uml.startsWith("@startuml\nauthor\n")) { - return false; - } - if (uml.startsWith("@startuml\ncheckversion")) { - return false; - } - if (uml.startsWith("@startuml\ntestdot\n")) { - return false; - } - if (uml.startsWith("@startuml\nsudoku\n")) { + if (uml.length() < 35) { return false; } +// uml = uml.toLowerCase(); +// if (uml.startsWith("@startuml\nversion\n")) { +// return false; +// } +// if (uml.startsWith("@startuml\nlicense\n")) { +// return false; +// } +// if (uml.startsWith("@startuml\nlicence\n")) { +// return false; +// } +// if (uml.startsWith("@startuml\nauthor\n")) { +// return false; +// } +// if (uml.startsWith("@startuml\ndonors\n")) { +// return false; +// } +//// if (uml.startsWith("@startuml\ncheckversion")) { +//// return false; +//// } +// if (uml.startsWith("@startuml\ntestdot\n")) { +// return false; +// } +// if (uml.startsWith("@startuml\nsudoku\n")) { +// return false; +// } +// if (uml.startsWith("@startuml\nstdlib\n")) { +// return false; +// } return true; } @@ -357,7 +359,9 @@ public static int getPragmaRevision(String uml) { public static List splitComma(String s) { s = trin(s); - // if (s.matches("([\\p{L}0-9_.]+|[%g][^%g]+[%g])(\\s*,\\s*([\\p{L}0-9_.]+|[%g][^%g]+[%g]))*") == false) { + // if + // (s.matches("([\\p{L}0-9_.]+|[%g][^%g]+[%g])(\\s*,\\s*([\\p{L}0-9_.]+|[%g][^%g]+[%g]))*") + // == false) { // throw new IllegalArgumentException(); // } final List result = new ArrayList(); @@ -369,30 +373,6 @@ public static List splitComma(String s) { return Collections.unmodifiableList(result); } - public static String getAsHtml(Color color) { - if (color == null) { - return null; - } - return getAsHtml(color.getRGB()); - } - - public static String getAsSvg(ColorMapper mapper, HtmlColor color) { - if (color == null) { - return "none"; - } - if (color instanceof HtmlColorTransparent) { - return "#FFFFFF"; - } - return getAsHtml(mapper.getMappedColor(color)); - } - - public static String getAsHtml(int color) { - final int v = 0xFFFFFF & color; - String s = "000000" + Integer.toHexString(v).toUpperCase(); - s = s.substring(s.length() - 6); - return "#" + s; - } - public static String getUid(String uid1, int uid2) { return uid1 + String.format("%04d", uid2); } @@ -463,18 +443,33 @@ public static String trin(String arg) { if (arg.length() == 0) { return arg; } + return trinEndingInternal(arg, getPositionStartNonSpace(arg)); + } + + private static int getPositionStartNonSpace(String arg) { int i = 0; while (i < arg.length() && isSpaceOrTabOrNull(arg.charAt(i))) { i++; } + return i; + } + + private static String trinEnding(String arg) { + if (arg.length() == 0) { + return arg; + } + return trinEndingInternal(arg, 0); + } + + private static String trinEndingInternal(String arg, int from) { int j = arg.length() - 1; - while (j >= i && isSpaceOrTabOrNull(arg.charAt(j))) { + while (j >= from && isSpaceOrTabOrNull(arg.charAt(j))) { j--; } - if (i == 0 && j == arg.length() - 1) { + if (from == 0 && j == arg.length() - 1) { return arg; } - return arg.substring(i, j + 1); + return arg.substring(from, j + 1); } private static boolean isSpaceOrTabOrNull(char c) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SuggestedFile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SuggestedFile.java index 624c4811f..13c0e09c5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SuggestedFile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SuggestedFile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,15 +30,15 @@ */ package net.sourceforge.plantuml; -import java.io.File; +import net.sourceforge.plantuml.security.SFile; public class SuggestedFile { private final FileFormat fileFormat; private final int initialCpt; - private final File outputFile; + private final SFile outputFile; - private SuggestedFile(File outputFile, FileFormat fileFormat, int initialCpt) { + private SuggestedFile(SFile outputFile, FileFormat fileFormat, int initialCpt) { if (outputFile.getName().endsWith(fileFormat.getFileSuffix())) { throw new IllegalArgumentException(); } @@ -53,14 +53,18 @@ public SuggestedFile withPreprocFormat() { @Override public String toString() { - return outputFile.getAbsolutePath() + "[" + initialCpt + "]"; + return outputFile.getPrintablePath() + "[" + initialCpt + "]"; } - public static SuggestedFile fromOutputFile(File outputFile, FileFormat fileFormat) { + public static SuggestedFile fromOutputFile(SFile outputFile, FileFormat fileFormat) { return fromOutputFile(outputFile, fileFormat, 0); } - public File getParentFile() { + public static SuggestedFile fromOutputFile(java.io.File outputFile, FileFormat fileFormat) { + return fromOutputFile(outputFile, fileFormat, 0); + } + + public SFile getParentFile() { return outputFile.getParentFile(); } @@ -68,17 +72,21 @@ public String getName() { return outputFile.getName(); } - public File getFile(int cpt) { + public SFile getFile(int cpt) { final String newName = fileFormat.changeName(outputFile.getName(), initialCpt + cpt); - return new File(outputFile.getParentFile(), newName); + return outputFile.getParentFile().file(newName); } - public static SuggestedFile fromOutputFile(File outputFile, FileFormat fileFormat, int initialCpt) { + public static SuggestedFile fromOutputFile(SFile outputFile, FileFormat fileFormat, int initialCpt) { return new SuggestedFile(outputFile, fileFormat, initialCpt); } - public File getTmpFile() { - return new File(getParentFile(), getName() + ".tmp"); + public static SuggestedFile fromOutputFile(java.io.File outputFile, FileFormat fileFormat, int initialCpt) { + return new SuggestedFile(SFile.fromFile(outputFile), fileFormat, initialCpt); + } + + public SFile getTmpFile() { + return getParentFile().file(getName() + ".tmp"); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/SvgString.java b/src/plantuml-asl/src/net/sourceforge/plantuml/SvgString.java index 47d80a858..b2e6ea4dd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/SvgString.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/SvgString.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,10 +39,17 @@ public class SvgString { private final double scale; public SvgString(String svg, double scale) { + if (svg == null) { + throw new IllegalArgumentException(); + } this.svg = svg; this.scale = scale; } + public String getMD5Hex() { + return SignatureUtils.getMD5Hex(svg); + } + public String getSvg(boolean raw) { String result = svg; if (raw) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/TikzFontDistortion.java b/src/plantuml-asl/src/net/sourceforge/plantuml/TikzFontDistortion.java index 9e0c3dbc9..dbe528e24 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/TikzFontDistortion.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/TikzFontDistortion.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/TitledDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/TitledDiagram.java index 4a83e552f..6dd33f7c7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/TitledDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/TitledDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/UmlDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/UmlDiagram.java index c66f35c7f..ff8fba0c7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/UmlDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/UmlDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,12 +41,10 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.List; -import javax.imageio.ImageIO; import javax.script.ScriptException; import net.sourceforge.plantuml.anim.Animation; @@ -55,7 +53,6 @@ import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.CommandControl; import net.sourceforge.plantuml.command.CommandExecutionResult; -import net.sourceforge.plantuml.command.CommandSkinParam; import net.sourceforge.plantuml.command.CommandSkinParamMultilines; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.ImageData; @@ -67,20 +64,25 @@ import net.sourceforge.plantuml.fun.IconLoader; import net.sourceforge.plantuml.graphic.GraphicPosition; import net.sourceforge.plantuml.graphic.GraphicStrings; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.mjpeg.MJPEGGenerator; import net.sourceforge.plantuml.pdf.PdfConverter; +import net.sourceforge.plantuml.security.ImageIO; +import net.sourceforge.plantuml.security.SFile; +import net.sourceforge.plantuml.security.SecurityUtils; +import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.svek.EmptySvgException; import net.sourceforge.plantuml.svek.GraphvizCrash; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.AffineTransformType; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.version.Version; public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annotated, WithSprite { @@ -179,14 +181,14 @@ public final void setHideUnlinkedData(boolean hideUnlinkedData) { final protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption, long seed) throws IOException { - final HtmlColor hover = getSkinParam().getHoverPathColor(); + final HColor hover = getSkinParam().hoverPathColor(); if (fileFormatOption.getSvgLinkTarget() == null || fileFormatOption.getSvgLinkTarget().equals("_top")) { fileFormatOption = fileFormatOption.withSvgLinkTarget(getSkinParam().getSvgLinkTarget()); } + fileFormatOption = fileFormatOption.withPreserveAspectRatio(getSkinParam().getPreserveAspectRatio()); fileFormatOption = fileFormatOption.withTikzFontDistortion(getSkinParam().getTikzFontDistortion()); if (hover != null) { - fileFormatOption = fileFormatOption.withHoverColor(StringUtils.getAsHtml(getSkinParam().getColorMapper() - .getMappedColor(hover))); + fileFormatOption = fileFormatOption.withHoverColor(getSkinParam().getColorMapper().toRGB(hover)); } if (fileFormatOption.getFileFormat() == FileFormat.PDF) { @@ -203,6 +205,9 @@ final protected ImageData exportDiagramNow(OutputStream os, int index, FileForma } catch (Exception e) { e.printStackTrace(); exportDiagramError(os, e, fileFormatOption, seed, null); + } catch (Error e) { + e.printStackTrace(); + exportDiagramError(os, e, fileFormatOption, seed, null); } return ImageDataSimple.error(); } @@ -223,15 +228,19 @@ public static void exportDiagramError(OutputStream os, Throwable exception, File strings.addAll(CommandExecutionResult.getStackTrace(exception)); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, - metadata, null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, metadata, null, + 1.0, HColorUtils.WHITE); - final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils(); - final BufferedImage im = utils.exportFlashcode(flash, Color.BLACK, Color.WHITE); - if (im != null) { - GraphvizCrash.addDecodeHint(strings); + final BufferedImage im; + if (flash == null) { + im = null; + } else { + final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils(); + im = utils.exportFlashcode(flash, Color.BLACK, Color.WHITE); + if (im != null) { + GraphvizCrash.addDecodeHint(strings); + } } - final TextBlockBackcolored graphicStrings = GraphicStrings.createBlackOnWhite(strings, IconLoader.getRandom(), GraphicPosition.BACKGROUND_CORNER_TOP_RIGHT); @@ -242,8 +251,9 @@ public static void exportDiagramError(OutputStream os, Throwable exception, File public void drawU(UGraphic ug) { graphicStrings.drawU(ug); final double height = graphicStrings.calculateDimension(ug.getStringBounder()).getHeight(); - ug = ug.apply(new UTranslate(0, height)); - ug.draw(new UImage(im).scaleNearestNeighbor(3)); + ug = ug.apply(UTranslate.dy(height)); + ug.draw(new UImage(new PixelImage(im, AffineTransformType.TYPE_NEAREST_NEIGHBOR)) + .scale(3)); } }); } @@ -251,7 +261,7 @@ public void drawU(UGraphic ug) { } private static void exportDiagramErrorText(OutputStream os, Throwable exception, List strings) { - final PrintWriter pw = new PrintWriter(os); + final PrintWriter pw = SecurityUtils.createPrintWriter(os); exception.printStackTrace(pw); pw.println(); pw.println(); @@ -302,7 +312,7 @@ public static List getFailureText2(Throwable exception, String textDiagr } private void exportDiagramInternalMjpeg(OutputStream os) throws IOException { - final File f = new File("c:/test.avi"); + final SFile f = new SFile("c:/test.avi"); final int nb = 150; final double framerate = 30; final MJPEGGenerator m = new MJPEGGenerator(f, 640, 480, framerate, nb); @@ -312,7 +322,8 @@ private void exportDiagramInternalMjpeg(OutputStream os) throws IOException { final double coef = (nb - 1 - i) * 1.0 / nb; at.setToShear(coef, coef); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); - // exportDiagramTOxxBEREMOVED(baos, null, 0, new FileFormatOption(FileFormat.PNG, at)); + // exportDiagramTOxxBEREMOVED(baos, null, 0, new + // FileFormatOption(FileFormat.PNG, at)); baos.close(); final BufferedImage im = ImageIO.read(new ByteArrayInputStream(baos.toByteArray())); m.addImage(im); @@ -324,9 +335,9 @@ private void exportDiagramInternalMjpeg(OutputStream os) throws IOException { private Dimension2D lastInfo; private ImageData exportDiagramInternalPdf(OutputStream os, int index) throws IOException { - final File svg = FileUtils.createTempFile("pdf", ".svf"); - final File pdfFile = FileUtils.createTempFile("pdf", ".pdf"); - final OutputStream fos = new BufferedOutputStream(new FileOutputStream(svg)); + final File svg = FileUtils.createTempFileLegacy("pdf", ".svf"); + final File pdfFile = FileUtils.createTempFileLegacy("pdf", ".pdf"); + final OutputStream fos = new BufferedOutputStream(new FileOutputStream(svg));; final ImageData result = exportDiagram(fos, index, new FileFormatOption(FileFormat.SVG)); fos.close(); PdfConverter.convert(svg, pdfFile); @@ -340,13 +351,13 @@ protected abstract ImageData exportDiagramInternal(OutputStream os, int index, F final protected void exportCmap(SuggestedFile suggestedFile, int index, final ImageData cmapdata) throws FileNotFoundException { final String name = changeName(suggestedFile.getFile(index).getAbsolutePath()); - final File cmapFile = new File(name); + final SFile cmapFile = new SFile(name); PrintWriter pw = null; try { if (PSystemUtils.canFileBeWritten(cmapFile) == false) { return; } - pw = new PrintWriter(cmapFile); + pw = cmapFile.createPrintWriter(); pw.print(cmapdata.getCMapData(cmapFile.getName().substring(0, cmapFile.getName().length() - 6))); pw.close(); } finally { @@ -401,38 +412,41 @@ public boolean isUseJDot() { return useJDot; } - public CommandExecutionResult loadSkin(String filename) throws IOException { - - final String res = "/skin/" + filename + ".skin"; - final InputStream internalIs = UmlDiagram.class.getResourceAsStream(res); - if (internalIs != null) { - final BlocLines lines2 = BlocLines.load(internalIs, new LineLocationImpl(filename, null)); - return loadSkinInternal(lines2); - } - if (OptionFlags.ALLOW_INCLUDE == false) { - return CommandExecutionResult.ok(); - } - final File f = FileSystem.getInstance().getFile(filename + ".skin"); - if (f == null || f.exists() == false || f.canRead() == false) { - return CommandExecutionResult.error("Cannot load skin from " + filename); - } - final BlocLines lines = BlocLines.load(f, new LineLocationImpl(f.getName(), null)); - return loadSkinInternal(lines); - } - - private CommandExecutionResult loadSkinInternal(final BlocLines lines) { - final CommandSkinParam cmd1 = new CommandSkinParam(); - final CommandSkinParamMultilines cmd2 = new CommandSkinParamMultilines(); - for (int i = 0; i < lines.size(); i++) { - final BlocLines ext1 = lines.subList(i, i + 1); - if (cmd1.isValid(ext1) == CommandControl.OK) { - cmd1.execute(this, ext1); - } else if (cmd2.isValid(ext1) == CommandControl.OK_PARTIAL) { - i = tryMultilines(cmd2, i, lines); - } - } + public CommandExecutionResult loadSkin(String newSkin) throws IOException { + getSkinParam().setDefaultSkin(newSkin + ".skin"); return CommandExecutionResult.ok(); - } + // final String res = "/skin/" + filename + ".skin"; + // final InputStream internalIs = UmlDiagram.class.getResourceAsStream(res); + // if (internalIs != null) { + // final BlocLines lines2 = BlocLines.load(internalIs, new + // LineLocationImpl(filename, null)); + // return loadSkinInternal(lines2); + // } + // if (OptionFlags.ALLOW_INCLUDE == false) { + // return CommandExecutionResult.ok(); + // } + // final File f = FileSystem.getInstance().getFile(filename + ".skin"); + // if (f == null || f.exists() == false || f.canRead() == false) { + // return CommandExecutionResult.error("Cannot load skin from " + filename); + // } + // final BlocLines lines = BlocLines.load(f, new LineLocationImpl(f.getName(), + // null)); + // return loadSkinInternal(lines); + } + + // private CommandExecutionResult loadSkinInternal(final BlocLines lines) { + // final CommandSkinParam cmd1 = new CommandSkinParam(); + // final CommandSkinParamMultilines cmd2 = new CommandSkinParamMultilines(); + // for (int i = 0; i < lines.size(); i++) { + // final BlocLines ext1 = lines.subList(i, i + 1); + // if (cmd1.isValid(ext1) == CommandControl.OK) { + // cmd1.execute(this, ext1); + // } else if (cmd2.isValid(ext1) == CommandControl.OK_PARTIAL) { + // i = tryMultilines(cmd2, i, lines); + // } + // } + // return CommandExecutionResult.ok(); + // } private int tryMultilines(CommandSkinParamMultilines cmd2, int i, BlocLines lines) { for (int j = i + 1; j <= lines.size(); j++) { @@ -446,9 +460,8 @@ private int tryMultilines(CommandSkinParamMultilines cmd2, int i, BlocLines line } return i; } - + public void setHideEmptyDescription(boolean hideEmptyDescription) { } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/UmlDiagramType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/UmlDiagramType.java index 8d8aad11f..44e991043 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/UmlDiagramType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/UmlDiagramType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,6 +30,40 @@ */ package net.sourceforge.plantuml; +import net.sourceforge.plantuml.style.SName; + public enum UmlDiagramType { - SEQUENCE, STATE, CLASS, OBJECT, ACTIVITY, DESCRIPTION, COMPOSITE, FLOW, TIMING, BPM, NWDIAG, MINDMAP, WBS, HELP + SEQUENCE, STATE, CLASS, OBJECT, ACTIVITY, DESCRIPTION, COMPOSITE, FLOW, TIMING, BPM, NWDIAG, MINDMAP, WBS, WIRE, + HELP; + + public SName getStyleName() { + if (this == SEQUENCE) { + return SName.sequenceDiagram; + } + if (this == STATE) { + return SName.stateDiagram; + } + if (this == CLASS) { + return SName.classDiagram; + } + if (this == OBJECT) { + return SName.objectDiagram; + } + if (this == ACTIVITY) { + return SName.activityDiagram; + } + if (this == DESCRIPTION) { + return SName.componentDiagram; + } + if (this == COMPOSITE) { + return SName.componentDiagram; + } + if (this == MINDMAP) { + return SName.mindmapDiagram; + } + if (this == WBS) { + return SName.wbsDiagram; + } + return SName.activityDiagram; + } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/Url.java b/src/plantuml-asl/src/net/sourceforge/plantuml/Url.java index 19883358b..d1527db25 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/Url.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/Url.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,8 +33,9 @@ import java.util.Comparator; import net.sourceforge.plantuml.cucadiagram.dot.DotMaker2; +import net.sourceforge.plantuml.project.lang.Complement; -public class Url implements EnsureVisible { +public class Url implements EnsureVisible, Complement { private final String url; private final String tooltip; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/UrlBuilder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/UrlBuilder.java index 94d61ff79..04a578d96 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/UrlBuilder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/UrlBuilder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -67,21 +67,6 @@ public UrlBuilder(String topurl, ModeUrl mode) { this.mode = mode; } -// private static String multilineTooltip(String label) { -// final Pattern2 p = MyPattern.cmpile("(?i)^(" + URL_PATTERN + ")?(.*)$"); -// final Matcher2 m = p.matcher(label); -// if (m.matches() == false) { -// return label; -// } -// String gr1 = m.group(1); -// if (gr1 == null) { -// return label; -// } -// final String gr2 = m.group(m.groupCount()); -// gr1 = gr1.replaceAll("\\\\n", BackSlash.BS_N); -// return gr1 + gr2; -// } - public Url getUrl(String s) { final Pattern2 p; if (mode == ModeUrl.STRICT) { @@ -95,18 +80,18 @@ public Url getUrl(String s) { if (m.matches() == false) { return null; } - // String url = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(m.group(1)); - // if (url.startsWith("http:") == false && url.startsWith("https:") == false) { - // // final String top = getSystem().getSkinParam().getValue("topurl"); - // if (topurl != null) { - // url = topurl + url; - // } - // } final String quotedPart = m.group(1); - final String full = m.group(2); - final int openBracket = full.indexOf('{'); - final int closeBracket = full.lastIndexOf('}'); + final String fullpp = m.group(2).replaceAll("\\{scale=([0-9.]+)\\}", "\uE000scale=$1\uE001"); + + final int openBracket = openBracketBeforeSpace(fullpp); + final int closeBracket; + if (openBracket == -1) { + closeBracket = -1; + } else { + closeBracket = fullpp.lastIndexOf('}'); + } + final String full = fullpp.replace('\uE000', '{').replace('\uE001', '}'); if (quotedPart == null) { if (openBracket != -1 && closeBracket != -1) { return new Url(withTopUrl(full.substring(0, openBracket)), @@ -125,6 +110,27 @@ public Url getUrl(String s) { return new Url(withTopUrl(quotedPart), null, null); } + // private int openBracketBeforeSpace(final String full) { + // return full.indexOf('{'); + // } + + private int openBracketBeforeSpace(final String full) { + // final int firstSpace = full.indexOf(' '); + final int result = full.indexOf('{'); + // if (result != -1 && full.substring(result).startsWith("{scale")) { + // return -1; + // } + // if (firstSpace == -1 || result == -1) { + // return result; + // } + // assert firstSpace >= 0; + // assert result >= 0; + // if (result > firstSpace + 1) { + // return -1; + // } + return result; + } + private String withTopUrl(String url) { if (url.startsWith("http:") == false && url.startsWith("https:") == false && topurl != null) { return topurl + url; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/WithSprite.java b/src/plantuml-asl/src/net/sourceforge/plantuml/WithSprite.java index a08695cf9..845188198 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/WithSprite.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/WithSprite.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,7 +31,7 @@ package net.sourceforge.plantuml; import net.sourceforge.plantuml.core.Diagram; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; +import net.sourceforge.plantuml.sprite.Sprite; public interface WithSprite extends Diagram { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java index a8d1a9705..95f69159f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; import net.sourceforge.plantuml.graphic.USymbol; @@ -56,34 +57,46 @@ public class ActivityDiagram extends CucaDiagram { public ActivityDiagram(ISkinSimple skinParam) { super(skinParam); + setNamespaceSeparator(null); } - public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) { - return getOrCreateLeafDefault(code, type, symbol); + public ILeaf getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) { + checkNotNull(ident); + return getOrCreateLeafDefault(ident, code, type, symbol); } private String getAutoBranch() { return "#" + UniqueSequence.getValue(); } - public IEntity getOrCreate(Code code, Display display, LeafType type) { + public IEntity getOrCreate(Ident idNewLong, Code code, Display display, LeafType type) { final IEntity result; - if (leafExist(code)) { - result = getOrCreateLeafDefault(code, type, null); + final boolean leafExist = this.V1972() ? leafExistSmart(idNewLong) : leafExist(code); + if (leafExist) { + result = getOrCreateLeafDefault(idNewLong, code, type, null); if (result.getLeafType() != type) { - // throw new IllegalArgumentException("Already known: " + code + " " + result.getType() + " " + type); return null; } } else { - result = createLeaf(code, display, type, null); + result = createLeaf(idNewLong, code, display, type, null); } updateLasts(result); return result; } + + @Override + public /*final*/ ILeaf getLeafVerySmart(Ident ident) { + final ILeaf result = super.getLeafVerySmart(ident); + updateLasts(result); + return result; + } + - public void startIf(Code optionalCode) { - final IEntity br = createLeaf(optionalCode == null ? Code.of(getAutoBranch()) : optionalCode, - Display.create(""), LeafType.BRANCH, null); + public void startIf(String optionalCodeString) { + final String idShort = optionalCodeString == null ? getAutoBranch() : optionalCodeString; + final Ident idNewLong = buildLeafIdent(idShort); + final Code code = this.V1972() ? idNewLong : buildCode(idShort); + final IEntity br = createLeaf(idNewLong, code, Display.create(""), LeafType.BRANCH, null); currentContext = new ConditionalContext(currentContext, br, Direction.DOWN); } @@ -92,12 +105,16 @@ public void endif() { } public ILeaf getStart() { - return (ILeaf) getOrCreate(Code.of("start"), Display.getWithNewlines("start"), LeafType.CIRCLE_START); + final Ident ident = buildLeafIdent("start"); + final Code code = this.V1972() ? ident : buildCode("start"); + return (ILeaf) getOrCreate(ident, code, Display.getWithNewlines("start"), LeafType.CIRCLE_START); } public ILeaf getEnd(String suppId) { - final Code code = suppId == null ? Code.of("end") : Code.of("end$" + suppId); - return (ILeaf) getOrCreate(code, Display.getWithNewlines("end"), LeafType.CIRCLE_END); + final String tmp = suppId == null ? "end" : "end$" + suppId; + final Ident ident = buildLeafIdent(tmp); + final Code code = this.V1972() ? ident : buildCode(tmp); + return (ILeaf) getOrCreate(ident, code, Display.getWithNewlines("end"), LeafType.CIRCLE_END); } private void updateLasts(final IEntity result) { @@ -111,14 +128,16 @@ private void updateLasts(final IEntity result) { } @Override - public ILeaf createLeaf(Code code, Display display, LeafType type, USymbol symbol) { - final ILeaf result = super.createLeaf(code, display, type, symbol); + public ILeaf createLeaf(Ident idNewLong, Code code, Display display, LeafType type, USymbol symbol) { + checkNotNull(idNewLong); + final ILeaf result = super.createLeaf(idNewLong, code, display, type, symbol); updateLasts(result); return result; } - public IEntity createNote(Code code, Display display) { - return super.createLeaf(code, display, LeafType.NOTE, null); + public IEntity createNote(Ident idNewLong, Code code, Display display) { + checkNotNull(idNewLong); + return super.createLeaf(idNewLong, code, display, LeafType.NOTE, null); } final protected List getDotStrings() { @@ -154,8 +173,10 @@ public final void setLastEntityConsulted(IEntity lastEntityConsulted) { public IEntity createInnerActivity() { // Log.println("createInnerActivity A"); - final Code code = Code.of("##" + UniqueSequence.getValue()); - gotoGroup2(code, Display.getWithNewlines(code), GroupType.INNER_ACTIVITY, getCurrentGroup(), + final String idShort = "##" + UniqueSequence.getValue(); + final Ident idNewLong = buildLeafIdent(idShort); + final Code code = this.V1972() ? idNewLong : buildCode(idShort); + gotoGroup(idNewLong, code, Display.getWithNewlines(code), GroupType.INNER_ACTIVITY, getCurrentGroup(), NamespaceStrategy.SINGLE); final IEntity g = getCurrentGroup(); // g.setRankdir(Rankdir.LEFT_TO_RIGHT); @@ -172,12 +193,14 @@ public void concurrentActivity(String name) { endGroup(); // Log.println("endgroup"); } + final String idShort = "##" + UniqueSequence.getValue(); // Log.println("concurrentActivity A name=" + name+" "+getCurrentGroup()); - final Code code = Code.of("##" + UniqueSequence.getValue()); + final Code code = buildCode(idShort); if (getCurrentGroup().getGroupType() != GroupType.INNER_ACTIVITY) { throw new IllegalStateException("type=" + getCurrentGroup().getGroupType()); } - gotoGroup2(code, Display.getWithNewlines("code"), GroupType.CONCURRENT_ACTIVITY, getCurrentGroup(), + final Ident idNewLong = buildLeafIdent(idShort); + gotoGroup(idNewLong, code, Display.getWithNewlines("code"), GroupType.CONCURRENT_ACTIVITY, getCurrentGroup(), NamespaceStrategy.SINGLE); lastEntityConsulted = null; lastEntityBrancheConsulted = null; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagramFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagramFactory.java index 4c0d11589..fa02059cd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagramFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagramFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -46,8 +46,8 @@ import net.sourceforge.plantuml.command.CommandFootboxIgnored; import net.sourceforge.plantuml.command.CommandRankDir; import net.sourceforge.plantuml.command.UmlDiagramFactory; -import net.sourceforge.plantuml.command.note.FactoryNoteActivityCommand; -import net.sourceforge.plantuml.command.note.FactoryNoteOnLinkCommand; +import net.sourceforge.plantuml.command.note.CommandFactoryNoteActivity; +import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnLink; public class ActivityDiagramFactory extends UmlDiagramFactory { @@ -74,11 +74,11 @@ protected List createCommands() { cmds.add(new CommandEndPartition()); cmds.add(new CommandLinkLongActivity()); - final FactoryNoteActivityCommand factoryNoteActivityCommand = new FactoryNoteActivityCommand(); + final CommandFactoryNoteActivity factoryNoteActivityCommand = new CommandFactoryNoteActivity(); cmds.add(factoryNoteActivityCommand.createSingleLine()); cmds.add(factoryNoteActivityCommand.createMultiLine(false)); - final FactoryNoteOnLinkCommand factoryNoteOnLinkCommand = new FactoryNoteOnLinkCommand(); + final CommandFactoryNoteOnLink factoryNoteOnLinkCommand = new CommandFactoryNoteOnLink(); cmds.add(factoryNoteOnLinkCommand.createSingleLine()); cmds.add(factoryNoteOnLinkCommand.createMultiLine(false)); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/ConditionalContext.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/ConditionalContext.java index 83989f33c..693b65ec4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/ConditionalContext.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/ConditionalContext.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,6 +41,9 @@ public class ConditionalContext { private final ConditionalContext parent; public ConditionalContext(ConditionalContext parent, IEntity branch, Direction direction) { + if (branch == null) { + throw new IllegalArgumentException("branch is null"); + } if (branch.getLeafType() != LeafType.BRANCH) { throw new IllegalArgumentException(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandElse.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandElse.java index d8a452361..3f0e5c5bf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandElse.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandElse.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandEndPartition.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandEndPartition.java index e7a529b67..53cf87cac 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandEndPartition.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandEndPartition.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandEndif.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandEndif.java index b0b321bdd..87fd20bc1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandEndif.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandEndif.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java index 7862e21f5..b0ad02f8a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.Link; @@ -102,7 +101,7 @@ protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocatio ifCode = null; ifLabel = arg.get("IF2", 0); } - diagram.startIf(Code.of(ifCode)); + diagram.startIf(ifCode); int lenght = 2; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandInnerConcurrent.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandInnerConcurrent.java index e58a85577..2861de63a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandInnerConcurrent.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandInnerConcurrent.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java index a0a7c51cc..8c1451cb4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -51,6 +51,8 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; @@ -177,82 +179,121 @@ protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocatio } - static IEntity getEntity(ActivityDiagram system, RegexResult arg, final boolean start) { + static IEntity getEntity(ActivityDiagram diagram, RegexResult arg, final boolean start) { final String suf = start ? "" : "2"; final String openBracket2 = arg.get("OPENBRACKET" + suf, 0); if (openBracket2 != null) { - return system.createInnerActivity(); + return diagram.createInnerActivity(); } if (arg.get("STAR" + suf, 0) != null) { final String suppId = arg.get("STAR" + suf, 1); if (start) { if (suppId != null) { - system.getStart().setTop(true); + diagram.getStart().setTop(true); } - return system.getStart(); + return diagram.getStart(); } - return system.getEnd(suppId); + return diagram.getEnd(suppId); } String partition = arg.get("PARTITION" + suf, 0); if (partition != null) { partition = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(partition); } - final Code code = Code.of(arg.get("CODE" + suf, 0)); - if (code != null) { + final String idShort = arg.get("CODE" + suf, 0); + if (idShort != null) { if (partition != null) { - system.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, - system.getRootGroup(), NamespaceStrategy.SINGLE); + final Ident idNewLong = diagram.buildLeafIdent(partition); + final Code codeP = diagram.V1972() ? idNewLong : diagram.buildCode(partition); + diagram.gotoGroup(idNewLong, codeP, Display.getWithNewlines(partition), GroupType.PACKAGE, + diagram.getRootGroup(), NamespaceStrategy.SINGLE); } - final IEntity result = system.getOrCreate(code, Display.getWithNewlines(code), - CommandLinkActivity.getTypeIfExisting(system, code)); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); + final LeafType type = diagram.V1972() ? getTypeIfExistingSmart(diagram, ident) : getTypeIfExisting(diagram, + code); + IEntity result; + if (diagram.V1972()) { + result = diagram.getLeafVerySmart(ident); + if (result == null) + result = diagram.getOrCreate(ident, code, Display.getWithNewlines(code), type); + } else + result = diagram.getOrCreate(ident, code, Display.getWithNewlines(code), type); if (partition != null) { - system.endGroup(); + diagram.endGroup(); } return result; } final String bar = arg.get("BAR" + suf, 0); if (bar != null) { - return system.getOrCreate(Code.of(bar), Display.getWithNewlines(bar), LeafType.SYNCHRO_BAR); + final Ident identBar = diagram.buildLeafIdent(bar); + final Code codeBar = diagram.V1972() ? identBar : diagram.buildCode(bar); + if (diagram.V1972()) { + final ILeaf result = diagram.getLeafVerySmart(identBar); + if (result != null) { + return result; + } + } + return diagram.getOrCreate(identBar, codeBar, Display.getWithNewlines(bar), LeafType.SYNCHRO_BAR); } final RegexPartialMatch quoted = arg.get("QUOTED" + suf); if (quoted.get(0) != null) { - final Code quotedCode = Code.of(quoted.get(1) == null ? quoted.get(0) : quoted.get(1)); + final String quotedString = quoted.get(1) == null ? quoted.get(0) : quoted.get(1); if (partition != null) { - system.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, - system.getRootGroup(), NamespaceStrategy.SINGLE); + final Ident idNewLong = diagram.buildLeafIdent(partition); + final Code codeP = diagram.V1972() ? idNewLong : diagram.buildCode(partition); + diagram.gotoGroup(idNewLong, codeP, Display.getWithNewlines(partition), GroupType.PACKAGE, + diagram.getRootGroup(), NamespaceStrategy.SINGLE); } - final IEntity result = system.getOrCreate(quotedCode, Display.getWithNewlines(quoted.get(0)), - CommandLinkActivity.getTypeIfExisting(system, quotedCode)); + final Ident quotedIdent = diagram.buildLeafIdent(quotedString); + final Code quotedCode = diagram.V1972() ? quotedIdent : diagram.buildCode(quotedString); + final LeafType type = diagram.V1972() ? getTypeIfExistingSmart(diagram, quotedIdent) : getTypeIfExisting( + diagram, quotedCode); + final IEntity result = diagram.getOrCreate(quotedIdent, quotedCode, Display.getWithNewlines(quoted.get(0)), + type); if (partition != null) { - system.endGroup(); + diagram.endGroup(); } return result; } - final Code quotedInvisible = Code.of(arg.get("QUOTED_INVISIBLE" + suf, 0)); - if (quotedInvisible != null) { + final String quoteInvisibleString = arg.get("QUOTED_INVISIBLE" + suf, 0); + if (quoteInvisibleString != null) { if (partition != null) { - system.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, - system.getRootGroup(), NamespaceStrategy.SINGLE); + final Ident idNewLong = diagram.buildLeafIdent(partition); + final Code codeP = diagram.V1972() ? idNewLong : diagram.buildCode(partition); + diagram.gotoGroup(idNewLong, codeP, Display.getWithNewlines(partition), GroupType.PACKAGE, + diagram.getRootGroup(), NamespaceStrategy.SINGLE); } - final IEntity result = system.getOrCreate(quotedInvisible, Display.getWithNewlines(quotedInvisible), - LeafType.ACTIVITY); + final Ident identInvisible = diagram.buildLeafIdent(quoteInvisibleString); + final Code quotedInvisible = diagram.V1972() ? identInvisible : diagram.buildCode(quoteInvisibleString); + final IEntity result = diagram.getOrCreate(identInvisible, quotedInvisible, + Display.getWithNewlines(quotedInvisible), LeafType.ACTIVITY); if (partition != null) { - system.endGroup(); + diagram.endGroup(); } return result; } final String first = arg.get("FIRST" + suf, 0); if (first == null) { - return system.getLastEntityConsulted(); + return diagram.getLastEntityConsulted(); } return null; } - static LeafType getTypeIfExisting(ActivityDiagram system, Code code) { + private static LeafType getTypeIfExistingSmart(ActivityDiagram system, Ident ident) { + final IEntity ent = system.getLeafSmart(ident); + if (ent != null) { + if (ent.getLeafType() == LeafType.BRANCH) { + return LeafType.BRANCH; + } + } + return LeafType.ACTIVITY; + } + + private static LeafType getTypeIfExisting(ActivityDiagram system, Code code) { if (system.leafExist(code)) { - final IEntity ent = system.getLeafsget(code); + final IEntity ent = system.getLeaf(code); if (ent.getLeafType() == LeafType.BRANCH) { return LeafType.BRANCH; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java index 58f3c2132..2f9cafd5f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -56,6 +56,7 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; @@ -107,9 +108,10 @@ static IRegex getRegexConcat() { RegexLeaf.end()); } + @Override protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) { - lines = lines.trim(false); - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + lines = lines.trim(); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final IEntity entity1 = CommandLinkActivity.getEntity(diagram, line0, true); if (entity1 == null) { @@ -150,7 +152,7 @@ protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocL } } - final List lineLast = StringUtils.getSplit(MyPattern.cmpile(getPatternEnd()), lines.getLast499() + final List lineLast = StringUtils.getSplit(MyPattern.cmpile(getPatternEnd()), lines.getLast() .getString()); if (StringUtils.isNotEmpty(lineLast.get(0))) { if (sb.length() > 0 && sb.toString().endsWith(BackSlash.BS_BS_N) == false) { @@ -160,7 +162,7 @@ protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocL } final String display = sb.toString(); - final Code code = Code.of(lineLast.get(1) == null ? display : lineLast.get(1)); + final String idShort = lineLast.get(1) == null ? display : lineLast.get(1); String partition = null; if (lineLast.get(3) != null) { @@ -168,10 +170,13 @@ protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocL partition = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(partition); } if (partition != null) { - diagram.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, null, - NamespaceStrategy.SINGLE); + final Ident idNewLong = diagram.buildLeafIdent(partition); + diagram.gotoGroup(idNewLong, diagram.buildCode(partition), Display.getWithNewlines(partition), + GroupType.PACKAGE, null, NamespaceStrategy.SINGLE); } - final IEntity entity2 = diagram.getOrCreate(code, Display.getWithNewlines(display), LeafType.ACTIVITY); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); + final IEntity entity2 = diagram.getOrCreate(ident, code, Display.getWithNewlines(display), LeafType.ACTIVITY); if (entity2 == null) { return CommandExecutionResult.error("No such entity"); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java index 03390be83..7a674b216 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -45,7 +45,9 @@ import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; +import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; @@ -66,7 +68,9 @@ private static IRegex getRegexConcat() { color().getRegex(), // new RegexLeaf("LEGACYCOLORIGNORED", "(#[0-9a-fA-F]{6}|#?\\w+)?")), // RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("\\{?"), + new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("\\{?"), // RegexLeaf.end()); } @@ -76,9 +80,11 @@ private static ColorParser color() { @Override protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) { - final Code code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0))); + final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0)); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); final IGroup currentPackage = diagram.getCurrentGroup(); - diagram.gotoGroup2(code, Display.getWithNewlines(code), GroupType.PACKAGE, currentPackage, + diagram.gotoGroup(ident, code, Display.getWithNewlines(code), GroupType.PACKAGE, currentPackage, NamespaceStrategy.SINGLE); final IEntity p = diagram.getCurrentGroup(); @@ -86,12 +92,10 @@ protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocatio if (colors.isEmpty() == false) { p.setColors(colors); } + if (arg.get("STEREOTYPE", 0) != null) { + p.setStereotype(new Stereotype(arg.get("STEREOTYPE", 0))); + } - // final String color = arg.get("COLOR", 0); - // if (color != null) { - // p.setSpecificColorTOBEREMOVED(ColorType.BACK, - // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color)); - // } return CommandExecutionResult.ok(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java index 633c0b9cb..4ff4bc583 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,16 +40,16 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.Scale; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; -import net.sourceforge.plantuml.activitydiagram3.ftile.SwimlanesC; +import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlanes; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockRecentred; @@ -57,9 +57,11 @@ import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.comp.CompressionMode; -import net.sourceforge.plantuml.ugraphic.comp.TextBlockCompressedOnXorY; +import net.sourceforge.plantuml.ugraphic.comp.CompressionXorYBuilder; public class ActivityDiagram3 extends UmlDiagram { @@ -69,20 +71,19 @@ enum SwimlaneStrategy { private SwimlaneStrategy swimlaneStrategy; - private final SwimlanesC swinlanes = new SwimlanesC(getSkinParam(), getPragma()); - + private final Swimlanes swinlanes = new Swimlanes(getSkinParam(), getPragma()); + public ActivityDiagram3(ISkinSimple skinParam) { super(skinParam); } - private void manageSwimlaneStrategy() { if (swimlaneStrategy == null) { swimlaneStrategy = SwimlaneStrategy.SWIMLANE_FORBIDDEN; } } - public CommandExecutionResult swimlane(String name, HtmlColor color, Display label) { + public CommandExecutionResult swimlane(String name, HColor color, Display label) { if (swimlaneStrategy == null) { swimlaneStrategy = SwimlaneStrategy.SWIMLANE_ALLOWED; } @@ -118,8 +119,9 @@ public void addActivity(Display activity, BoxStyle style, Url url, Colors colors } } - public void addSpot(String spot) { - final InstructionSpot ins = new InstructionSpot(spot, nextLinkRenderer(), swinlanes.getCurrentSwimlane()); + public void addSpot(String spot, HColor color) { + final InstructionSpot ins = new InstructionSpot(spot, color, nextLinkRenderer(), + swinlanes.getCurrentSwimlane()); current().add(ins); setNextLinkRendererInternal(LinkRendering.none()); manageSwimlaneStrategy(); @@ -199,22 +201,29 @@ protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormat throws IOException { // BUG42 // COMPRESSION + swinlanes.computeSize(fileFormatOption.getDefaultStringBounder()); TextBlock result = swinlanes; - // result = new TextBlockCompressedOnY(CompressionMode.ON_Y, result); - result = new TextBlockCompressedOnXorY(CompressionMode.ON_X, result); - result = new TextBlockCompressedOnXorY(CompressionMode.ON_Y, result); + + result = CompressionXorYBuilder.build(CompressionMode.ON_X, result, fileFormatOption.getDefaultStringBounder()); + result = CompressionXorYBuilder.build(CompressionMode.ON_Y, result, fileFormatOption.getDefaultStringBounder()); + result = new TextBlockRecentred(result); final ISkinParam skinParam = getSkinParam(); result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder()).addAdd(result); - // final Dimension2D dim = TextBlockUtils.getMinMax(result, fileFormatOption.getDefaultStringBounder()) - // .getDimension(); + final Dimension2D dim = result.getMinMax(fileFormatOption.getDefaultStringBounder()).getDimension(); - final double margin = 10; - final double dpiFactor = getDpiFactor(fileFormatOption, Dimension2DDouble.delta(dim, 2 * margin, 0)); + final ClockwiseTopRightBottomLeft margins; + if (SkinParam.USE_STYLES()) { + margins = ClockwiseTopRightBottomLeft.marginForDocument(skinParam.getCurrentStyleBuilder()); + } else { + margins = ClockwiseTopRightBottomLeft.margin1margin2(10, 10); + } - final ImageBuilder imageBuilder = new ImageBuilder(getSkinParam(), dpiFactor, - fileFormatOption.isWithMetadata() ? getMetadata() : null, getWarningOrError(), margin, margin, - getAnimation()); + final double dpiFactor = getDpiFactor(fileFormatOption, + Dimension2DDouble.delta(dim, margins.getLeft() + margins.getRight(), 0)); + + final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), margins, getAnimation(), + fileFormatOption.isWithMetadata() ? getMetadata() : null, getWarningOrError(), dpiFactor); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed(), os); @@ -233,7 +242,9 @@ private final double getDpiFactor(FileFormatOption fileFormatOption, final Dimen } public void fork() { - final InstructionFork instructionFork = new InstructionFork(current(), nextLinkRenderer(), getSkinParam()); + manageSwimlaneStrategy(); + final InstructionFork instructionFork = new InstructionFork(current(), nextLinkRenderer(), getSkinParam(), + swinlanes.getCurrentSwimlane()); current().add(instructionFork); setNextLinkRendererInternal(LinkRendering.none()); setCurrent(instructionFork); @@ -244,7 +255,7 @@ public CommandExecutionResult forkAgain() { final InstructionFork currentFork = (InstructionFork) current(); currentFork.manageOutRendering(nextLinkRenderer(), false); setNextLinkRendererInternal(LinkRendering.none()); - currentFork.forkAgain(); + currentFork.forkAgain(swinlanes.getCurrentSwimlane()); return CommandExecutionResult.ok(); } return CommandExecutionResult.error("Cannot find fork"); @@ -253,7 +264,7 @@ public CommandExecutionResult forkAgain() { public CommandExecutionResult endFork(ForkStyle forkStyle, String label) { if (current() instanceof InstructionFork) { final InstructionFork currentFork = (InstructionFork) current(); - currentFork.setStyle(forkStyle, label); + currentFork.setStyle(forkStyle, label, swinlanes.getCurrentSwimlane()); currentFork.manageOutRendering(nextLinkRenderer(), true); setNextLinkRendererInternal(LinkRendering.none()); setCurrent(currentFork.getParent()); @@ -263,7 +274,8 @@ public CommandExecutionResult endFork(ForkStyle forkStyle, String label) { } public void split() { - final InstructionSplit instructionSplit = new InstructionSplit(current(), nextLinkRenderer(), swinlanes.getCurrentSwimlane()); + final InstructionSplit instructionSplit = new InstructionSplit(current(), nextLinkRenderer(), + swinlanes.getCurrentSwimlane()); setNextLinkRendererInternal(LinkRendering.none()); current().add(instructionSplit); setCurrent(instructionSplit); @@ -288,10 +300,10 @@ public CommandExecutionResult endSplit() { return CommandExecutionResult.error("Cannot find split"); } - public void startSwitch(Display test, HtmlColor color) { + public void startSwitch(Display test, HColor color) { manageSwimlaneStrategy(); - final InstructionSwitch instructionSwitch = new InstructionSwitch(swinlanes.getCurrentSwimlane(), current(), test, - nextLinkRenderer(), color, getSkinParam()); + final InstructionSwitch instructionSwitch = new InstructionSwitch(swinlanes.getCurrentSwimlane(), current(), + test, nextLinkRenderer(), color, getSkinParam()); current().add(instructionSwitch); setNextLinkRendererInternal(LinkRendering.none()); setCurrent(instructionSwitch); @@ -305,7 +317,7 @@ public CommandExecutionResult switchCase(Display labelCase) { } setNextLinkRendererInternal(LinkRendering.none()); return CommandExecutionResult.ok(); - + } return CommandExecutionResult.error("Cannot find switch"); } @@ -320,16 +332,16 @@ public CommandExecutionResult endSwitch() { return CommandExecutionResult.error("Cannot find switch"); } - public void startIf(Display test, Display whenThen, HtmlColor color, Url url) { + public void startIf(Display test, Display whenThen, HColor color, Url url) { manageSwimlaneStrategy(); - final InstructionIf instructionIf = new InstructionIf(swinlanes.getCurrentSwimlane(), current(), test, - whenThen, nextLinkRenderer(), color, getSkinParam(), url); + final InstructionIf instructionIf = new InstructionIf(swinlanes.getCurrentSwimlane(), current(), test, whenThen, + nextLinkRenderer(), color, getSkinParam(), url); current().add(instructionIf); setNextLinkRendererInternal(LinkRendering.none()); setCurrent(instructionIf); } - public CommandExecutionResult elseIf(Display inlabel, Display test, Display whenThen, HtmlColor color) { + public CommandExecutionResult elseIf(Display inlabel, Display test, Display whenThen, HColor color) { if (current() instanceof InstructionIf) { final boolean ok = ((InstructionIf) current()).elseIf(inlabel, test, whenThen, nextLinkRenderer(), color); if (ok == false) { @@ -364,10 +376,10 @@ public CommandExecutionResult endif() { return CommandExecutionResult.error("Cannot find if"); } - public void startRepeat(HtmlColor color, Display label) { + public void startRepeat(HColor color, Display label, BoxStyle boxStyleIn, Colors colors) { manageSwimlaneStrategy(); final InstructionRepeat instructionRepeat = new InstructionRepeat(swinlanes.getCurrentSwimlane(), current(), - nextLinkRenderer(), color, label); + nextLinkRenderer(), color, label, boxStyleIn, colors); current().add(instructionRepeat); setCurrent(instructionRepeat); setNextLinkRendererInternal(LinkRendering.none()); @@ -389,21 +401,23 @@ public CommandExecutionResult repeatWhile(Display label, Display yes, Display ou } - public CommandExecutionResult backwardWhile(Display label) { + public CommandExecutionResult backwardWhile(Display label, BoxStyle boxStyle) { manageSwimlaneStrategy(); if (current() instanceof InstructionRepeat) { final InstructionRepeat instructionRepeat = (InstructionRepeat) current(); - // final LinkRendering back = new LinkRendering(linkColor).withDisplay(linkLabel); - instructionRepeat.setBackward(label, swinlanes.getCurrentSwimlane()); - // setCurrent(instructionRepeat.getParent()); - // this.setNextLinkRendererInternal(LinkRendering.none()); + instructionRepeat.setBackward(label, swinlanes.getCurrentSwimlane(), boxStyle); + return CommandExecutionResult.ok(); + } + if (current() instanceof InstructionWhile) { + final InstructionWhile instructionWhile = (InstructionWhile) current(); + instructionWhile.setBackward(label, swinlanes.getCurrentSwimlane(), boxStyle); return CommandExecutionResult.ok(); } return CommandExecutionResult.error("Cannot find repeat"); } - public void doWhile(Display test, Display yes, HtmlColor color) { + public void doWhile(Display test, Display yes, HColor color) { manageSwimlaneStrategy(); final InstructionWhile instructionWhile = new InstructionWhile(swinlanes.getCurrentSwimlane(), current(), test, nextLinkRenderer(), yes, color, getSkinParam()); @@ -428,8 +442,8 @@ final public CommandExecutionResult kill() { return CommandExecutionResult.ok(); } - public void startGroup(Display name, HtmlColor backColor, HtmlColor titleColor, HtmlColor borderColor, - USymbol type, double roundCorner) { + public void startGroup(Display name, HColor backColor, HColor titleColor, HColor borderColor, USymbol type, + double roundCorner) { manageSwimlaneStrategy(); final InstructionGroup instructionGroup = new InstructionGroup(current(), name, backColor, titleColor, swinlanes.getCurrentSwimlane(), borderColor, nextLinkRenderer(), type, roundCorner); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java index dea05a96c..a05f4c935 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -106,6 +106,7 @@ protected List createCommands() { cmds.add(new CommandGroupEnd3()); cmds.add(new CommandArrow3()); cmds.add(new CommandArrowLong3()); + cmds.add(new CommandRepeat3()); cmds.add(new CommandActivity3()); cmds.add(new CommandIf4()); cmds.add(new CommandIf2()); @@ -121,7 +122,6 @@ protected List createCommands() { cmds.add(new CommandCase()); cmds.add(new CommandEndSwitch()); - cmds.add(new CommandRepeat3()); cmds.add(new CommandRepeatWhile3()); cmds.add(new CommandRepeatWhile3Multilines()); cmds.add(new CommandBackward3()); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/Branch.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/Branch.java index 4cca9618e..466d1e7bf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/Branch.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/Branch.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,16 +33,22 @@ import java.util.Collection; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleBuilder; +import net.sourceforge.plantuml.style.StyleSignature; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Branch { @@ -50,16 +56,25 @@ public class Branch { private final Display labelTest; private final Display labelPositive; private final Display inlabel; - private final HtmlColor color; + private final HColor color; private LinkRendering inlinkRendering = LinkRendering.none(); private Ftile ftile; + public StyleSignature getDefaultStyleDefinitionArrow() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow); + } + + public StyleSignature getDefaultStyleDefinitionDiamond() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond); + } + public boolean containsBreak() { return list.containsBreak(); } - public Branch(Swimlane swimlane, Display labelPositive, Display labelTest, HtmlColor color, Display inlabel) { + public Branch(StyleBuilder styleBuilder, Swimlane swimlane, Display labelPositive, Display labelTest, + HColor color, Display inlabel) { if (labelPositive == null) { throw new IllegalArgumentException(); } @@ -69,11 +84,18 @@ public Branch(Swimlane swimlane, Display labelPositive, Display labelTest, HtmlC if (inlabel == null) { throw new IllegalArgumentException(); } + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinitionDiamond().getMergedStyle(styleBuilder); + this.color = color == null ? style.value(PName.BackGroundColor).asColor( + styleBuilder.getSkinParam().getIHtmlColorSet()) : color; + } else { + this.color = color; + } + this.inlabel = inlabel; this.list = new InstructionList(swimlane); this.labelTest = labelTest; this.labelPositive = labelPositive; - this.color = color; } public Collection getWeldingPoints() { @@ -135,7 +157,7 @@ public ISkinParam skinParam() { return ftile.skinParam(); } - public final HtmlColor getColor() { + public final HColor getColor() { return color; } @@ -161,5 +183,4 @@ public final LinkRendering getSpecial() { return special; } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ForkStyle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ForkStyle.java index 050fc5b02..bb62791f9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ForkStyle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ForkStyle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/Instruction.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/Instruction.java index 5ffaaf910..1a2b9b4ef 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/Instruction.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/Instruction.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionBreak.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionBreak.java index 93aa4456e..423b1b7d1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionBreak.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionBreak.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionCollection.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionCollection.java index e0297e975..5c7d4c8cf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionCollection.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionCollection.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionEnd.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionEnd.java index 8db58c093..f90eb86f9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionEnd.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionEnd.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionFork.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionFork.java index dc0d2e942..cc1781591 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionFork.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionFork.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,6 +31,7 @@ package net.sourceforge.plantuml.activitydiagram3; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Set; @@ -50,6 +51,8 @@ public class InstructionFork extends WithNote implements Instruction { private final Instruction parent; private final LinkRendering inlinkRendering; private final ISkinParam skinParam; + private final Swimlane swimlaneIn; + private Swimlane swimlaneOut; private ForkStyle style = ForkStyle.FORK; private String label; boolean finished = false; @@ -63,10 +66,12 @@ public boolean containsBreak() { return false; } - public InstructionFork(Instruction parent, LinkRendering inlinkRendering, ISkinParam skinParam) { + public InstructionFork(Instruction parent, LinkRendering inlinkRendering, ISkinParam skinParam, Swimlane swimlane) { this.parent = parent; this.inlinkRendering = inlinkRendering; this.skinParam = skinParam; + this.swimlaneIn = swimlane; + this.swimlaneOut = swimlane; this.forks.add(new InstructionList()); if (inlinkRendering == null) { throw new IllegalArgumentException(); @@ -86,7 +91,7 @@ public Ftile createFtile(FtileFactory factory) { for (InstructionList list : forks) { all.add(list.createFtile(factory)); } - Ftile result = factory.createParallel(getSwimlaneIn(), all, style, label); + Ftile result = factory.createParallel(all, style, label, swimlaneIn, swimlaneOut); if (getPositionedNotes().size() > 0) { result = FtileWithNoteOpale.create(result, getPositionedNotes(), skinParam, false); } @@ -97,7 +102,8 @@ public Instruction getParent() { return parent; } - public void forkAgain() { + public void forkAgain(Swimlane swimlane) { + this.swimlaneOut = swimlane; this.forks.add(new InstructionList()); } @@ -121,17 +127,18 @@ public boolean addNote(Display note, NotePosition position, NoteType type, Color } public Set getSwimlanes() { - return InstructionList.getSwimlanes2(forks); + final Set result = new HashSet(InstructionList.getSwimlanes2(forks)); + result.add(swimlaneIn); + result.add(swimlaneOut); + return result; } public Swimlane getSwimlaneIn() { - // return parent.getSwimlaneOut(); - return forks.get(0).getSwimlaneIn(); + return swimlaneIn; } public Swimlane getSwimlaneOut() { - return forks.get(0).getSwimlaneOut(); - // return getLastList().getSwimlaneOut(); + return swimlaneOut; } public void manageOutRendering(LinkRendering nextLinkRenderer, boolean endFork) { @@ -144,9 +151,10 @@ public void manageOutRendering(LinkRendering nextLinkRenderer, boolean endFork) getLastList().setOutRendering(nextLinkRenderer); } - public void setStyle(ForkStyle style, String label) { + public void setStyle(ForkStyle style, String label, Swimlane swimlane) { this.style = style; this.label = label; + this.swimlaneOut = swimlane; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionGoto.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionGoto.java index f7a64d59f..c682928f1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionGoto.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionGoto.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java index 1539c706d..fcad9fe6a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,19 +38,19 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNotes; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class InstructionGroup implements Instruction, InstructionCollection { private final InstructionList list; private final Instruction parent; - private final HtmlColor backColor; - private final HtmlColor borderColor; - private final HtmlColor titleColor; + private final HColor backColor; + private final HColor borderColor; + private final HColor titleColor; private final LinkRendering linkRendering; private final USymbol type; @@ -62,8 +62,8 @@ public boolean containsBreak() { return list.containsBreak(); } - public InstructionGroup(Instruction parent, Display test, HtmlColor backColor, HtmlColor titleColor, - Swimlane swimlane, HtmlColor borderColor, LinkRendering linkRendering, USymbol type, double roundCorner) { + public InstructionGroup(Instruction parent, Display test, HColor backColor, HColor titleColor, + Swimlane swimlane, HColor borderColor, LinkRendering linkRendering, USymbol type, double roundCorner) { this.list = new InstructionList(swimlane); this.type = type; this.linkRendering = linkRendering; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java index 5227d221f..147e89fa0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -45,10 +45,10 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNoteOpale; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class InstructionIf extends WithNote implements Instruction, InstructionCollection { @@ -79,7 +79,7 @@ public boolean containsBreak() { } public InstructionIf(Swimlane swimlane, Instruction parent, Display labelTest, Display whenThen, - LinkRendering inlinkRendering, HtmlColor color, ISkinParam skinParam, Url url) { + LinkRendering inlinkRendering, HColor color, ISkinParam skinParam, Url url) { this.url = url; this.parent = parent; this.skinParam = skinParam; @@ -88,7 +88,8 @@ public InstructionIf(Swimlane swimlane, Instruction parent, Display labelTest, D throw new IllegalArgumentException(); } this.swimlane = swimlane; - this.thens.add(new Branch(swimlane, whenThen, labelTest, color, Display.NULL)); + this.thens.add(new Branch(skinParam.getCurrentStyleBuilder(), swimlane, whenThen, labelTest, color, + Display.NULL)); this.current = this.thens.get(0); } @@ -101,7 +102,8 @@ public Ftile createFtile(FtileFactory factory) { branch.updateFtile(factory); } if (elseBranch == null) { - this.elseBranch = new Branch(swimlane, Display.NULL, Display.NULL, null, Display.NULL); + this.elseBranch = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, Display.NULL, Display.NULL, + null, Display.NULL); } elseBranch.updateFtile(factory); Ftile result = factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering, url); @@ -128,19 +130,20 @@ public boolean swithToElse2(Display whenElse, LinkRendering nextLinkRenderer) { return false; } this.current.setInlinkRendering(nextLinkRenderer); - this.elseBranch = new Branch(swimlane, whenElse, Display.NULL, null, Display.NULL); + this.elseBranch = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, whenElse, Display.NULL, null, + Display.NULL); this.current = elseBranch; return true; } public boolean elseIf(Display inlabel, Display test, Display whenThen, LinkRendering nextLinkRenderer, - HtmlColor color) { + HColor color) { if (elseBranch != null) { return false; } // this.current.setInlinkRendering(nextLinkRenderer); this.current.setSpecial(nextLinkRenderer); - this.current = new Branch(swimlane, whenThen, test, color, inlabel); + this.current = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, whenThen, test, color, inlabel); this.thens.add(current); return true; @@ -149,7 +152,8 @@ public boolean elseIf(Display inlabel, Display test, Display whenThen, LinkRende public void endif(LinkRendering nextLinkRenderer) { endifCalled = true; if (elseBranch == null) { - this.elseBranch = new Branch(swimlane, Display.NULL, Display.NULL, null, Display.NULL); + this.elseBranch = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, Display.NULL, Display.NULL, + null, Display.NULL); } this.elseBranch.setSpecial(nextLinkRenderer); this.current.setInlinkRendering(nextLinkRenderer); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionLabel.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionLabel.java index 413c207cf..80a056d5a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionLabel.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionLabel.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java index bf9d4d2a8..814cd5236 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionPartition.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionPartition.java index c603404fd..8fbbafd02 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionPartition.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionPartition.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java index 0e9a5320e..216a5f4cf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionRepeat.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,10 +38,10 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class InstructionRepeat implements Instruction { @@ -50,8 +50,9 @@ public class InstructionRepeat implements Instruction { private final LinkRendering nextLinkRenderer; private final Swimlane swimlane; private Swimlane swimlaneOut; - private final HtmlColor color; + private BoxStyle boxStyle; private boolean killed = false; + private final BoxStyle boxStyleIn; private Display backward = Display.NULL; private Display test = Display.NULL; @@ -61,13 +62,15 @@ public class InstructionRepeat implements Instruction { private boolean testCalled = false; private LinkRendering endRepeatLinkRendering = LinkRendering.none(); private LinkRendering backRepeatLinkRendering = LinkRendering.none(); + private final Colors colors; public boolean containsBreak() { return repeatList.containsBreak(); } - public InstructionRepeat(Swimlane swimlane, Instruction parent, LinkRendering nextLinkRenderer, HtmlColor color, - Display startLabel) { + public InstructionRepeat(Swimlane swimlane, Instruction parent, LinkRendering nextLinkRenderer, HColor color, + Display startLabel, BoxStyle boxStyleIn, Colors colors) { + this.boxStyleIn = boxStyleIn; this.startLabel = startLabel; this.parent = parent; this.swimlane = swimlane; @@ -75,7 +78,7 @@ public InstructionRepeat(Swimlane swimlane, Instruction parent, LinkRendering ne if (nextLinkRenderer == null) { throw new IllegalArgumentException(); } - this.color = color; + this.colors = colors; } private boolean isLastOfTheParent() { @@ -85,9 +88,10 @@ private boolean isLastOfTheParent() { return false; } - public void setBackward(Display label, Swimlane swimlaneOut) { + public void setBackward(Display label, Swimlane swimlaneOut, BoxStyle boxStyle) { this.backward = label; this.swimlaneOut = swimlaneOut; + this.boxStyle = boxStyle; } public void add(Instruction ins) { @@ -95,11 +99,11 @@ public void add(Instruction ins) { } public Ftile createFtile(FtileFactory factory) { - final Ftile back = Display.isNull(backward) ? null : factory.activity(backward, swimlane, BoxStyle.PLAIN, - Colors.empty()); - final Ftile result = factory.repeat(swimlane, swimlaneOut, startLabel, - factory.decorateOut(repeatList.createFtile(factory), endRepeatLinkRendering), test, yes, out, color, - backRepeatLinkRendering, back, isLastOfTheParent()); + final Ftile back = Display.isNull(backward) ? null + : factory.activity(backward, swimlane, boxStyle, Colors.empty()); + final Ftile decorateOut = factory.decorateOut(repeatList.createFtile(factory), endRepeatLinkRendering); + final Ftile result = factory.repeat(boxStyleIn, swimlane, swimlaneOut, startLabel, decorateOut, test, yes, out, + colors, backRepeatLinkRendering, back, isLastOfTheParent()); if (killed) { return new FtileKilled(result); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionSimple.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionSimple.java index fccacec84..48d84cf50 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionSimple.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionSimple.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionSplit.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionSplit.java index 29acbf85e..175461e28 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionSplit.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionSplit.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -83,7 +83,7 @@ public Ftile createFtile(FtileFactory factory) { for (InstructionList list : splits) { all.add(list.createFtile(factory)); } - return factory.createParallel(getSwimlaneIn(), all, ForkStyle.SPLIT, null); + return factory.createParallel(all, ForkStyle.SPLIT, null, swimlaneIn, swimlaneOut); } public Instruction getParent() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionSpot.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionSpot.java index 5b7d65ed0..e5b856387 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionSpot.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionSpot.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,28 +34,31 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class InstructionSpot extends MonoSwimable implements Instruction { private boolean killed = false; private final LinkRendering inlinkRendering; private final String spot; + private final HColor color; public boolean containsBreak() { return false; } - public InstructionSpot(String spot, LinkRendering inlinkRendering, Swimlane swimlane) { + public InstructionSpot(String spot, HColor color, LinkRendering inlinkRendering, Swimlane swimlane) { super(swimlane); this.spot = spot; this.inlinkRendering = inlinkRendering; + this.color = color; if (inlinkRendering == null) { throw new IllegalArgumentException(); } } public Ftile createFtile(FtileFactory factory) { - Ftile result = factory.spot(getSwimlaneIn(), spot); + Ftile result = factory.spot(getSwimlaneIn(), spot, color); result = eventuallyAddNote(factory, result, result.getSwimlaneIn()); if (killed) { return new FtileKilled(result); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionStart.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionStart.java index 137dcf3e8..a554abf62 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionStart.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionStart.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionStop.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionStop.java index 0bb0b5528..35f6c6bd4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionStop.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionStop.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionSwitch.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionSwitch.java index ca656adff..72910b350 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionSwitch.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionSwitch.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,7 +41,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class InstructionSwitch extends WithNote implements Instruction, InstructionCollection { @@ -67,7 +67,7 @@ public boolean containsBreak() { } public InstructionSwitch(Swimlane swimlane, Instruction parent, Display labelTest, LinkRendering inlinkRendering, - HtmlColor color, ISkinParam skinParam) { + HColor color, ISkinParam skinParam) { this.topInlinkRendering = inlinkRendering; this.parent = parent; this.skinParam = skinParam; @@ -132,7 +132,7 @@ public Instruction getLast() { } public boolean switchCase(Display labelCase, LinkRendering nextLinkRenderer) { - this.current = new Branch(swimlane, labelCase, labelCase, null, labelCase); + this.current = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, labelCase, labelCase, null, labelCase); this.branches.add(this.current); return true; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java index b6d09adf0..9918b9842 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,23 +33,24 @@ import java.util.Set; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNoteOpale; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class InstructionWhile extends WithNote implements Instruction, InstructionCollection { private final InstructionList repeatList = new InstructionList(); private final Instruction parent; private final LinkRendering nextLinkRenderer; - private final HtmlColor color; + private final HColor color; private boolean killed = false; private final Display test; @@ -68,7 +69,7 @@ public void overwriteYes(Display yes) { } public InstructionWhile(Swimlane swimlane, Instruction parent, Display test, LinkRendering nextLinkRenderer, - Display yes, HtmlColor color, ISkinParam skinParam) { + Display yes, HColor color, ISkinParam skinParam) { if (test == null) { throw new IllegalArgumentException(); } @@ -92,8 +93,10 @@ public void add(Instruction ins) { } public Ftile createFtile(FtileFactory factory) { + final Ftile back = Display.isNull(backward) ? null + : factory.activity(backward, swimlane, boxStyle, Colors.empty()); Ftile tmp = factory.decorateOut(repeatList.createFtile(factory), endInlinkRendering); - tmp = factory.createWhile(swimlane, tmp, test, yes, out, afterEndwhile, color, specialOut); + tmp = factory.createWhile(swimlane, tmp, test, yes, out, afterEndwhile, color, specialOut, back); if (getPositionedNotes().size() > 0) { tmp = FtileWithNoteOpale.create(tmp, getPositionedNotes(), skinParam, false); } @@ -165,4 +168,14 @@ public boolean containsBreak() { return repeatList.containsBreak(); } + private BoxStyle boxStyle; + private Swimlane swimlaneOut; + private Display backward = Display.NULL; + + public void setBackward(Display label, Swimlane swimlaneOut, BoxStyle boxStyle) { + this.backward = label; + this.swimlaneOut = swimlaneOut; + this.boxStyle = boxStyle; + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/LinkRendering.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/LinkRendering.java index b4865244b..496e370f1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/LinkRendering.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/LinkRendering.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/MonoSwimable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/MonoSwimable.java index 91dfa2830..fb87e9139 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/MonoSwimable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/MonoSwimable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/PositionedNote.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/PositionedNote.java index 09f28ba9f..2452b1ff0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/PositionedNote.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/PositionedNote.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/WithNote.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/WithNote.java index 24359e5f3..ada8e00f9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/WithNote.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/WithNote.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java index 14d69d040..631389244 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,6 +30,9 @@ */ package net.sourceforge.plantuml.activitydiagram3.command; +import java.util.regex.Matcher; + +import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; @@ -43,13 +46,33 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; public class CommandActivity3 extends SingleLineCommand2 { - public static final String ENDING_GROUP = "(;|\\\\\\\\|(?}\\]])(?:[/<}\\]])|(?]{1,999})(?)(?:\\>)|(?}\\]])[/<}]" // About /<} + + "|" // + + "(?]{1,999})(?)\\>" // About > + + "|" // + + "(?{2})?"), // + RegexLeaf.spaceZeroOrMore(), // new RegexLeaf(":"), // new RegexLeaf("LABEL", "(.*)"), // - new RegexLeaf("STYLE", ENDING_GROUP), // + new RegexLeaf("STYLE", endingGroup()), // RegexLeaf.end()); } @@ -81,7 +106,12 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati url = urlBuilder.getUrl(arg.get("URL", 0)); } - final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); + Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); + final String stereo = arg.get("STEREO", 0); + if (stereo != null) { + final Stereotype stereotype = new Stereotype(stereo); + colors = colors.applyStereotype(stereotype, diagram.getSkinParam(), ColorParam.activityBackground); + } final BoxStyle style = BoxStyle.fromChar(arg.get("STYLE", 0).charAt(0)); diagram.addActivity(Display.getWithNewlines(arg.get("LABEL", 0)), style, url, colors); return CommandExecutionResult.ok(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java index 8033b84e9..4b2b98b6b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java index e38cac8e5..a648f4017 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -52,7 +52,7 @@ public CommandActivityLong3() { @Override public String getPatternEnd() { - return "^(.*)" + CommandActivity3.ENDING_GROUP + "$"; + return "^(.*)" + CommandActivity3.endingGroup() + "$"; } private static ColorParser color() { @@ -67,13 +67,14 @@ static IRegex getRegexConcat() { RegexLeaf.end()); } + @Override protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) { lines = lines.removeEmptyColumns(); - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet()); // final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)); final BoxStyle style = BoxStyle.fromChar(lines.getLastChar()); - lines = lines.removeStartingAndEnding2(line0.get("DATA", 0)); + lines = lines.removeStartingAndEnding(line0.get("DATA", 0), 1); diagram.addActivity(lines.toDisplay(), style, null, colors); return CommandExecutionResult.ok(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrow3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrow3.java index f504e99fb..ae853f46e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrow3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrow3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java index 7b9ef7454..f85e70542 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -66,18 +66,19 @@ static IRegex getRegexConcat() { RegexLeaf.end()); } + @Override protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) { lines = lines.removeEmptyColumns(); - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); // final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)); - // diagram.setColorNextArrow(HtmlColorAndStyle.fromColor(color)); + // diagram.setColorNextArrow(Rainbow.fromColor(color)); final String colorString = line0.get("COLOR", 0); if (colorString != null) { Rainbow rainbow = Rainbow.build(diagram.getSkinParam(), colorString, diagram.getSkinParam() .colorArrowSeparationSpace()); diagram.setColorNextArrow(rainbow); } - lines = lines.removeStartingAndEnding2(line0.get("LABEL", 0)); + lines = lines.removeStartingAndEnding(line0.get("LABEL", 0), 1); diagram.setLabelNextArrow(lines.toDisplay()); return CommandExecutionResult.ok(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBackward3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBackward3.java index 20b3a517d..e5946554e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBackward3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBackward3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,6 +32,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; +import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.IRegex; @@ -52,14 +53,22 @@ static IRegex getRegexConcat() { RegexLeaf.spaceZeroOrMore(), // new RegexLeaf(":"), // new RegexLeaf("LABEL", "(.*)"), // - new RegexLeaf(";"), // + new RegexLeaf("STYLE", CommandActivity3.endingGroup()), // RegexLeaf.end()); } @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { + final BoxStyle boxStyle; + final String styleString = arg.get("STYLE", 0); + if (styleString == null) { + boxStyle = BoxStyle.PLAIN; + } else { + boxStyle = BoxStyle.fromChar(styleString.charAt(0)); + } + final Display label = Display.getWithNewlines(arg.get("LABEL", 0)); - return diagram.backwardWhile(label); + return diagram.backwardWhile(label, boxStyle); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBreak.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBreak.java index e1a11f412..cfa9d37f3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBreak.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandBreak.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCase.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCase.java index 436519779..e72849597 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCase.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCase.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCircleSpot3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCircleSpot3.java index ea8b1d2ef..f4a43b2c0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCircleSpot3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCircleSpot3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,6 +38,8 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandCircleSpot3 extends SingleLineCommand2 { @@ -47,6 +49,7 @@ public CommandCircleSpot3() { static IRegex getRegexConcat() { return RegexConcat.build(CommandCircleSpot3.class.getName(), RegexLeaf.start(), // + ColorParser.exp4(), // new RegexLeaf("SPOT", "\\((\\S)\\)"), // new RegexLeaf(";?"), // RegexLeaf.end()); @@ -54,7 +57,8 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - diagram.addSpot(arg.get("SPOT", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + diagram.addSpot(arg.get("SPOT", 0), color); return CommandExecutionResult.ok(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElse3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElse3.java index 2c2d12092..a847d5703 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElse3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElse3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java index 7c57f990a..293669d53 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,8 +40,8 @@ import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandElseIf2 extends SingleLineCommand2 { @@ -75,7 +75,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); String test = arg.get("TEST", 0); if (test.length() == 0) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseLegacy1.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseLegacy1.java index 33fecf453..388c2d340 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseLegacy1.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseLegacy1.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEnd3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEnd3.java index 288d014a0..07cb3965a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEnd3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEnd3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndPartition3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndPartition3.java index a293e7744..4ab88915c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndPartition3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndPartition3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndSwitch.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndSwitch.java index 7c03ab912..b08fab9c9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndSwitch.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndSwitch.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndif3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndif3.java index 54cee9ae8..9ac877e49 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndif3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndif3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandFork3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandFork3.java index b44b54905..030332ed2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandFork3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandFork3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkAgain3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkAgain3.java index 70ce44fac..8466f7096 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkAgain3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkAgain3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkEnd3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkEnd3.java index 368378d35..7dbf3127e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkEnd3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandForkEnd3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGoto.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGoto.java index 7e8621b71..4cb5afb27 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGoto.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGoto.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroup3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroup3.java index 4737b165b..f3c40db8b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroup3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroup3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroupEnd3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroupEnd3.java index 1ad81008c..4a902552f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroupEnd3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroupEnd3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java index fe5a2c065..02658c86c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,8 +43,8 @@ import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandIf2 extends SingleLineCommand2 { @@ -74,7 +74,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); String test = arg.get("TEST", 0); if (test.length() == 0) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java index 0004658bd..ed10900e9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,8 +39,8 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandIf4 extends SingleLineCommand2 { @@ -71,7 +71,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); String test = arg.get("TEST", 0); if (test.length() == 0) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java index 957d1b1e6..acdd8aec7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandKill3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandKill3.java index b185c9244..10546ff16 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandKill3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandKill3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLabel.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLabel.java index 9c549dd45..1aa847074 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLabel.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLabel.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLink3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLink3.java index 930d03fe0..8298eab27 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLink3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandLink3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,8 +38,8 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; +import net.sourceforge.plantuml.graphic.Rainbow; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandLink3 extends SingleLineCommand2 { @@ -58,9 +58,9 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); if (color != null) { - diagram.setColorNextArrow(HtmlColorAndStyle.fromColor(color)); + diagram.setColorNextArrow(Rainbow.fromColor(color, null)); } return CommandExecutionResult.ok(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNolink.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNolink.java index aed63cf20..63007027e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNolink.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNolink.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNote3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNote3.java index 5dbc51787..5dabb819e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNote3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNote3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java index 333bc1a5b..4d4c1c93a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -56,13 +56,15 @@ private static ColorParser color() { return ColorParser.simpleColor(ColorType.BACK); } + @Override public String getPatternEnd() { return "(?i)^end[%s]?note$"; } + @Override protected CommandExecutionResult executeNow(final ActivityDiagram3 diagram, BlocLines lines) { // final List in = StringUtils.removeEmptyColumns2(lines.subList(1, lines.size() - 1)); - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); lines = lines.subExtract(1, 1); lines = lines.removeEmptyColumns(); final NotePosition position = NotePosition.defaultLeft(line0.get("POSITION", 0)); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java index bb7ca3bc9..e73f98e78 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,6 +32,7 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.LineLocation; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -43,12 +44,16 @@ import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.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.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class CommandPartition3 extends SingleLineCommand2 { @@ -119,22 +124,35 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati final String stereo = arg.get("STEREO", 0); final Stereotype stereotype = stereo == null ? null : new Stereotype(stereo); - final HtmlColor backColorInSkinparam = diagram.getSkinParam().getHtmlColor(getColorParamBack(symbol), + final HColor backColorInSkinparam = diagram.getSkinParam().getHtmlColor(getColorParamBack(symbol), stereotype, false); - final HtmlColor backColor; + HColor backColor; if (backColorInSkinparam == null) { backColor = colors.getColor(ColorType.BACK); } else { backColor = backColorInSkinparam; } - final HtmlColor titleColor = colors.getColor(ColorType.HEADER); + HColor titleColor = colors.getColor(ColorType.HEADER); // Warning : titleColor unused in FTileGroupW - HtmlColor borderColor = diagram.getSkinParam().getHtmlColor(getColorParamBorder(symbol), stereotype, false); + HColor borderColor = diagram.getSkinParam().getHtmlColor(getColorParamBorder(symbol), stereotype, false); if (borderColor == null) { - borderColor = HtmlColorUtils.BLACK; + borderColor = HColorUtils.BLACK; + } + double roundCorner = symbol.getSkinParameter().getRoundCorner(diagram.getSkinParam(), stereotype); + + if (SkinParam.USE_STYLES()) { + final Style stylePartition = getDefaultStyleDefinitionPartition().getMergedStyle( + diagram.getSkinParam().getCurrentStyleBuilder()); + borderColor = stylePartition.value(PName.LineColor).asColor(diagram.getSkinParam().getIHtmlColorSet()); + backColor = colors.getColor(ColorType.BACK); + if (backColor == null) { + backColor = stylePartition.value(PName.BackGroundColor).asColor( + diagram.getSkinParam().getIHtmlColorSet()); + } + titleColor = HColorUtils.BLUE;// stylePartition.value(PName.FontColor).asColor(diagram.getSkinParam().getIHtmlColorSet()); + roundCorner = stylePartition.value(PName.RoundCorner).asDouble(); } - final double roundCorner = symbol.getSkinParameter().getRoundCorner(diagram.getSkinParam(), stereotype); diagram.startGroup(Display.getWithNewlines(partitionTitle), backColor, titleColor, borderColor, symbol, roundCorner); @@ -142,4 +160,8 @@ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocati return CommandExecutionResult.ok(); } + final public StyleSignature getDefaultStyleDefinitionPartition() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.partition); + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java index 06ba79002..393870342 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeat3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,8 +30,10 @@ */ package net.sourceforge.plantuml.activitydiagram3.command; +import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; +import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.IRegex; @@ -40,8 +42,11 @@ import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandRepeat3 extends SingleLineCommand2 { @@ -51,20 +56,39 @@ public CommandRepeat3() { static IRegex getRegexConcat() { return RegexConcat.build(CommandRepeat3.class.getName(), RegexLeaf.start(), // + new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // ColorParser.exp4(), // new RegexLeaf("repeat"), // RegexLeaf.spaceZeroOrMore(), // new RegexOptional(new RegexLeaf("LABEL", ":(.*?)")), // - new RegexLeaf(";?"), // + new RegexOptional(new RegexLeaf("STYLE", CommandActivity3.endingGroup())), // + // new RegexLeaf(";?"), // RegexLeaf.end()); } + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); final Display label = Display.getWithNewlines(arg.get("LABEL", 0)); + final BoxStyle boxStyle; + final String styleString = arg.get("STYLE", 0); + if (styleString == null) { + boxStyle = BoxStyle.PLAIN; + } else { + boxStyle = BoxStyle.fromChar(styleString.charAt(0)); + } + Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); + final String stereo = arg.get("STEREO", 0); + if (stereo != null) { + final Stereotype stereotype = new Stereotype(stereo); + colors = colors.applyStereotype(stereotype, diagram.getSkinParam(), ColorParam.activityBackground); + } - diagram.startRepeat(color, label); + diagram.startRepeat(color, label, boxStyle, colors); return CommandExecutionResult.ok(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java index 43e007932..b595cf47c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3Multilines.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3Multilines.java index defdb874c..df13bea13 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3Multilines.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3Multilines.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -75,9 +75,9 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) { - lines = lines.trim(false); - final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499().getString())); - final RegexResult lineLast = getPatternEnd2().matcher(lines.getLast499().getString()); + lines = lines.trim(); + final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst().getString())); + final RegexResult lineLast = getPatternEnd2().matcher(lines.getLast().getString()); // System.err.println("line0=" + line0); // System.err.println("linesLast=" + lineLast); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplit3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplit3.java index 9e6c5e4d2..dc3bba9b6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplit3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplit3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitAgain3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitAgain3.java index bcfb5f04c..62e317b43 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitAgain3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitAgain3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitEnd3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitEnd3.java index 96e0d5c83..a93382371 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitEnd3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSplitEnd3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStart3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStart3.java index aef9663f2..e93121a22 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStart3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStart3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStop3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStop3.java index fb44a91cb..e22387877 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStop3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStop3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java index e33d984b1..682837459 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,8 +39,8 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandSwimlane extends SingleLineCommand2 { @@ -60,7 +60,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); final String name = arg.get("SWIMLANE", 0); final Display label = Display.getWithNewlines(arg.get("LABEL", 0)); return diagram.swimlane(name, color, label); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java index 1e3119d24..b9f821ad7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwimlane2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,8 +40,8 @@ import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandSwimlane2 extends SingleLineCommand2 { @@ -68,7 +68,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); final String name = arg.get("SWIMLANE", 0); final Display label = Display.getWithNewlines(arg.get("LABEL", 0)); return diagram.swimlane(name, color, label); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java index 3c44a9dfa..6ba5f23e8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,8 +39,8 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandSwitch extends SingleLineCommand2 { @@ -62,7 +62,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); String test = arg.get("TEST", 0); if (test.length() == 0) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java index 3c8522044..90fcf91bc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,8 +40,8 @@ import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandWhile3 extends SingleLineCommand2 { @@ -68,7 +68,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); diagram.doWhile(Display.getWithNewlines(arg.get("TEST", 0)), Display.getWithNewlines(arg.get("YES", 0)), color); return CommandExecutionResult.ok(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhileEnd3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhileEnd3.java index a2cf70050..54feb861f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhileEnd3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhileEnd3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractConnection.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractConnection.java index 35b3f9ab1..8b6052c04 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractConnection.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractConnection.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java index 8f7671110..772d5e5ad 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public abstract class AbstractFtile extends AbstractTextBlock implements Ftile { @@ -60,6 +61,10 @@ final public ISkinParam skinParam() { return skinParam; } + final public HColorSet getIHtmlColorSet() { + return skinParam.getIHtmlColorSet(); + } + public LinkRendering getInLinkRendering() { return LinkRendering.none(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Arrows.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Arrows.java index 1047472e3..a2623cf80 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Arrows.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Arrows.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/BoxStyle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/BoxStyle.java index 18d7937f3..1e900b708 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/BoxStyle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/BoxStyle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -44,13 +44,13 @@ public enum BoxStyle { PLAIN { @Override - protected Shadowable getShape(double width, double height) { - return new URectangle(width, height, CORNER, CORNER); + protected Shadowable getShape(double width, double height, double roundCorner) { + return new URectangle(width, height).rounded(roundCorner); } }, SDL_INPUT('<') { @Override - protected Shadowable getShape(double width, double height) { + protected Shadowable getShape(double width, double height, double roundCorner) { final UPolygon result = new UPolygon(); result.addPoint(0, 0); result.addPoint(width + DELTA_INPUT_OUTPUT, 0); @@ -62,7 +62,7 @@ protected Shadowable getShape(double width, double height) { }, SDL_OUTPUT('>') { @Override - protected Shadowable getShape(double width, double height) { + protected Shadowable getShape(double width, double height, double roundCorner) { final UPolygon result = new UPolygon(); result.addPoint(0.0, 0.0); result.addPoint(width, 0.0); @@ -74,20 +74,18 @@ protected Shadowable getShape(double width, double height) { }, SDL_PROCEDURE('|') { @Override - protected void drawInternal(UGraphic ug, double width, double height, boolean shadowing) { + protected void drawInternal(UGraphic ug, double width, double height, double shadowing, double roundCorner) { final URectangle rect = new URectangle(width, height); - if (shadowing) { - rect.setDeltaShadow(3); - } + rect.setDeltaShadow(shadowing); ug.draw(rect); - final ULine vline = new ULine(0, height); - ug.apply(new UTranslate(PADDING, 0)).draw(vline); - ug.apply(new UTranslate(width - PADDING, 0)).draw(vline); + final ULine vline = ULine.vline(height); + ug.apply(UTranslate.dx(PADDING)).draw(vline); + ug.apply(UTranslate.dx(width - PADDING)).draw(vline); } }, SDL_SAVE('\\') { @Override - protected Shadowable getShape(double width, double height) { + protected Shadowable getShape(double width, double height, double roundCorner) { final UPolygon result = new UPolygon(); result.addPoint(0.0, 0.0); result.addPoint(width - DELTA_INPUT_OUTPUT, 0.0); @@ -98,7 +96,7 @@ protected Shadowable getShape(double width, double height) { }, SDL_ANTISAVE('/') { @Override - protected Shadowable getShape(double width, double height) { + protected Shadowable getShape(double width, double height, double roundCorner) { final UPolygon result = new UPolygon(); result.addPoint(DELTA_INPUT_OUTPUT, 0.0); result.addPoint(width, 0.0); @@ -109,7 +107,7 @@ protected Shadowable getShape(double width, double height) { }, SDL_CONTINUOUS('}') { @Override - protected Shadowable getShape(double width, double height) { + protected Shadowable getShape(double width, double height, double roundCorner) { final UPath result = new UPath(); final double c1[] = { DELTA_CONTINUOUS, 0 }; final double c2[] = { 0, height / 2 }; @@ -131,12 +129,11 @@ protected Shadowable getShape(double width, double height) { }, SDL_TASK(']') { @Override - protected Shadowable getShape(double width, double height) { + protected Shadowable getShape(double width, double height, double roundCorner) { return new URectangle(width, height); } }; - private static final int CORNER = 25; private final char style; private static int DELTA_INPUT_OUTPUT = 10; private static double DELTA_CONTINUOUS = 5.0; @@ -159,23 +156,22 @@ public static BoxStyle fromChar(char style) { return PLAIN; } - public final UDrawable getUDrawable(final double width, final double height, final boolean shadowing) { + public final UDrawable getUDrawable(final double width, final double height, final double shadowing, + final double roundCorner) { return new UDrawable() { public void drawU(UGraphic ug) { - drawInternal(ug, width, height, shadowing); + drawInternal(ug, width, height, shadowing, roundCorner); } }; } - protected Shadowable getShape(double width, double height) { + protected Shadowable getShape(double width, double height, double roundCorner) { return null; } - protected void drawInternal(UGraphic ug, double width, double height, boolean shadowing) { - final Shadowable s = getShape(width, height); - if (shadowing) { - s.setDeltaShadow(3); - } + protected void drawInternal(UGraphic ug, double width, double height, double shadowing, double roundCorner) { + final Shadowable s = getShape(width, height, roundCorner); + s.setDeltaShadow(shadowing); ug.draw(s); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/CenteredText.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/CenteredText.java new file mode 100644 index 000000000..191c82fa7 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/CenteredText.java @@ -0,0 +1,54 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.activitydiagram3.ftile; + +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.ugraphic.UShape; + +public class CenteredText implements UShape { + + private final TextBlock text; + private final double totalWidth; + + public CenteredText(TextBlock text, double totalWidth) { + this.text = text; + this.totalWidth = totalWidth; + } + + public TextBlock getText() { + return text; + } + + public double getTotalWidth() { + return totalWidth; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/CollisionDetector.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/CollisionDetector.java index a1bbd7882..947acd973 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/CollisionDetector.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/CollisionDetector.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,16 +34,12 @@ import java.util.ArrayList; import java.util.List; -import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.MinMax; +import net.sourceforge.plantuml.ugraphic.UBackground; import net.sourceforge.plantuml.ugraphic.UChange; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UGraphicNo; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParamNull; @@ -52,17 +48,20 @@ import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; -public class CollisionDetector implements UGraphic { +public class CollisionDetector extends UGraphicNo implements UGraphic { public UGraphic apply(UChange change) { if (change instanceof UTranslate) { return new CollisionDetector(stringBounder, translate.compose((UTranslate) change), this.context); } else if (change instanceof UStroke) { return new CollisionDetector(this); - } else if (change instanceof UChangeBackColor) { + } else if (change instanceof UBackground) { return new CollisionDetector(this); - } else if (change instanceof UChangeColor) { + } else if (change instanceof HColor) { return new CollisionDetector(this); } throw new UnsupportedOperationException(); @@ -83,8 +82,8 @@ public void drawDebug(UGraphic ug) { minmax.drawGrey(ug); } } - final HtmlColor color = HtmlColorUtils.BLACK; - ug = ug.apply(new UChangeColor(color)).apply(new UStroke(5)); + final HColor color = HColorUtils.BLACK; + ug = ug.apply(color).apply(new UStroke(5)); for (Snake snake : snakes) { for (Line2D line : snake.getHorizontalLines()) { if (collision(line)) { @@ -195,12 +194,6 @@ public ColorMapper getColorMapper() { throw new UnsupportedOperationException(); } - public void startUrl(Url url) { - } - - public void closeAction() { - } - public void flushUg() { } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Connection.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Connection.java index 95edb5aee..7648706fa 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Connection.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Connection.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/ConnectionCross.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/ConnectionCross.java index eaebda3d4..c07003a4a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/ConnectionCross.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/ConnectionCross.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/ConnectionTranslatable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/ConnectionTranslatable.java index 3fc950fe5..43a993942 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/ConnectionTranslatable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/ConnectionTranslatable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Diamond.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Diamond.java index 6ded3a2ea..254aebbd8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Diamond.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Diamond.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,7 +41,7 @@ public class Diamond { final static public double diamondHalfSize = 12; - public static UPolygon asPolygon(boolean shadowing) { + public static UPolygon asPolygon(double shadowing) { final UPolygon diams = new UPolygon(); diams.addPoint(diamondHalfSize, 0); @@ -50,14 +50,15 @@ public static UPolygon asPolygon(boolean shadowing) { diams.addPoint(0, diamondHalfSize); diams.addPoint(diamondHalfSize, 0); - if (shadowing) { - diams.setDeltaShadow(3); - } + // if (shadowing) { + // diams.setDeltaShadow(3); + // } + diams.setDeltaShadow(shadowing); return diams; } - public static UPolygon asPolygon(boolean shadowing, double width, double height) { + public static UPolygon asPolygon(double shadowing, double width, double height) { final UPolygon diams = new UPolygon(); diams.addPoint(diamondHalfSize, 0); @@ -68,9 +69,10 @@ public static UPolygon asPolygon(boolean shadowing, double width, double height) diams.addPoint(0, height / 2); diams.addPoint(diamondHalfSize, 0); - if (shadowing) { - diams.setDeltaShadow(3); - } + // if (shadowing) { + // diams.setDeltaShadow(3); + // } + diams.setDeltaShadow(shadowing); return diams; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java index 5dbef9615..7f5b5822a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,19 +33,15 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.skin.rose.Rose; -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; public class EntityImageLegend { @@ -54,8 +50,8 @@ public static TextBlock create(Display note, ISkinParam skinParam) { final TextBlock textBlock = note.create(new FontConfiguration(skinParam, FontParam.LEGEND, null), HorizontalAlignment.LEFT, skinParam); final Rose rose = new Rose(); - final HtmlColor legendBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.legendBackground); - final HtmlColor legendColor = rose.getHtmlColor(skinParam, ColorParam.legendBorder); + final HColor legendBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.legendBackground); + final HColor legendColor = rose.getHtmlColor(skinParam, ColorParam.legendBorder); final UStroke stroke = skinParam.getThickness(LineParam.legendBorder, null); final int cornersize = 10; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Ftile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Ftile.java index 2a68e8880..fb2022235 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Ftile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Ftile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java index dcce397e3..79133db52 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -120,15 +120,15 @@ public LinkRendering getOutLinkRendering() { public FtileGeometry calculateDimension(StringBounder stringBounder) { if (calculateDimension == null) { - calculateDimension = tile1.calculateDimension(stringBounder).appendBottom( - tile2.calculateDimension(stringBounder)); + calculateDimension = tile1.calculateDimension(stringBounder) + .appendBottom(tile2.calculateDimension(stringBounder)); } return calculateDimension; } private UTranslate getTranslated1(StringBounder stringBounder) { final double left = calculateDimension(stringBounder).getLeft(); - return new UTranslate(left - tile1.calculateDimension(stringBounder).getLeft(), 0); + return UTranslate.dx(left - tile1.calculateDimension(stringBounder).getLeft()); } private UTranslate getTranslated2(StringBounder stringBounder) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileBreak.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileBreak.java index 8e572350e..2c41d31af 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileBreak.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileBreak.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileDecorateWelding.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileDecorateWelding.java index 4f0c11368..784c7700c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileDecorateWelding.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileDecorateWelding.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileEmpty.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileEmpty.java index 19e04cb96..42be10a8f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileEmpty.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileEmpty.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java index bde8911ba..226e65478 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,10 +41,10 @@ import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.PositionedNote; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.ugraphic.color.HColor; public interface FtileFactory { @@ -58,7 +58,7 @@ public interface FtileFactory { public Ftile end(Swimlane swimlane); - public Ftile spot(Swimlane swimlane, String spot); + public Ftile spot(Swimlane swimlane, String spot, HColor color); public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors); @@ -72,12 +72,12 @@ public interface FtileFactory { public Ftile assembly(Ftile tile1, Ftile tile2); - public Ftile repeat(Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, Ftile repeat, Display test, - Display yes, Display out, HtmlColor color, LinkRendering backRepeatLinkRendering, Ftile backward, - boolean noOut); + public Ftile repeat(BoxStyle boxStyleIn, Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, Ftile repeat, + Display test, Display yes, Display out, Colors colors, LinkRendering backRepeatLinkRendering, + Ftile backward, boolean noOut); public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out, - LinkRendering afterEndwhile, HtmlColor color, Instruction specialOut); + LinkRendering afterEndwhile, HColor color, Instruction specialOut, Ftile backward); public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch, LinkRendering afterEndwhile, LinkRendering topInlinkRendering, Url url); @@ -85,9 +85,9 @@ public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch, public Ftile createSwitch(Swimlane swimlane, List branches, LinkRendering afterEndwhile, LinkRendering topInlinkRendering, Display labelTest); - public Ftile createParallel(Swimlane swimlane, List all, ForkStyle style, String label); + public Ftile createParallel(List all, ForkStyle style, String label, Swimlane in, Swimlane out); - public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, PositionedNote note, - HtmlColor borderColor, USymbol type, double roundCorner); + public Ftile createGroup(Ftile list, Display name, HColor backColor, HColor titleColor, PositionedNote note, + HColor borderColor, USymbol type, double roundCorner); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java index e8a8133be..a47d74a6b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,6 +35,7 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.ForkStyle; @@ -45,14 +46,16 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileFactoryDelegator implements FtileFactory { @@ -60,16 +63,40 @@ public class FtileFactoryDelegator implements FtileFactory { private final Rose rose = new Rose(); + final public StyleSignature getDefaultStyleDefinitionActivity() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity); + } + + final public StyleSignature getDefaultStyleDefinitionDiamond() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond); + } + + final public StyleSignature getDefaultStyleDefinitionArrow() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow); + } + protected final Rainbow getInLinkRenderingColor(Ftile tile) { Rainbow color; final LinkRendering linkRendering = tile.getInLinkRendering(); if (linkRendering == null) { - color = HtmlColorAndStyle.build(skinParam()); + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinitionArrow() + .getMergedStyle(skinParam().getCurrentStyleBuilder()); + return Rainbow.build(style, skinParam().getIHtmlColorSet()); + } else { + color = Rainbow.build(skinParam()); + } } else { color = linkRendering.getRainbow(); } if (color.size() == 0) { - color = HtmlColorAndStyle.build(skinParam()); + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinitionArrow() + .getMergedStyle(skinParam().getCurrentStyleBuilder()); + return Rainbow.build(style, skinParam().getIHtmlColorSet()); + } else { + color = Rainbow.build(skinParam()); + } } return color; } @@ -79,8 +106,14 @@ protected final TextBlock getTextBlock(Display display) { if (Display.isNull(display)) { return null; } - final FontConfiguration fontConfiguration = new FontConfiguration(skinParam(), FontParam.ARROW, null); - return display.create(fontConfiguration, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE); + final FontConfiguration fontConfiguration; + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder()); + fontConfiguration = style.getFontConfiguration(skinParam().getIHtmlColorSet()); + } else { + fontConfiguration = new FontConfiguration(skinParam(), FontParam.ARROW, null); + } + return display.create7(fontConfiguration, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE); } protected Display getInLinkRenderingDisplay(Ftile tile) { @@ -107,8 +140,8 @@ public Ftile stop(Swimlane swimlane) { return factory.stop(swimlane); } - public Ftile spot(Swimlane swimlane, String spot) { - return factory.spot(swimlane, spot); + public Ftile spot(Swimlane swimlane, String spot, HColor color) { + return factory.spot(swimlane, spot, color); } public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors) { @@ -141,16 +174,16 @@ public Ftile assembly(Ftile tile1, Ftile tile2) { return factory.assembly(tile1, tile2); } - public Ftile repeat(Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, Ftile repeat, Display test, - Display yes, Display out, HtmlColor color, LinkRendering backRepeatLinkRendering, Ftile backward, - boolean noOut) { - return factory.repeat(swimlane, swimlaneOut, startLabel, repeat, test, yes, out, color, + public Ftile repeat(BoxStyle boxStyleIn, Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, Ftile repeat, + Display test, Display yes, Display out, Colors colors, LinkRendering backRepeatLinkRendering, + Ftile backward, boolean noOut) { + return factory.repeat(boxStyleIn, swimlane, swimlaneOut, startLabel, repeat, test, yes, out, colors, backRepeatLinkRendering, backward, noOut); } public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out, - LinkRendering afterEndwhile, HtmlColor color, Instruction specialOut) { - return factory.createWhile(swimlane, whileBlock, test, yes, out, afterEndwhile, color, specialOut); + LinkRendering afterEndwhile, HColor color, Instruction specialOut, Ftile back) { + return factory.createWhile(swimlane, whileBlock, test, yes, out, afterEndwhile, color, specialOut, back); } public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch, LinkRendering afterEndwhile, @@ -163,12 +196,12 @@ public Ftile createSwitch(Swimlane swimlane, List branches, LinkRenderin return factory.createSwitch(swimlane, branches, afterEndwhile, topInlinkRendering, labelTest); } - public Ftile createParallel(Swimlane swimlane, List all, ForkStyle style, String label) { - return factory.createParallel(swimlane, all, style, label); + public Ftile createParallel(List all, ForkStyle style, String label, Swimlane in, Swimlane out) { + return factory.createParallel(all, style, label, in, out); } - public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, PositionedNote note, - HtmlColor borderColor, USymbol type, double roundCorner) { + public Ftile createGroup(Ftile list, Display name, HColor backColor, HColor titleColor, PositionedNote note, + HColor borderColor, USymbol type, double roundCorner) { return factory.createGroup(list, name, backColor, titleColor, note, borderColor, type, roundCorner); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometry.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometry.java index e8a7ad56c..ae32343ef 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometry.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometry.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -109,6 +109,10 @@ public FtileGeometry incHeight(double northHeight) { return new FtileGeometry(width, height + northHeight, left, inY, outY); } +// public FtileGeometry incInnerHeight(double northHeight) { +// return new FtileGeometry(width, height + northHeight, left, inY, outY + northHeight); +// } + public FtileGeometry(Dimension2D dim, double left, double inY, double outY) { this(dim.getWidth(), dim.getHeight(), left, inY, outY); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometryMerger.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometryMerger.java index 4930946d2..1b9f3e7ce 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometryMerger.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGeometryMerger.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGoto.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGoto.java index ce9ace7a6..c8f9e1742 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGoto.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGoto.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixed.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixedCentered.java similarity index 88% rename from src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixed.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixedCentered.java index 918c2ffc3..641556c33 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixed.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixedCentered.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,12 +38,12 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class FtileHeightFixed extends AbstractFtile { +public class FtileHeightFixedCentered extends AbstractFtile { private final Ftile tile; private final double fixedHeight; - public FtileHeightFixed(Ftile tile, double fixedHeight) { + public FtileHeightFixedCentered(Ftile tile, double fixedHeight) { super(tile.skinParam()); this.tile = tile; this.fixedHeight = fixedHeight; @@ -81,7 +81,7 @@ private UTranslate getTranslate(StringBounder stringBounder) { if (dim.getHeight() > fixedHeight) { throw new IllegalStateException(); } - return new UTranslate(0, (fixedHeight - dim.getHeight()) / 2); + return UTranslate.dy((fixedHeight - dim.getHeight()) / 2); } public void drawU(UGraphic ug) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixedMarged.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixedMarged.java new file mode 100644 index 000000000..7a39c1dbe --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixedMarged.java @@ -0,0 +1,89 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.activitydiagram3.ftile; + +import java.util.Set; + +import net.sourceforge.plantuml.activitydiagram3.LinkRendering; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UTranslate; + +public class FtileHeightFixedMarged extends AbstractFtile { + + private final Ftile tile; + private final double ymargin1; + private final double ymargin2; + + public FtileHeightFixedMarged(double ymargin1, Ftile tile, double ymargin2) { + super(tile.skinParam()); + this.tile = tile; + this.ymargin1 = ymargin1; + this.ymargin2 = ymargin2; + } + + @Override + public LinkRendering getInLinkRendering() { + return tile.getInLinkRendering(); + } + + @Override + public LinkRendering getOutLinkRendering() { + return tile.getOutLinkRendering(); + } + + public Set getSwimlanes() { + return tile.getSwimlanes(); + } + + public Swimlane getSwimlaneIn() { + return tile.getSwimlaneIn(); + } + + public Swimlane getSwimlaneOut() { + return tile.getSwimlaneOut(); + } + + @Override + protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) { + final FtileGeometry dim = tile.calculateDimension(stringBounder); + return dim.translate(getTranslate(stringBounder)).fixedHeight(ymargin1 + dim.getHeight() + ymargin2); + } + + private UTranslate getTranslate(StringBounder stringBounder) { + return UTranslate.dy(ymargin1); + } + + public void drawU(UGraphic ug) { + ug.apply(getTranslate(ug.getStringBounder())).draw(tile); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileKilled.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileKilled.java index 971e12bc7..7e6d448ed 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileKilled.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileKilled.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileLabel.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileLabel.java index 072728cd5..de88ee48a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileLabel.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileLabel.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMarged.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMarged.java index 8225ec322..a99560824 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMarged.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMarged.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -97,7 +97,7 @@ public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) { } private UTranslate getTranslate() { - return new UTranslate(margin1, 0); + return UTranslate.dx(margin1); } public void drawU(UGraphic ug) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedRight.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedRight.java index 3a956b6af..8553c7dd8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedRight.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedRight.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedVertically.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedVertically.java index 87a3237d5..2c34c30f4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedVertically.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedVertically.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -48,7 +48,7 @@ public FtileMargedVertically(Ftile tile, double margin1, double margin2) { public void drawU(UGraphic ug) { if (margin1 > 0) { - ug = ug.apply(new UTranslate(0, margin1)); + ug = ug.apply(UTranslate.dy(margin1)); } ug.draw(getFtileDelegated()); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMinWidth.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMinWidthCentered.java similarity index 90% rename from src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMinWidth.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMinWidthCentered.java index 3daa039b5..ff42d78ab 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMinWidth.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMinWidthCentered.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,12 +38,12 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class FtileMinWidth extends FtileDecorate { +public class FtileMinWidthCentered extends FtileDecorate { private final double minWidth; private FtileGeometry calculateDimensionInternal; - public FtileMinWidth(Ftile tile, double minWidth) { + public FtileMinWidthCentered(Ftile tile, double minWidth) { super(tile); this.minWidth = minWidth; } @@ -82,7 +82,7 @@ private Dimension2D getDimensionInternal(StringBounder stringBounder) { private UTranslate getUTranslateInternal(final StringBounder stringBounder) { final Dimension2D dimTile = getFtileDelegated().calculateDimension(stringBounder); final Dimension2D dimTotal = getDimensionInternal(stringBounder); - final UTranslate change = new UTranslate((dimTotal.getWidth() - dimTile.getWidth()) / 2, 0); + final UTranslate change = UTranslate.dx((dimTotal.getWidth() - dimTile.getWidth()) / 2); return change; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileOverpassing.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileOverpassing.java index b215020d5..129a67442 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileOverpassing.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileOverpassing.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileUtils.java index a47cecf68..39fbbfb84 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithConnection.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithConnection.java index e7bb0a283..a171087a6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithConnection.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithConnection.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithSwimlanes.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithSwimlanes.java index 701062074..9750162b4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithSwimlanes.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithSwimlanes.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithUrl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithUrl.java index b1866124d..cbfa12d30 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithUrl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileWithUrl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -49,7 +49,7 @@ public FtileWithUrl(Ftile ftile, Url url) { public void drawU(UGraphic ug) { ug.startUrl(url); getFtileDelegated().drawU(ug); - ug.closeAction(); + ug.closeUrl(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Genealogy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Genealogy.java index 40ed460f6..f0413b970 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Genealogy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Genealogy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/GotoInterceptor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/GotoInterceptor.java index 52d6629e0..7504999ba 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/GotoInterceptor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/GotoInterceptor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/LaneDivider.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/LaneDivider.java new file mode 100644 index 000000000..fce59432c --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/LaneDivider.java @@ -0,0 +1,117 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.activitydiagram3.ftile; + +import java.awt.geom.Dimension2D; + +import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.LineParam; +import net.sourceforge.plantuml.SkinParam; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; +import net.sourceforge.plantuml.graphic.StringBounder; +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.UEmpty; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.ULine; +import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; + +public class LaneDivider extends AbstractTextBlock { + + private final ISkinParam skinParam;; + + private final double x1; + private final double x2; + private final double height; + private Style style; + + public LaneDivider(ISkinParam skinParam, double x1, double x2, double height) { + this.skinParam = skinParam; + this.x1 = x1; + this.x2 = x2; + this.height = height; + } + + public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.swimlane); + } + + private Style getStyle() { + if (style == null) { + this.style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); + } + return style; + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return new Dimension2DDouble(x1 + x2, height); + } + + public void drawU(UGraphic ug) { +// final UShape back = new URectangle(x1 + x2, height).ignoreForCompressionOnY(); +// ug.apply(UChangeColor.nnn(HColorUtils.BLUE)).draw(back); + final UShape back = new UEmpty(x1 + x2, 1); + ug.draw(back); + + HColor color = skinParam.getHtmlColor(ColorParam.swimlaneBorder, null, false); + if (color == null) { + color = ColorParam.swimlaneBorder.getDefaultValue(); + } + UStroke thickness = Rose.getStroke(skinParam, LineParam.swimlaneBorder, 2); + if (SkinParam.USE_STYLES()) { + color = getStyle().value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); + thickness = getStyle().getStroke(); + } + ug.apply(UTranslate.dx(x1)).apply(thickness).apply(color).draw(ULine.vline(height)); + + } + + public double getWidth() { + return x1 + x2; + } + + public final double getX1() { + return x1; + } + + public final double getX2() { + return x2; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/MergeStrategy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/MergeStrategy.java index ec5bb69c7..4e6b01e0b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/MergeStrategy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/MergeStrategy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java index 81ca88474..a285a0560 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Snake.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -49,7 +49,7 @@ import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.comp.CompressionTransform; +import net.sourceforge.plantuml.ugraphic.comp.PiecewiseAffineTransform; public class Snake implements UShape { @@ -63,11 +63,11 @@ public class Snake implements UShape { private Direction emphasizeDirection; private final HorizontalAlignment horizontalAlignment; - public final void setIgnoreForCompression(boolean ignoreForCompression) { - this.worm.setIgnoreForCompression(ignoreForCompression); + public final void setIgnoreForCompression() { + this.worm.setIgnoreForCompression(); } - public Snake transformX(CompressionTransform compressionTransform) { + public Snake transformX(PiecewiseAffineTransform compressionTransform) { final Snake result = new Snake(startDecoration, horizontalAlignment, color, endDecoration); result.textBlock = this.textBlock; result.mergeable = this.mergeable; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/SnakeDirection.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/SnakeDirection.java index 35a9e498f..ae30d6deb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/SnakeDirection.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/SnakeDirection.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimable.java index 86183a5a6..06c503a6e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java index 87809e2b9..576283e3d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,11 +33,11 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SpecificBackcolorable; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Swimlane implements SpecificBackcolorable { @@ -74,8 +74,11 @@ public final UTranslate getTranslate() { return translate; } - public final void setTranslateAndWidth(UTranslate translate, double actualWidth) { + public final void setTranslate(UTranslate translate) { this.translate = translate; + } + + public final void setWidth(double actualWidth) { this.actualWidth = actualWidth; } @@ -83,7 +86,7 @@ public Colors getColors(ISkinParam skinParam) { return colors; } - public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) { + public void setSpecificColorTOBEREMOVED(ColorType type, HColor color) { if (color != null) { this.colors = colors.add(type, color); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java new file mode 100644 index 000000000..85d2228c3 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java @@ -0,0 +1,429 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.activitydiagram3.ftile; + +import java.awt.geom.Dimension2D; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.LineBreakStrategy; +import net.sourceforge.plantuml.Pragma; +import net.sourceforge.plantuml.SkinParam; +import net.sourceforge.plantuml.activitydiagram3.Instruction; +import net.sourceforge.plantuml.activitydiagram3.InstructionList; +import net.sourceforge.plantuml.activitydiagram3.LinkRendering; +import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorAddNote; +import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorAddUrl; +import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorAssembly; +import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorCreateGroup; +import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorCreateParallel; +import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorIf; +import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorRepeat; +import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorSwitch; +import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorWhile; +import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.UGraphicInterceptorOneSwimlane; +import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.VCompactFactory; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.graphic.UGraphicDelegator; +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.style.Styleable; +import net.sourceforge.plantuml.svek.UGraphicForSnake; +import net.sourceforge.plantuml.ugraphic.LimitFinder; +import net.sourceforge.plantuml.ugraphic.MinMax; +import net.sourceforge.plantuml.ugraphic.UChange; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.URectangle; +import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.comp.CompressionMode; +import net.sourceforge.plantuml.ugraphic.comp.SlotFinder; +import net.sourceforge.plantuml.utils.MathUtils; + +public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable { + + private final ISkinParam skinParam;; + private final Pragma pragma; + + private final List swimlanesRaw = new ArrayList(); + private final List swimlanesSpecial = new ArrayList(); + private final List dividers = new ArrayList(); + private Swimlane currentSwimlane = null; + + private final Instruction root = new InstructionList(); + private Instruction currentInstruction = root; + + private LinkRendering nextLinkRenderer = LinkRendering.none(); + private Style style; + + private List swimlanes() { + return Collections.unmodifiableList(swimlanesRaw); + } + + private List swimlanesSpecial() { + if (swimlanesSpecial.size() == 0) { + swimlanesSpecial.addAll(swimlanesRaw); + final Swimlane last = new Swimlane(""); + last.setMinMax(MinMax.getEmpty(true)); + swimlanesSpecial.add(last); + } + return Collections.unmodifiableList(swimlanesSpecial); + } + + public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.swimlane); + } + + public Swimlanes(ISkinParam skinParam, Pragma pragma) { + this.skinParam = skinParam; + this.pragma = pragma; + } + + protected Style getStyle() { + if (style == null) { + this.style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); + } + return style; + } + + private FtileFactory getFtileFactory(StringBounder stringBounder) { + FtileFactory factory = new VCompactFactory(skinParam, stringBounder); + factory = new FtileFactoryDelegatorAddUrl(factory); + factory = new FtileFactoryDelegatorAssembly(factory); + factory = new FtileFactoryDelegatorIf(factory, pragma); + factory = new FtileFactoryDelegatorSwitch(factory); + factory = new FtileFactoryDelegatorWhile(factory); + factory = new FtileFactoryDelegatorRepeat(factory); + factory = new FtileFactoryDelegatorCreateParallel(factory); + // factory = new FtileFactoryDelegatorCreateParallelAddingMargin(new + // FtileFactoryDelegatorCreateParallel1(factory)); + factory = new FtileFactoryDelegatorAddNote(factory); + factory = new FtileFactoryDelegatorCreateGroup(factory); + return factory; + } + + public void swimlane(String name, HColor color, Display label) { + currentSwimlane = getOrCreate(name); + if (color != null) { + currentSwimlane.setSpecificColorTOBEREMOVED(ColorType.BACK, color); + } + if (Display.isNull(label) == false) { + currentSwimlane.setDisplay(label); + } + } + + private Swimlane getOrCreate(String name) { + for (Swimlane s : swimlanes()) { + if (s.getName().equals(name)) { + return s; + } + } + final Swimlane result = new Swimlane(name); + swimlanesRaw.add(result); + return result; + } + + class Cross extends UGraphicDelegator { + + private Cross(UGraphic ug) { + super(ug); + } + + @Override + public void draw(UShape shape) { + if (shape instanceof Ftile) { + final Ftile tile = (Ftile) shape; + tile.drawU(this); + } else if (shape instanceof Connection) { + final Connection connection = (Connection) shape; + final Ftile tile1 = connection.getFtile1(); + final Ftile tile2 = connection.getFtile2(); + + if (tile1 == null || tile2 == null) { + return; + } + if (tile1.getSwimlaneOut() != tile2.getSwimlaneIn()) { + final ConnectionCross connectionCross = new ConnectionCross(connection); + connectionCross.drawU(getUg()); + } + } + } + + public UGraphic apply(UChange change) { + return new Cross(getUg().apply(change)); + } + + } + + public final void computeSize(StringBounder stringBounder) { + final SlotFinder ug = new SlotFinder(CompressionMode.ON_Y, stringBounder); + if (swimlanes().size() > 1) { + TextBlock full = root.createFtile(getFtileFactory(stringBounder)); + computeSizeInternal(ug, full); + } + + } + + public final void drawU(UGraphic ug) { + TextBlock full = root.createFtile(getFtileFactory(ug.getStringBounder())); + + ug = new UGraphicForSnake(ug); + if (swimlanes().size() > 1) { + drawWhenSwimlanes(ug, full); + } else { + // BUG42 + full = new TextBlockInterceptorUDrawable(full); + full.drawU(ug); + ug.flushUg(); + } + } + + private TextBlock getTitle(Swimlane swimlane) { + final HorizontalAlignment horizontalAlignment = HorizontalAlignment.LEFT; + FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.SWIMLANE_TITLE, null); + if (SkinParam.USE_STYLES()) { + fontConfiguration = getStyle().getFontConfiguration(skinParam.getIHtmlColorSet()); + } + LineBreakStrategy wrap = getWrap(); + if (wrap.isAuto()) { + wrap = new LineBreakStrategy("" + ((int) swimlane.getActualWidth())); + } + + return swimlane.getDisplay().create9(fontConfiguration, horizontalAlignment, skinParam, wrap); + } + + private LineBreakStrategy getWrap() { + LineBreakStrategy wrap = skinParam.swimlaneWrapTitleWidth(); + if (wrap == LineBreakStrategy.NONE) { + wrap = skinParam.wrapWidth(); + } + return wrap; + } + + private UTranslate getTitleHeightTranslate(final StringBounder stringBounder) { + double titlesHeight = getTitlesHeight(stringBounder); + return UTranslate.dy(titlesHeight > 0 ? titlesHeight + 5 : 0); + } + + private double getTitlesHeight(StringBounder stringBounder) { + double titlesHeight = 0; + for (Swimlane swimlane : swimlanes()) { + final TextBlock swTitle = getTitle(swimlane); + titlesHeight = Math.max(titlesHeight, swTitle.calculateDimension(stringBounder).getHeight()); + } + return titlesHeight; + } + + private void drawWhenSwimlanes(UGraphic ug, TextBlock full) { + final StringBounder stringBounder = ug.getStringBounder(); + final UTranslate titleHeightTranslate = getTitleHeightTranslate(stringBounder); + + drawTitlesBackground(ug); + + final Dimension2D dimensionFull = full.calculateDimension(stringBounder); + int i = 0; + assert dividers.size() == swimlanes().size() + 1; + for (Swimlane swimlane : swimlanesSpecial()) { + final LaneDivider divider1 = dividers.get(i); + + final double xpos = swimlane.getTranslate().getDx() + swimlane.getMinMax().getMinX(); + final HColor back = swimlane.getColors(skinParam).getColor(ColorType.BACK); + if (back != null) { + final LaneDivider divider2 = dividers.get(i + 1); + final UGraphic background = ug.apply(back.bg()).apply(back) + .apply(UTranslate.dx(xpos - divider1.getX2())); + final double width = swimlane.getActualWidth() + divider1.getX2() + divider2.getX1(); + final double height = dimensionFull.getHeight() + titleHeightTranslate.getDy(); + background.draw(new URectangle(width, height).ignoreForCompressionOnX().ignoreForCompressionOnY()); + } + + full.drawU(new UGraphicInterceptorOneSwimlane(ug, swimlane, swimlanes()).apply(swimlane.getTranslate()) + .apply(getTitleHeightTranslate(stringBounder))); + + final double dividerWith = divider1.calculateDimension(stringBounder).getWidth(); + divider1.drawU(ug.apply(UTranslate.dx(xpos - dividerWith))); + i++; + } + + final Cross cross = new Cross(ug.apply(getTitleHeightTranslate(stringBounder))); + full.drawU(cross); + cross.flushUg(); + + drawTitles(ug); + + } + + private void drawTitlesBackground(UGraphic ug) { + HColor color = skinParam.getHtmlColor(ColorParam.swimlaneTitleBackground, null, false); + if (SkinParam.USE_STYLES()) { + color = getStyle().value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); + } + if (color != null) { + final double titleHeight = getTitlesHeight(ug.getStringBounder()); + double fullWidth = swimlanesSpecial().get(swimlanesSpecial().size() - 1).getTranslate().getDx() - 2 * 5 - 1; + final URectangle back = new URectangle(fullWidth, titleHeight).ignoreForCompressionOnX() + .ignoreForCompressionOnY(); + ug.apply(UTranslate.dx(5)).apply(color.bg()).apply(color).draw(back); + } + } + + private void drawTitles(UGraphic ug) { + for (Swimlane swimlane : swimlanes()) { + final TextBlock swTitle = getTitle(swimlane); + final double x2 = swimlane.getTranslate().getDx() + swimlane.getMinMax().getMinX(); + final CenteredText centeredText = new CenteredText(swTitle, getWidthWithoutTitle(swimlane)); + ug.apply(UTranslate.dx(x2)).draw(centeredText); + } + } + + private void computeDrawingWidths(UGraphic ug, TextBlock full) { + final StringBounder stringBounder = ug.getStringBounder(); + for (Swimlane swimlane : swimlanes()) { + final LimitFinder limitFinder = new LimitFinder(stringBounder, false); + final UGraphicInterceptorOneSwimlane interceptor = new UGraphicInterceptorOneSwimlane( + new UGraphicForSnake(limitFinder), swimlane, swimlanes()); + full.drawU(interceptor); + interceptor.flushUg(); + final MinMax minMax = limitFinder.getMinMax(); + swimlane.setMinMax(minMax); + } + } + + private void computeSizeInternal(UGraphic ug, TextBlock full) { + computeDrawingWidths(ug, full); + + double min = skinParam.swimlaneWidth(); + + if (min == ISkinParam.SWIMLANE_WIDTH_SAME) { + for (Swimlane swimlane : swimlanes()) { + min = Math.max(min, getWidthWithoutTitle(swimlane)); + } + } + final StringBounder stringBounder = ug.getStringBounder(); + + for (int i = 0; i < swimlanesSpecial().size(); i++) { + final Swimlane swimlane = swimlanesSpecial().get(i); + final double swimlaneActualWidth = MathUtils.max(min, getWidthWithoutTitle(swimlane)); + swimlane.setWidth(swimlaneActualWidth); + } + + final UTranslate titleHeightTranslate = getTitleHeightTranslate(stringBounder); + final Dimension2D dimensionFull = full.calculateDimension(stringBounder); + + dividers.clear(); + double xpos = 0; + for (int i = 0; i < swimlanesSpecial().size(); i++) { + final Swimlane swimlane = swimlanesSpecial().get(i); + double x1 = getHalfMissingSpace(stringBounder, i, min); + double x2 = getHalfMissingSpace(stringBounder, i + 1, min); + final LaneDivider laneDivider = new LaneDivider(skinParam, x1, x2, + dimensionFull.getHeight() + titleHeightTranslate.getDy()); + dividers.add(laneDivider); + + final double xx = xpos + laneDivider.getWidth() - swimlane.getMinMax().getMinX() + + (swimlane.getActualWidth() - getWidthWithoutTitle(swimlane)) / 2.0; + swimlane.setTranslate(UTranslate.dx(xx)); + + xpos += swimlane.getActualWidth() + laneDivider.getWidth(); + } + assert dividers.size() == swimlanes().size() + 1; + } + + public double getHalfMissingSpace(StringBounder stringBounder, int i, double min) { + if (i == 0 || i > swimlanesSpecial().size()) { + return 5; + } + final Swimlane swimlane = swimlanesSpecial().get(i - 1); + final double swimlaneActualWidth = Math.max(min, getWidthWithoutTitle(swimlane)); + final double titleWidth = getTitle(swimlane).calculateDimension(stringBounder).getWidth(); + if (titleWidth <= swimlaneActualWidth) { + return 5; + } + assert titleWidth > swimlaneActualWidth; + return Math.max(5, 5 + (titleWidth - swimlaneActualWidth) / 2); + } + + private double getWidthWithoutTitle(Swimlane swimlane) { + return swimlane.getMinMax().getWidth(); + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return getMinMax(stringBounder).getDimension(); + } + + public Instruction getCurrent() { + return currentInstruction; + } + + public void setCurrent(Instruction current) { + this.currentInstruction = current; + } + + public LinkRendering nextLinkRenderer() { + return nextLinkRenderer; + } + + public void setNextLinkRenderer(LinkRendering link) { + if (link == null) { + throw new IllegalArgumentException(); + } + this.nextLinkRenderer = link; + } + + public Swimlane getCurrentSwimlane() { + return currentSwimlane; + } + + private MinMax cachedMinMax; + + @Override + public MinMax getMinMax(StringBounder stringBounder) { + if (cachedMinMax == null) { + cachedMinMax = TextBlockUtils.getMinMax(this, stringBounder, false); + } + return cachedMinMax; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesA.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesA.java deleted file mode 100644 index bc3ec0088..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesA.java +++ /dev/null @@ -1,320 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.activitydiagram3.ftile; - -import java.awt.geom.Dimension2D; -import java.util.ArrayList; -import java.util.List; - -import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.Pragma; -import net.sourceforge.plantuml.SkinParam; -import net.sourceforge.plantuml.activitydiagram3.Instruction; -import net.sourceforge.plantuml.activitydiagram3.InstructionList; -import net.sourceforge.plantuml.activitydiagram3.LinkRendering; -import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorAddNote; -import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorAddUrl; -import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorAssembly; -import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorCreateGroup; -import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorCreateParallel; -import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorIf; -import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorRepeat; -import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorSwitch; -import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDelegatorWhile; -import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.UGraphicInterceptorOneSwimlane; -import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.VCompactFactory; -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; -import net.sourceforge.plantuml.graphic.UGraphicDelegator; -import net.sourceforge.plantuml.graphic.color.ColorType; -import net.sourceforge.plantuml.style.SName; -import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.style.StyleDefinition; -import net.sourceforge.plantuml.style.Styleable; -import net.sourceforge.plantuml.svek.UGraphicForSnake; -import net.sourceforge.plantuml.ugraphic.LimitFinder; -import net.sourceforge.plantuml.ugraphic.MinMax; -import net.sourceforge.plantuml.ugraphic.UChange; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.URectangle; -import net.sourceforge.plantuml.ugraphic.UShape; -import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.comp.SlotSet; -import net.sourceforge.plantuml.utils.MathUtils; - -public class SwimlanesA extends AbstractTextBlock implements TextBlock, Styleable { - - protected final ISkinParam skinParam;; - private final Pragma pragma; - - protected final List swimlanes = new ArrayList(); - private Swimlane currentSwimlane = null; - - private final Instruction root = new InstructionList(); - private Instruction currentInstruction = root; - - private LinkRendering nextLinkRenderer = LinkRendering.none(); - private Style style; - - public StyleDefinition getDefaultStyleDefinition() { - return StyleDefinition.of(SName.root, SName.element, SName.classDiagram, SName.swimlane); - } - - public SwimlanesA(ISkinParam skinParam, Pragma pragma) { - this.skinParam = skinParam; - this.pragma = pragma; - } - - protected Style getStyle() { - if (style == null) { - this.style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); - } - return style; - } - - private FtileFactory getFtileFactory(StringBounder stringBounder) { - FtileFactory factory = new VCompactFactory(skinParam, stringBounder); - factory = new FtileFactoryDelegatorAddUrl(factory); - factory = new FtileFactoryDelegatorAssembly(factory); - factory = new FtileFactoryDelegatorIf(factory, pragma); - factory = new FtileFactoryDelegatorSwitch(factory); - factory = new FtileFactoryDelegatorWhile(factory); - factory = new FtileFactoryDelegatorRepeat(factory); - factory = new FtileFactoryDelegatorCreateParallel(factory); - // factory = new FtileFactoryDelegatorCreateParallelAddingMargin(new - // FtileFactoryDelegatorCreateParallel1(factory)); - factory = new FtileFactoryDelegatorAddNote(factory); - factory = new FtileFactoryDelegatorCreateGroup(factory); - return factory; - } - - public void swimlane(String name, HtmlColor color, Display label) { - currentSwimlane = getOrCreate(name); - if (color != null) { - currentSwimlane.setSpecificColorTOBEREMOVED(ColorType.BACK, color); - } - if (Display.isNull(label) == false) { - currentSwimlane.setDisplay(label); - } - } - - private Swimlane getOrCreate(String name) { - for (Swimlane s : swimlanes) { - if (s.getName().equals(name)) { - return s; - } - } - final Swimlane result = new Swimlane(name); - swimlanes.add(result); - return result; - } - - class Cross extends UGraphicDelegator { - - private Cross(UGraphic ug) { - super(ug); - } - - @Override - public void draw(UShape shape) { - if (shape instanceof Ftile) { - final Ftile tile = (Ftile) shape; - tile.drawU(this); - } else if (shape instanceof Connection) { - final Connection connection = (Connection) shape; - final Ftile tile1 = connection.getFtile1(); - final Ftile tile2 = connection.getFtile2(); - - if (tile1 == null || tile2 == null) { - return; - } - if (tile1.getSwimlaneOut() != tile2.getSwimlaneIn()) { - final ConnectionCross connectionCross = new ConnectionCross(connection); - connectionCross.drawU(getUg()); - } - } - } - - public UGraphic apply(UChange change) { - return new Cross(getUg().apply(change)); - } - - } - - static protected final double separationMargin = 10; - - private TextBlock full; - - public void drawU(UGraphic ug) { - if (full == null) { - final FtileFactory factory = getFtileFactory(ug.getStringBounder()); - full = root.createFtile(factory); - if (swimlanes.size() <= 1) { - // BUG42 - full = new TextBlockInterceptorUDrawable(full); - } - } - - ug = new UGraphicForSnake(ug); - if (swimlanes.size() <= 1) { - full.drawU(ug); - ug.flushUg(); - return; - } - - drawWhenSwimlanes(ug, full); - } - - static private void printDebug(UGraphic ug, SlotSet slot, HtmlColor col, TextBlock full) { - slot.drawDebugX(ug.apply(new UChangeColor(col)).apply(new UChangeBackColor(col)), - full.calculateDimension(ug.getStringBounder()).getHeight()); - - } - - protected void drawWhenSwimlanes(final UGraphic ug, TextBlock full) { - final StringBounder stringBounder = ug.getStringBounder(); - final Dimension2D dimensionFull = full.calculateDimension(stringBounder); - - computeSize(ug, full); - final UTranslate titleHeightTranslate = getTitleHeightTranslate(stringBounder); - - double x2 = 0; - for (Swimlane swimlane : swimlanes) { - final HtmlColor back = swimlane.getColors(skinParam).getColor(ColorType.BACK); - if (back != null) { - final UGraphic background = ug.apply(new UChangeBackColor(back)).apply(new UChangeColor(back)) - .apply(new UTranslate(x2, 0)); - background.draw(new URectangle(swimlane.getActualWidth(), dimensionFull.getHeight() - + titleHeightTranslate.getDy())); - } - - full.drawU(new UGraphicInterceptorOneSwimlane(ug, swimlane).apply(swimlane.getTranslate()).apply( - titleHeightTranslate)); - x2 += swimlane.getActualWidth(); - - } - final Cross cross = new Cross(ug.apply(titleHeightTranslate)); - full.drawU(cross); - cross.flushUg(); - } - - protected UTranslate getTitleHeightTranslate(final StringBounder stringBounder) { - return new UTranslate(); - } - - private void computeDrawingWidths(UGraphic ug, TextBlock full) { - final StringBounder stringBounder = ug.getStringBounder(); - for (Swimlane swimlane : swimlanes) { - final LimitFinder limitFinder = new LimitFinder(stringBounder, false); - final UGraphicInterceptorOneSwimlane interceptor = new UGraphicInterceptorOneSwimlane(new UGraphicForSnake( - limitFinder), swimlane); - full.drawU(interceptor); - interceptor.flushUg(); - final MinMax minMax = limitFinder.getMinMax(); - swimlane.setMinMax(minMax); - } - } - - private void computeSize(UGraphic ug, TextBlock full) { - computeDrawingWidths(ug, full); - double x1 = 0; - - double swimlaneWidth = skinParam.swimlaneWidth(); - - if (swimlaneWidth == ISkinParam.SWIMLANE_WIDTH_SAME) { - for (Swimlane swimlane : swimlanes) { - swimlaneWidth = Math.max(swimlaneWidth, rawDrawingWidth(swimlane)); - } - - } - for (Swimlane swimlane : swimlanes) { - final double swimlaneActualWidth = swimlaneActualWidth(ug.getStringBounder(), swimlaneWidth, swimlane); - - final UTranslate translate = new UTranslate(x1 - swimlane.getMinMax().getMinX() + separationMargin - + (swimlaneActualWidth - rawDrawingWidth(swimlane)) / 2.0, 0); - swimlane.setTranslateAndWidth(translate, swimlaneActualWidth); - - x1 += swimlaneActualWidth; - } - } - - protected double swimlaneActualWidth(StringBounder stringBounder, double swimlaneWidth, Swimlane swimlane) { - return MathUtils.max(swimlaneWidth, rawDrawingWidth(swimlane)); - } - - private double rawDrawingWidth(Swimlane swimlane) { - return swimlane.getMinMax().getWidth() + 2 * separationMargin; - } - - public Dimension2D calculateDimension(StringBounder stringBounder) { - return getMinMax(stringBounder).getDimension(); - } - - public Instruction getCurrent() { - return currentInstruction; - } - - public void setCurrent(Instruction current) { - this.currentInstruction = current; - } - - public LinkRendering nextLinkRenderer() { - return nextLinkRenderer; - } - - public void setNextLinkRenderer(LinkRendering link) { - if (link == null) { - throw new IllegalArgumentException(); - } - this.nextLinkRenderer = link; - } - - public Swimlane getCurrentSwimlane() { - return currentSwimlane; - } - - private MinMax cachedMinMax; - - @Override - public MinMax getMinMax(StringBounder stringBounder) { - if (cachedMinMax == null) { - cachedMinMax = TextBlockUtils.getMinMax(this, stringBounder); - } - return cachedMinMax; - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesB.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesB.java deleted file mode 100644 index 74826e389..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesB.java +++ /dev/null @@ -1,138 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.activitydiagram3.ftile; - -import net.sourceforge.plantuml.ColorParam; -import net.sourceforge.plantuml.FontParam; -import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.LineBreakStrategy; -import net.sourceforge.plantuml.Pragma; -import net.sourceforge.plantuml.SkinParam; -import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; -import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.style.PName; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.URectangle; -import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.utils.MathUtils; - -public class SwimlanesB extends SwimlanesA { - - public SwimlanesB(ISkinParam skinParam, Pragma pragma) { - super(skinParam, pragma); - } - - @Override - protected void drawWhenSwimlanes(UGraphic ug, TextBlock full) { - super.drawWhenSwimlanes(ug, full); - double x2 = 0; - - final StringBounder stringBounder = ug.getStringBounder(); - - HtmlColor color = skinParam.getHtmlColor(ColorParam.swimlaneTitleBackground, null, false); - if (SkinParam.USE_STYLES()) { - color = getStyle().value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); - } - if (color != null) { - final double titleHeight = getTitlesHeight(stringBounder); - final URectangle back = new URectangle(getTitlesWidth(stringBounder), titleHeight); - ug.apply(new UChangeBackColor(color)).apply(new UChangeColor(color)).draw(back); - } - for (Swimlane swimlane : swimlanes) { - final TextBlock swTitle = getTitle(swimlane); - final double titleWidth = swTitle.calculateDimension(stringBounder).getWidth(); - final double posTitle = x2 + (swimlane.getActualWidth() - titleWidth) / 2; - swTitle.drawU(ug.apply(new UTranslate(posTitle, 0))); - x2 += swimlane.getActualWidth(); - } - } - - private double getTitlesWidth(StringBounder stringBounder) { - double x2 = 0; - for (Swimlane swimlane : swimlanes) { - x2 += swimlane.getActualWidth(); - } - return x2; - } - - private TextBlock getTitle(Swimlane swimlane) { - final FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.SWIMLANE_TITLE, null); - - LineBreakStrategy wrap = getWrap(); - if (wrap.isAuto()) { - wrap = new LineBreakStrategy("" + ((int) swimlane.getActualWidth())); - } - - return swimlane.getDisplay().create(fontConfiguration, HorizontalAlignment.LEFT, skinParam, wrap); - } - - private LineBreakStrategy getWrap() { - LineBreakStrategy wrap = skinParam.swimlaneWrapTitleWidth(); - if (wrap == LineBreakStrategy.NONE) { - wrap = skinParam.wrapWidth(); - } - return wrap; - } - - @Override - protected double swimlaneActualWidth(StringBounder stringBounder, double swimlaneWidth, Swimlane swimlane) { - final double m1 = super.swimlaneActualWidth(stringBounder, swimlaneWidth, swimlane); - if (getWrap().isAuto()) { - return m1; - } - - final double titleWidth = getTitle(swimlane).calculateDimension(stringBounder).getWidth(); - return MathUtils.max(m1, titleWidth + 2 * separationMargin); - - } - - @Override - protected UTranslate getTitleHeightTranslate(final StringBounder stringBounder) { - double titlesHeight = getTitlesHeight(stringBounder); - return new UTranslate(0, titlesHeight > 0 ? titlesHeight + 5 : 0); - } - - private double getTitlesHeight(StringBounder stringBounder) { - double titlesHeight = 0; - for (Swimlane swimlane : swimlanes) { - final TextBlock swTitle = getTitle(swimlane); - titlesHeight = Math.max(titlesHeight, swTitle.calculateDimension(stringBounder).getHeight()); - } - return titlesHeight; - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesC.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesC.java deleted file mode 100644 index 57f3d068d..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesC.java +++ /dev/null @@ -1,84 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.activitydiagram3.ftile; - -import java.awt.geom.Dimension2D; - -import net.sourceforge.plantuml.ColorParam; -import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.LineParam; -import net.sourceforge.plantuml.Pragma; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.skin.rose.Rose; -import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.ULine; -import net.sourceforge.plantuml.ugraphic.UStroke; -import net.sourceforge.plantuml.ugraphic.UTranslate; - -public class SwimlanesC extends SwimlanesB { - - public SwimlanesC(ISkinParam skinParam, Pragma pragma) { - super(skinParam, pragma); - } - - @Override - protected void drawWhenSwimlanes(UGraphic ug, TextBlock full) { - super.drawWhenSwimlanes(ug, full); - double x2 = 0; - - final StringBounder stringBounder = ug.getStringBounder(); - final Dimension2D dimensionFull = full.calculateDimension(stringBounder); - - final UTranslate titleHeightTranslate = getTitleHeightTranslate(stringBounder); - - for (Swimlane swimlane : swimlanes) { - drawSeparation(ug.apply(new UTranslate(x2, 0)), dimensionFull.getHeight() + titleHeightTranslate.getDy()); - - x2 += swimlane.getActualWidth(); - - } - drawSeparation(ug.apply(new UTranslate(x2, 0)), dimensionFull.getHeight() + titleHeightTranslate.getDy()); - - } - - private void drawSeparation(UGraphic ug, double height) { - HtmlColor color = skinParam.getHtmlColor(ColorParam.swimlaneBorder, null, false); - if (color == null) { - color = ColorParam.swimlaneBorder.getDefaultValue(); - } - final UStroke thickness = Rose.getStroke(skinParam, LineParam.swimlaneBorder, 2); - ug.apply(thickness).apply(new UChangeColor(color)).draw(new ULine(0, height)); - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/TextBlockInterceptorUDrawable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/TextBlockInterceptorUDrawable.java index 6c6165c27..192a9e487 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/TextBlockInterceptorUDrawable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/TextBlockInterceptorUDrawable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/UGraphicInterceptorUDrawable2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/UGraphicInterceptorUDrawable2.java index fa3e7176f..e1ec0361d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/UGraphicInterceptorUDrawable2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/UGraphicInterceptorUDrawable2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,18 +33,16 @@ import java.awt.geom.Point2D; import java.util.Map; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UGraphicDelegator; import net.sourceforge.plantuml.svek.UGraphicForSnake; import net.sourceforge.plantuml.ugraphic.UChange; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class UGraphicInterceptorUDrawable2 extends UGraphicDelegator { @@ -84,8 +82,8 @@ private UTranslate getPosition() { private void drawGoto(FtileGoto ftile) { final FtileGeometry geom = ftile.calculateDimension(getStringBounder()); final Point2D pt = geom.getPointIn(); - UGraphic ugGoto = getUg().apply(new UChangeColor(HtmlColorUtils.GREEN)).apply( - new UChangeBackColor(HtmlColorUtils.GREEN)); + UGraphic ugGoto = getUg().apply(HColorUtils.GREEN).apply( + HColorUtils.GREEN.bg()); ugGoto = ugGoto.apply(new UTranslate(pt)); final UTranslate posNow = getPosition(); final UTranslate dest = positions.get(ftile.getName()); @@ -93,8 +91,8 @@ private void drawGoto(FtileGoto ftile) { final double dy = dest.getDy() - posNow.getDy(); ugGoto.draw(new UEllipse(3, 3)); ugGoto.apply(new UTranslate(dx, dy)).draw(new UEllipse(3, 3)); - ugGoto.draw(new ULine(dx, 0)); - ugGoto.apply(new UTranslate(dx, 0)).draw(new ULine(0, dy)); + ugGoto.draw(ULine.hline(dx)); + ugGoto.apply(UTranslate.dx(dx)).draw(ULine.vline(dy)); // ugGoto.draw(new ULine(dx, dy)); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/WeldingPoint.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/WeldingPoint.java index a22987338..0be4dcd42 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/WeldingPoint.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/WeldingPoint.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Worm.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Worm.java index 1f6ac4117..02a374847 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Worm.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Worm.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,16 +40,14 @@ import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.cucadiagram.LinkStyle; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.ugraphic.MinMax; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.comp.CompressionMode; public class Worm implements Iterable { @@ -62,22 +60,22 @@ public boolean isPureHorizontal() { private boolean ignoreForCompression; - public final void setIgnoreForCompression(boolean ignoreForCompression) { - this.ignoreForCompression = ignoreForCompression; + public final void setIgnoreForCompression() { + this.ignoreForCompression = true; } - public void drawInternalOneColor(UPolygon startDecoration, UGraphic ug, HtmlColorAndStyle color, double stroke, - Direction emphasizeDirection, UPolygon endDecoration) { - final HtmlColor color2 = color.getColor(); - if (color2 == null) { + public void drawInternalOneColor(UPolygon startDecoration, UGraphic ug, HtmlColorAndStyle colorAndStyle, + double stroke, Direction emphasizeDirection, UPolygon endDecoration) { + final HColor arrowColor = colorAndStyle.getArrowColor(); + if (arrowColor == null) { throw new IllegalArgumentException(); } - final LinkStyle style = color.getStyle(); + final LinkStyle style = colorAndStyle.getStyle(); if (style.isInvisible()) { return; } - ug = ug.apply(new UChangeColor(color2)); - ug = ug.apply(new UChangeBackColor(color2)); + ug = ug.apply(arrowColor); + ug = ug.apply(arrowColor.bg()); if (style.isNormal()) { ug = ug.apply(new UStroke(stroke)); } else { @@ -95,11 +93,22 @@ public void drawInternalOneColor(UPolygon startDecoration, UGraphic ug, HtmlColo drawLine(ug, line, null); } } + + final HColor arrowHeadColor = colorAndStyle.getArrowHeadColor(); + if (arrowHeadColor == null) { + throw new IllegalStateException(); + } +// if (arrowHeadColor == null || arrowHeadColor.equals(HColorUtils.transparent())) { +// return; +// } + ug = ug.apply(arrowHeadColor); + ug = ug.apply(arrowHeadColor.bg()); + if (startDecoration != null) { ug = ug.apply(new UStroke(1.5)); final Point2D start = points.get(0); if (ignoreForCompression) { - startDecoration.setIgnoreForCompression(CompressionMode.ON_X); + startDecoration.setCompressionMode(CompressionMode.ON_X); } ug.apply(new UTranslate(start)).apply(new UStroke()).draw(startDecoration); } @@ -107,7 +116,7 @@ public void drawInternalOneColor(UPolygon startDecoration, UGraphic ug, HtmlColo ug = ug.apply(new UStroke(1.5)); final Point2D end = points.get(points.size() - 1); if (ignoreForCompression) { - endDecoration.setIgnoreForCompression(CompressionMode.ON_X); + endDecoration.setCompressionMode(CompressionMode.ON_X); } ug.apply(new UTranslate(end)).apply(new UStroke()).draw(endDecoration); } @@ -201,6 +210,12 @@ public String toString() { } public void addPoint(double x, double y) { + if (Double.isNaN(x)) { + throw new IllegalArgumentException(); + } + if (Double.isNaN(y)) { + throw new IllegalArgumentException(); + } if (points.size() > 0) { final Point2D last = getLast(); if (last.getX() == x && last.getY() == y) { @@ -347,7 +362,8 @@ private boolean removePattern1() { for (int i = 0; i < points.size() - 5; i++) { final List patternAt = getPatternAt(i); if (Arrays.asList(Direction.DOWN, Direction.LEFT, Direction.DOWN, Direction.RIGHT).equals(patternAt) - || Arrays.asList(Direction.DOWN, Direction.RIGHT, Direction.DOWN, Direction.LEFT).equals(patternAt)) { + || Arrays.asList(Direction.DOWN, Direction.RIGHT, Direction.DOWN, Direction.LEFT) + .equals(patternAt)) { final Point2D.Double newPoint = new Point2D.Double(points.get(i + 1).x, points.get(i + 3).y); points.remove(i + 3); points.remove(i + 2); @@ -395,7 +411,8 @@ private boolean removePattern3() { for (int i = 0; i < points.size() - 4; i++) { final List patternAt = getPatternAt(i); if (Arrays.asList(Direction.DOWN, Direction.RIGHT, Direction.DOWN, Direction.RIGHT).equals(patternAt) - || Arrays.asList(Direction.DOWN, Direction.LEFT, Direction.DOWN, Direction.LEFT).equals(patternAt)) { + || Arrays.asList(Direction.DOWN, Direction.LEFT, Direction.DOWN, Direction.LEFT) + .equals(patternAt)) { final Point2D.Double newPoint = new Point2D.Double(points.get(i + 1).x, points.get(i + 3).y); points.remove(i + 3); points.remove(i + 2); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java index 6352f4aec..1aab21447 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -130,19 +130,19 @@ private WormMutation(String definition, double delta) { private static UTranslate translation(int type, double delta) { switch (type) { case 1: - return new UTranslate(0, -delta); + return UTranslate.dy(-delta); case 2: return new UTranslate(delta, -delta); case 3: - return new UTranslate(delta, 0); + return UTranslate.dx(delta); case 4: return new UTranslate(delta, delta); case 5: - return new UTranslate(0, delta); + return UTranslate.dy(delta); case 6: return new UTranslate(-delta, delta); case 7: - return new UTranslate(-delta, 0); + return UTranslate.dx(-delta); case 8: return new UTranslate(-delta, -delta); } @@ -177,7 +177,7 @@ public UTranslate getTextTranslate(int size) { for (UTranslate tr : translations) { result.append(tr.getDx()); } - return new UTranslate(result.getExtreme() * (size - 1), 0); + return UTranslate.dx(result.getExtreme() * (size - 1)); } public boolean isDxNegative() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormTexted.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormTexted.java index b643765d5..3059c90ac 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormTexted.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormTexted.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Zad.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Zad.java index 91e1ecec4..ba2a1522f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Zad.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/Zad.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,11 +33,9 @@ import java.util.ArrayList; import java.util.List; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.ugraphic.MinMax; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class Zad { @@ -50,7 +48,7 @@ public void add(MinMax rect) { } public void drawDebug(UGraphic ug) { - ug = ug.apply(new UChangeBackColor(HtmlColorUtils.BLUE)).apply(new UChangeColor(HtmlColorUtils.RED_LIGHT)); + ug = ug.apply(HColorUtils.BLUE.bg()).apply(HColorUtils.RED_LIGHT); for (MinMax minMax : rectangles) { System.err.println("minmax=" + minMax); minMax.drawGrey(ug); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/ZadBuilder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/ZadBuilder.java index 4bb216e2c..d2a8afbef 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/ZadBuilder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/ZadBuilder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,31 +30,31 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile; -import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.MinMax; +import net.sourceforge.plantuml.ugraphic.UBackground; import net.sourceforge.plantuml.ugraphic.UChange; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UGraphicNo; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParamNull; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; -public class ZadBuilder implements UGraphic { +public class ZadBuilder extends UGraphicNo implements UGraphic { public UGraphic apply(UChange change) { if (change instanceof UTranslate) { return new ZadBuilder(stringBounder, translate.compose((UTranslate) change), this.context); } else if (change instanceof UStroke) { return new ZadBuilder(this); - } else if (change instanceof UChangeBackColor) { + } else if (change instanceof UBackground) { return new ZadBuilder(this); - } else if (change instanceof UChangeColor) { + } else if (change instanceof HColor) { return new ZadBuilder(this); } throw new UnsupportedOperationException(); @@ -106,12 +106,6 @@ public ColorMapper getColorMapper() { throw new UnsupportedOperationException(); } - public void startUrl(Url url) { - } - - public void closeAction() { - } - public void flushUg() { } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/AbstractParallelFtilesBuilder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/AbstractParallelFtilesBuilder.java new file mode 100644 index 000000000..75fdfeb8c --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/AbstractParallelFtilesBuilder.java @@ -0,0 +1,156 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; + +import java.util.ArrayList; +import java.util.List; + +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; +import net.sourceforge.plantuml.activitydiagram3.LinkRendering; +import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; +import net.sourceforge.plantuml.activitydiagram3.ftile.FtileHeightFixedCentered; +import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; +import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; +import net.sourceforge.plantuml.creole.CreoleMode; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; + +public abstract class AbstractParallelFtilesBuilder { + + protected final double barHeight = 6; + + private final Rose rose = new Rose(); + + private final ISkinParam skinParam; + private final StringBounder stringBounder; + protected final List list99 = new ArrayList(); + + public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity); + } + + final public StyleSignature getDefaultStyleDefinitionArrow() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow); + } + + public AbstractParallelFtilesBuilder(ISkinParam skinParam, StringBounder stringBounder, List all) { + this.skinParam = skinParam; + this.stringBounder = stringBounder; + this.list99.addAll(getFoo2(all)); + } + + protected List getFoo2(List all) { + final double maxHeight = computeMaxHeight(all); + final List result = new ArrayList(); + for (Ftile ftile : all) { + final Ftile newFtile = computeNewFtile(ftile, maxHeight); + result.add(newFtile); + } + return result; + } + + private Ftile computeNewFtile(Ftile ftile, double maxHeight) { + final double spaceArroundBlackBar = 20; + final double xMargin = 14; + Ftile tmp; + tmp = FtileUtils.addHorizontalMargin(ftile, xMargin); + tmp = new FtileHeightFixedCentered(tmp, maxHeight + 2 * spaceArroundBlackBar); + return tmp; + } + + final protected double computeMaxHeight(List all) { + double height = 0; + for (Ftile tmp : all) { + height = Math.max(height, tmp.calculateDimension(getStringBounder()).getHeight()); + } + return height; + } + + public final Ftile build(Ftile inner) { + final Ftile step1 = doStep1(inner); + return doStep2(inner, step1); + } + + protected abstract Ftile doStep1(Ftile inner); + + protected abstract Ftile doStep2(Ftile inner, Ftile step1); + + protected StringBounder getStringBounder() { + return stringBounder; + } + + protected Rose getRose() { + return rose; + } + + protected ISkinParam skinParam() { + return skinParam; + } + + protected final TextBlock getTextBlock(Display display) { + // DUP3945 + if (Display.isNull(display)) { + return null; + } + final FontConfiguration fontConfiguration; + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder()); + fontConfiguration = style.getFontConfiguration(skinParam().getIHtmlColorSet()); + } else { + fontConfiguration = new FontConfiguration(skinParam(), FontParam.ARROW, null); + } + return display.create7(fontConfiguration, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE); + } + + protected TextBlock getTextBlock(LinkRendering linkRendering) { + // DUP1433 + final Display display = linkRendering.getDisplay(); + return getTextBlock(display); + } + + protected final double getHeightOfMiddle(Ftile middle) { + return middle.calculateDimension(getStringBounder()).getHeight(); + } + + protected Swimlane swimlaneOutForStep2() { + return list99.get(list99.size() - 1).getSwimlaneOut(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ConnectionVerticalDown.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ConnectionVerticalDown.java index 1123643e5..63e7c25dd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ConnectionVerticalDown.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ConnectionVerticalDown.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java index b9b2f45a2..a732bc983 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,7 +37,7 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.creole.CreoleMode; -import net.sourceforge.plantuml.creole.CreoleParser; +import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.creole.Sheet; import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.creole.SheetBlock2; @@ -46,13 +46,13 @@ import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.svek.image.Opale; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FloatingNote extends AbstractTextBlock implements Stencil, TextBlock { @@ -62,16 +62,19 @@ public FloatingNote(Display note, ISkinParam skinParam) { final Rose rose = new Rose(); - final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); - final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); + final HColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); + final HColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); - final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), - skinParam, CreoleMode.FULL).createSheet(note); - final SheetBlock2 sheetBlock2 = new SheetBlock2(new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()), this, - new UStroke(1)); - this.opale = new Opale(borderColor, noteBackgroundColor, sheetBlock2, skinParam.shadowing(null), false); + final Sheet sheet = Parser + .build(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL) + .createSheet(note); + final SheetBlock2 sheetBlock2 = new SheetBlock2( + new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()), this, new UStroke(1)); + final double shadowing; + shadowing = skinParam.shadowing(null) ? 4 : 0; + this.opale = new Opale(shadowing, borderColor, noteBackgroundColor, sheetBlock2, false); // this.text = sheetBlock2; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddNote.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddNote.java index c25695e9c..61284fdcf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddNote.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddNote.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddUrl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddUrl.java index 1a5df421a..eec3ccb80 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddUrl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddUrl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAssembly.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAssembly.java index faa95a958..be1992f50 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAssembly.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAssembly.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java index 5a93d3cf6..dbf285379 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,9 +38,9 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileFactoryDelegatorCreateGroup extends FtileFactoryDelegator { @@ -51,9 +51,9 @@ public FtileFactoryDelegatorCreateGroup(FtileFactory factory) { } @Override - public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, PositionedNote note, - HtmlColor borderColor, USymbol type, double roundCorner) { - final HtmlColor arrowColor = rose.getHtmlColor(skinParam(), ColorParam.arrow); + public Ftile createGroup(Ftile list, Display name, HColor backColor, HColor titleColor, PositionedNote note, + HColor borderColor, USymbol type, double roundCorner) { + final HColor arrowColor = rose.getHtmlColor(skinParam(), ColorParam.arrow); Ftile result = new FtileGroup(list, name, null, arrowColor, backColor, titleColor, skinParam(), borderColor, type, roundCorner); if (note != null) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateParallel.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateParallel.java index 5132657bc..9c73a17b6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateParallel.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateParallel.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,55 +30,35 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; -import java.awt.geom.Dimension2D; -import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.activitydiagram3.ForkStyle; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileHeightFixed; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -public class FtileFactoryDelegatorCreateParallel extends FtileFactoryDelegator { - - private final double spaceArroundBlackBar = 20; - private final double xMargin = 14; +public final class FtileFactoryDelegatorCreateParallel extends FtileFactoryDelegator { public FtileFactoryDelegatorCreateParallel(FtileFactory factory) { super(factory); } - private Ftile allOverlapped(Swimlane swimlane, List all, ForkStyle style, String label) { - return new FtileForkInnerOverlapped(all); - } - @Override - public Ftile createParallel(Swimlane swimlane, List all, ForkStyle style, String label) { - - final Dimension2D dimSuper = super.createParallel(swimlane, all, style, label).calculateDimension(getStringBounder()); - final double height1 = dimSuper.getHeight() + 2 * spaceArroundBlackBar; - - final List list = new ArrayList(); - for (Ftile tmp : all) { - list.add(new FtileHeightFixed(FtileUtils.addHorizontalMargin(tmp, xMargin), height1)); - } - final Ftile inner = super.createParallel(swimlane, list, style, label); - - ParallelFtilesBuilder builder; + public Ftile createParallel(List all, ForkStyle style, String label, Swimlane in, Swimlane out) { + AbstractParallelFtilesBuilder builder; if (style == ForkStyle.SPLIT) { - builder = new ParallelBuilderSplit2(skinParam(), getStringBounder(), list, inner, swimlane); + builder = new ParallelBuilderSplit(skinParam(), getStringBounder(), all); } else if (style == ForkStyle.MERGE) { - builder = new ParallelBuilderMerge(skinParam(), getStringBounder(), list, inner, swimlane); + builder = new ParallelBuilderMerge(skinParam(), getStringBounder(), all); } else if (style == ForkStyle.FORK) { - builder = new ParallelBuilderFork(skinParam(), getStringBounder(), list, inner, swimlane, label); + builder = new ParallelBuilderFork(skinParam(), getStringBounder(), label, in, out, all); } else { throw new IllegalStateException(); } - return builder.build(); + final Ftile inner = super.createParallel(builder.list99, style, label, in, out); + return builder.build(inner); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateParallel1.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateParallel1.java deleted file mode 100644 index a218ed3b7..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateParallel1.java +++ /dev/null @@ -1,70 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; - -import java.util.List; - -import net.sourceforge.plantuml.activitydiagram3.ForkStyle; -import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; -import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; - -public class FtileFactoryDelegatorCreateParallel1 extends FtileFactoryDelegator { - - public FtileFactoryDelegatorCreateParallel1(FtileFactory factory) { - super(factory); - } - - private Ftile allOverlapped(Swimlane swimlane, List all, ForkStyle style, String label) { - return new FtileForkInnerOverlapped(all); - } - - @Override - public Ftile createParallel(Swimlane swimlane, List list, ForkStyle style, String label) { - - final Ftile inner = super.createParallel(swimlane, list, style, label); - - ParallelFtilesBuilder builder; - - if (style == ForkStyle.SPLIT) { - builder = new ParallelBuilderSplit(skinParam(), getStringBounder(), list, inner, swimlane); - } else if (style == ForkStyle.MERGE) { - builder = new ParallelBuilderMerge(skinParam(), getStringBounder(), list, inner, swimlane); - } else if (style == ForkStyle.FORK) { - builder = new ParallelBuilderFork(skinParam(), getStringBounder(), list, inner, swimlane, label); - } else { - throw new IllegalStateException(); - } - return builder.build(); - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateParallelAddingMargin.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateParallelAddingMargin.java deleted file mode 100644 index dda04b658..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateParallelAddingMargin.java +++ /dev/null @@ -1,68 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; - -import java.awt.geom.Dimension2D; -import java.util.ArrayList; -import java.util.List; - -import net.sourceforge.plantuml.activitydiagram3.ForkStyle; -import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileHeightFixed; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; -import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; - -public class FtileFactoryDelegatorCreateParallelAddingMargin extends FtileFactoryDelegator { - - private final double spaceArroundBlackBar = 20; - private final double xMargin = 14; - - public FtileFactoryDelegatorCreateParallelAddingMargin(FtileFactory factory) { - super(factory); - } - - @Override - public Ftile createParallel(Swimlane swimlane, List all, ForkStyle style, String label) { - - final Dimension2D dimSuper = super.createParallel(swimlane, all, style, label).calculateDimension( - getStringBounder()); - final double height1 = dimSuper.getHeight() + 2 * spaceArroundBlackBar; - - final List list = new ArrayList(); - for (Ftile tmp : all) { - list.add(new FtileHeightFixed(FtileUtils.addHorizontalMargin(tmp, xMargin), height1)); - } - return super.createParallel(swimlane, list, style, label); - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java index 7314dffcc..3d7aa3f33 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,6 +35,7 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.Pragma; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; @@ -44,11 +45,12 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.ConditionalBuilder; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.Rainbow; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.svek.ConditionEndStyle; import net.sourceforge.plantuml.svek.ConditionStyle; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileFactoryDelegatorIf extends FtileFactoryDelegator { @@ -67,17 +69,33 @@ public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch, final ConditionEndStyle conditionEndStyle = skinParam().getConditionEndStyle(); final Branch branch0 = thens.get(0); - final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); - final HtmlColor backColor = branch0.getColor() == null ? getRose().getHtmlColor(skinParam(), - ColorParam.activityDiamondBackground) : branch0.getColor(); - final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam()); - - final FontConfiguration fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null); - + final HColor borderColor; + final HColor backColor; + final Rainbow arrowColor; + final FontConfiguration fcTest; final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ARROW; - final FontConfiguration fcTest = new FontConfiguration(skinParam(), testParam, null) - .changeColor(fontColor(FontParam.ACTIVITY_DIAMOND)); + final FontConfiguration fcArrow; + if (SkinParam.USE_STYLES()) { + final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle( + skinParam().getCurrentStyleBuilder()); + final Style styleDiamond = getDefaultStyleDefinitionDiamond().getMergedStyle( + skinParam().getCurrentStyleBuilder()); + borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getIHtmlColorSet()); + backColor = branch0.getColor() == null ? styleDiamond.value(PName.BackGroundColor).asColor( + skinParam().getIHtmlColorSet()) : branch0.getColor(); + arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet()); + fcTest = styleDiamond.getFontConfiguration(skinParam().getIHtmlColorSet()); + fcArrow = styleArrow.getFontConfiguration(skinParam().getIHtmlColorSet()); + } else { + borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); + backColor = branch0.getColor() == null ? getRose().getHtmlColor(skinParam(), + ColorParam.activityDiamondBackground) : branch0.getColor(); + arrowColor = Rainbow.build(skinParam()); + fcTest = new FontConfiguration(skinParam(), testParam, null) + .changeColor(fontColor(FontParam.ACTIVITY_DIAMOND)); + fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null); + } if (thens.size() > 1) { if (pragma.useVerticalIf()/* OptionFlags.USE_IF_VERTICAL */) @@ -90,7 +108,7 @@ public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch, conditionEndStyle, thens.get(0), elseBranch, skinParam(), getStringBounder(), fcArrow, fcTest, url); } - private HtmlColor fontColor(FontParam param) { + private HColor fontColor(FontParam param) { return skinParam().getFontHtmlColor(null, param); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java index 6b45d498d..a2f8539a8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,6 +35,7 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; @@ -51,13 +52,15 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.Rainbow; +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.svek.ConditionStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator { @@ -66,35 +69,55 @@ public FtileFactoryDelegatorRepeat(FtileFactory factory) { } @Override - public Ftile repeat(Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, final Ftile repeat, Display test, - Display yes, Display out, HtmlColor color, LinkRendering backRepeatLinkRendering, Ftile backward, - boolean noOut) { + public Ftile repeat(BoxStyle boxStyleIn, Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, + final Ftile repeat, Display test, Display yes, Display out, Colors colors, + LinkRendering backRepeatLinkRendering, Ftile backward, boolean noOut) { final ConditionStyle conditionStyle = skinParam().getConditionStyle(); - final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); - final HtmlColor backColor = color == null ? getRose().getHtmlColor(skinParam(), - ColorParam.activityDiamondBackground) : color; - final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam()); + final HColor borderColor; + final HColor diamondColor; + final Rainbow arrowColor; + final FontConfiguration fcDiamond; + final FontConfiguration fcArrow; + if (SkinParam.USE_STYLES()) { + final Style styleArrow = getDefaultStyleDefinitionArrow() + .getMergedStyle(skinParam().getCurrentStyleBuilder()); + final Style styleDiamond = getDefaultStyleDefinitionDiamond() + .getMergedStyle(skinParam().getCurrentStyleBuilder()); + borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getIHtmlColorSet()); + diamondColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam().getIHtmlColorSet()); + arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet()); + fcDiamond = styleDiamond.getFontConfiguration(skinParam().getIHtmlColorSet()); + fcArrow = styleArrow.getFontConfiguration(skinParam().getIHtmlColorSet()); + } else { + borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); + // diamondColor = color == null ? getRose().getHtmlColor(skinParam(), + // ColorParam.activityDiamondBackground) : color; + if (colors.getColor(ColorType.BACK) != null && Display.isNull(startLabel)) { + diamondColor = colors.getColor(ColorType.BACK); + } else { + diamondColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground); + } + arrowColor = Rainbow.build(skinParam()); + fcDiamond = new FontConfiguration(skinParam(), FontParam.ACTIVITY_DIAMOND, null); + fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null); + } final LinkRendering endRepeatLinkRendering = repeat.getOutLinkRendering(); final Rainbow endRepeatLinkColor = endRepeatLinkRendering == null ? null : endRepeatLinkRendering.getRainbow(); - final FontConfiguration fcDiamond = new FontConfiguration(skinParam(), FontParam.ACTIVITY_DIAMOND, null); - final FontConfiguration fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null); - - final Ftile backStart = Display.isNull(startLabel) ? null : this.activity(startLabel, swimlane, BoxStyle.PLAIN, - Colors.empty()); + final Ftile entry = getEntry(swimlane, startLabel, colors, boxStyleIn); - Ftile result = FtileRepeat.create(backRepeatLinkRendering, swimlane, swimlaneOut, backStart, repeat, test, yes, - out, borderColor, backColor, arrowColor, endRepeatLinkColor, conditionStyle, this.skinParam(), - fcDiamond, fcArrow, backward, noOut); + Ftile result = FtileRepeat.create(backRepeatLinkRendering, swimlane, swimlaneOut, entry, repeat, test, yes, out, + borderColor, diamondColor, arrowColor, endRepeatLinkColor, conditionStyle, this.skinParam(), fcDiamond, + fcArrow, backward, noOut); final List weldingPoints = repeat.getWeldingPoints(); if (weldingPoints.size() > 0) { // printAllChild(repeat); - final Ftile diamondBreak = new FtileDiamond(repeat.skinParam(), backColor, borderColor, swimlane); + final Ftile diamondBreak = new FtileDiamond(repeat.skinParam(), diamondColor, borderColor, swimlane); result = assembly(FtileUtils.addHorizontalMargin(result, 10, 0), diamondBreak); final Genealogy genealogy = new Genealogy(result); @@ -106,8 +129,8 @@ public void drawU(UGraphic ug) { final UTranslate tr2 = genealogy.getTranslate(diamondBreak, ug.getStringBounder()); final Dimension2D dimDiamond = diamondBreak.calculateDimension(ug.getStringBounder()); - final Snake snake = new Snake(getFtile1().arrowHorizontalAlignment(), arrowColor, Arrows - .asToRight()); + final Snake snake = new Snake(getFtile1().arrowHorizontalAlignment(), arrowColor, + Arrows.asToRight()); snake.addPoint(tr1.getDx(), tr1.getDy()); snake.addPoint(0, tr1.getDy()); snake.addPoint(0, tr2.getDy() + dimDiamond.getHeight() / 2); @@ -128,4 +151,12 @@ public Ftile getFtile2() { } return result; } + + private Ftile getEntry(Swimlane swimlane, Display startLabel, Colors colors, BoxStyle boxStyleIn) { + if (Display.isNull(startLabel)) { + return null; + } + // final Colors colors = Colors.empty().add(ColorType.BACK, back); + return this.activity(startLabel, swimlane, boxStyleIn, colors); + } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorSwitch.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorSwitch.java index c3616701f..89251008d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorSwitch.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorSwitch.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,21 +40,20 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth; +import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidthCentered; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchNude; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithDiamonds; -import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithOneLink; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithManyLinks; +import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithOneLink; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator { @@ -73,7 +72,7 @@ public Ftile createSwitch(Swimlane swimlane, List branches, LinkRenderin private Ftile createNude(Swimlane swimlane, List branches) { final List ftiles = new ArrayList(); for (Branch branch : branches) { - ftiles.add(new FtileMinWidth(branch.getFtile(), 30)); + ftiles.add(new FtileMinWidthCentered(branch.getFtile(), 30)); } return new FtileSwitchNude(ftiles, swimlane); } @@ -81,7 +80,7 @@ private Ftile createNude(Swimlane swimlane, List branches) { private Ftile createWithDiamonds(Swimlane swimlane, List branches, Display labelTest) { final List ftiles = new ArrayList(); for (Branch branch : branches) { - ftiles.add(new FtileMinWidth(branch.getFtile(), 30)); + ftiles.add(new FtileMinWidthCentered(branch.getFtile(), 30)); } final Ftile diamond1 = getDiamond1(swimlane, branches.get(0), labelTest); final Ftile diamond2 = getDiamond2(swimlane, branches.get(0)); @@ -94,9 +93,9 @@ private Ftile createWithLinks(Swimlane swimlane, List branches, Display final Ftile diamond1 = getDiamond1(swimlane, branches.get(0), labelTest); final Ftile diamond2 = getDiamond2(swimlane, branches.get(0)); for (Branch branch : branches) { - ftiles.add(new FtileMinWidth(branch.getFtile(), 30)); + ftiles.add(new FtileMinWidthCentered(branch.getFtile(), 30)); } - final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam()); + final Rainbow arrowColor = Rainbow.build(skinParam()); if (ftiles.size() == 1) { final FtileSwitchWithOneLink result = new FtileSwitchWithOneLink(ftiles, branches, swimlane, diamond1, diamond2, getStringBounder(), arrowColor); @@ -109,8 +108,8 @@ private Ftile createWithLinks(Swimlane swimlane, List branches, Display } private Ftile getDiamond1(Swimlane swimlane, Branch branch0, Display test) { - final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); - final HtmlColor backColor = branch0.getColor() == null ? getRose().getHtmlColor(skinParam(), + final HColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); + final HColor backColor = branch0.getColor() == null ? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground) : branch0.getColor(); final FontConfiguration fcDiamond = new FontConfiguration(skinParam(), FontParam.ACTIVITY_DIAMOND, null); @@ -122,14 +121,14 @@ private Ftile getDiamond1(Swimlane swimlane, Branch branch0, Display test) { } private Ftile getDiamond2(Swimlane swimlane, Branch branch0) { - final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); - final HtmlColor backColor = branch0.getColor() == null ? getRose().getHtmlColor(skinParam(), + final HColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); + final HColor backColor = branch0.getColor() == null ? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground) : branch0.getColor(); return new FtileDiamondInside(branch0.skinParam(), backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0)); } - private HtmlColor fontColor(FontParam param) { + private HColor fontColor(FontParam param) { return skinParam().getFontHtmlColor(null, param); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java index d863eaa32..9697c9d55 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,6 +34,7 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.Instruction; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; @@ -50,12 +51,13 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.Rainbow; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator { @@ -65,25 +67,42 @@ public FtileFactoryDelegatorWhile(FtileFactory factory) { @Override public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out, - LinkRendering afterEndwhile, HtmlColor color, Instruction specialOut) { - final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); - final HtmlColor backColor = color == null ? getRose().getHtmlColor(skinParam(), - ColorParam.activityDiamondBackground) : color; - final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam()); + LinkRendering afterEndwhile, HColor color, Instruction specialOut, Ftile backward) { + final HColor borderColor; + final HColor backColor; + final Rainbow arrowColor; + final FontConfiguration fontArrow; + final FontConfiguration fcTest; final ConditionStyle conditionStyle = skinParam().getConditionStyle(); final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ARROW; - final FontConfiguration fcTest = new FontConfiguration(skinParam(), testParam, null); + if (SkinParam.USE_STYLES()) { + final Style styleArrow = getDefaultStyleDefinitionArrow() + .getMergedStyle(skinParam().getCurrentStyleBuilder()); + final Style styleDiamond = getDefaultStyleDefinitionDiamond() + .getMergedStyle(skinParam().getCurrentStyleBuilder()); + borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getIHtmlColorSet()); + backColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam().getIHtmlColorSet()); + arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet()); + fontArrow = styleArrow.getFontConfiguration(skinParam().getIHtmlColorSet()); + fcTest = styleDiamond.getFontConfiguration(skinParam().getIHtmlColorSet()); + } else { + borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); + backColor = color == null ? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground) + : color; + arrowColor = Rainbow.build(skinParam()); + fontArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null); + fcTest = new FontConfiguration(skinParam(), testParam, null); + } final LinkRendering endInlinkRendering = whileBlock.getOutLinkRendering(); - final Rainbow endInlinkColor = endInlinkRendering == null || endInlinkRendering.getRainbow().size() == 0 ? arrowColor + final Rainbow endInlinkColor = endInlinkRendering == null || endInlinkRendering.getRainbow().size() == 0 + ? arrowColor : endInlinkRendering.getRainbow(); - final FontConfiguration fontArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null); - Ftile result = FtileWhile.create(swimlane, whileBlock, test, borderColor, backColor, arrowColor, yes, out, - endInlinkColor, afterEndwhile, fontArrow, getFactory(), conditionStyle, fcTest, specialOut); + endInlinkColor, afterEndwhile, fontArrow, getFactory(), conditionStyle, fcTest, specialOut, backward); final List weldingPoints = whileBlock.getWeldingPoints(); if (weldingPoints.size() > 0) { @@ -97,8 +116,8 @@ public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Disp public void drawU(UGraphic ug) { final UTranslate tr1 = genealogy.getTranslate(ftileBreak, ug.getStringBounder()); - final Snake snake = new Snake(getFtile1().arrowHorizontalAlignment(), arrowColor, Arrows - .asToLeft()); + final Snake snake = new Snake(getFtile1().arrowHorizontalAlignment(), arrowColor, + Arrows.asToLeft()); snake.addPoint(tr1.getDx(), tr1.getDy()); snake.addPoint(Diamond.diamondHalfSize, tr1.getDy()); ug.draw(snake); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInner.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInner.java index 4f022062a..df788a0e1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInner.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInner.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -82,7 +82,7 @@ public void drawU(UGraphic ug) { double xpos = 0; for (Ftile ftile : forks) { - ug.apply(new UTranslate(xpos, 0)).draw(ftile); + ug.apply(UTranslate.dx(xpos)).draw(ftile); final Dimension2D dim = ftile.calculateDimension(stringBounder); xpos += dim.getWidth(); } @@ -107,7 +107,7 @@ public UTranslate getTranslateFor(Ftile searched, StringBounder stringBounder) { double xpos = 0; for (Ftile ftile : forks) { if (ftile == searched) { - return new UTranslate(xpos, 0); + return UTranslate.dx(xpos); } final Dimension2D dim = ftile.calculateDimension(stringBounder); xpos += dim.getWidth(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInnerOverlapped.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInnerOverlapped.java index 7d70a2c3a..e9ccbc5eb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInnerOverlapped.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInnerOverlapped.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -82,7 +82,7 @@ public void drawU(UGraphic ug) { final double xpos = 0; for (Ftile ftile : forks) { - ug.apply(new UTranslate(xpos, 0)).draw(ftile); + ug.apply(UTranslate.dx(xpos)).draw(ftile); // final Dimension2D dim = ftile.calculateDimension(stringBounder); // xpos += dim.getWidth(); } @@ -108,7 +108,7 @@ public UTranslate getTranslateFor(Ftile searched, StringBounder stringBounder) { final double xpos = 0; for (Ftile ftile : forks) { if (ftile == searched) { - return new UTranslate(xpos, 0); + return UTranslate.dx(xpos); } // final Dimension2D dim = ftile.calculateDimension(stringBounder); // xpos += dim.getWidth(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java index 4995dcf3b..57284772c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,6 +38,7 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; @@ -47,14 +48,16 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.UGraphicInterceptorUDrawable; 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; import net.sourceforge.plantuml.svek.UGraphicForSnake; import net.sourceforge.plantuml.ugraphic.LimitFinder; import net.sourceforge.plantuml.ugraphic.MinMax; @@ -62,6 +65,8 @@ 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; import net.sourceforge.plantuml.utils.MathUtils; public class FtileGroup extends AbstractFtile { @@ -70,25 +75,38 @@ public class FtileGroup extends AbstractFtile { private final Ftile inner; private final TextBlock name; private final TextBlock headerNote; - private final HtmlColor borderColor; - private final HtmlColor backColor; + private final HColor borderColor; + private final HColor backColor; + private final double shadowing; private final UStroke stroke; private final USymbol type; private final double roundCorner; - public FtileGroup(Ftile inner, Display title, Display displayNote, HtmlColor arrowColor, HtmlColor backColor, - HtmlColor titleColor, ISkinParam skinParam, HtmlColor borderColor, USymbol type, double roundCorner) { + final public StyleSignature getDefaultStyleDefinitionPartition() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.partition); + } + + public FtileGroup(Ftile inner, Display title, Display displayNote, HColor arrowColor, HColor backColor, + HColor titleColor, ISkinParam skinParam, HColor borderColor, USymbol type, double roundCorner) { super(inner.skinParam()); this.roundCorner = roundCorner; this.type = type; - this.backColor = backColor == null ? HtmlColorUtils.WHITE : backColor; + this.backColor = backColor == null ? HColorUtils.WHITE : backColor; this.inner = FtileUtils.addHorizontalMargin(inner, 10); - this.borderColor = borderColor == null ? HtmlColorUtils.BLACK : borderColor; - final UFont font = skinParam.getFont(null, false, FontParam.PARTITION); + this.borderColor = borderColor == null ? HColorUtils.BLACK : borderColor; - final HtmlColor fontColor = skinParam.getFontHtmlColor(null, FontParam.PARTITION); - final FontConfiguration fc = new FontConfiguration(font, fontColor, skinParam.getHyperlinkColor(), - skinParam.useUnderlineForHyperlink(), skinParam.getTabSize()); + final FontConfiguration fc; + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinitionPartition().getMergedStyle(skinParam.getCurrentStyleBuilder()); + fc = style.getFontConfiguration(getIHtmlColorSet()); + this.shadowing = style.value(PName.Shadowing).asDouble(); + } else { + final UFont font = skinParam.getFont(null, false, FontParam.PARTITION); + final HColor fontColor = skinParam.getFontHtmlColor(null, FontParam.PARTITION); + fc = new FontConfiguration(font, fontColor, skinParam.getHyperlinkColor(), + skinParam.useUnderlineForHyperlink(), skinParam.getTabSize()); + this.shadowing = skinParam().shadowing(null) ? 3 : 0; + } if (title == null) { this.name = TextBlockUtils.empty(0, 0); } else { @@ -103,7 +121,7 @@ public FtileGroup(Ftile inner, Display title, Display displayNote, HtmlColor arr final UStroke thickness = skinParam.getThickness(LineParam.partitionBorder, null); this.stroke = thickness == null ? new UStroke(2) : thickness; } - + @Override public Collection getMyChildren() { return inner.getMyChildren(); @@ -150,8 +168,8 @@ public double suppWidth(StringBounder stringBounder) { final FtileGeometry orig = getInnerDimension(stringBounder); final Dimension2D dimTitle = name.calculateDimension(stringBounder); final Dimension2D dimHeaderNote = headerNote.calculateDimension(stringBounder); - final double suppWidth = MathUtils - .max(orig.getWidth(), dimTitle.getWidth() + 20, dimHeaderNote.getWidth() + 20) - orig.getWidth(); + final double suppWidth = MathUtils.max(orig.getWidth(), dimTitle.getWidth() + 20, dimHeaderNote.getWidth() + 20) + - orig.getWidth(); return suppWidth; } @@ -184,11 +202,11 @@ protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) { + headerNoteHeight(stringBounder); final double titleAndHeaderNoteHeight = diffHeightTitle(stringBounder) + headerNoteHeight(stringBounder); 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, orig.getOutY() + titleAndHeaderNoteHeight); } - return new FtileGeometry(width, height, orig.getLeft() + suppWidth / 2, orig.getInY() - + titleAndHeaderNoteHeight); + return new FtileGeometry(width, height, orig.getLeft() + suppWidth / 2, + orig.getInY() + titleAndHeaderNoteHeight); } private double headerNoteHeight(StringBounder stringBounder) { @@ -199,12 +217,15 @@ public void drawU(UGraphic ug) { 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(skinParam().shadowing(null)).withStroke(stroke).withCorner(roundCorner, 0); + // final double roundCorner = + // type.getSkinParameter().getRoundCorner(skinParam(), null); + final SymbolContext symbolContext = new SymbolContext(backColor, borderColor).withShadow(shadowing) + .withStroke(stroke).withCorner(roundCorner, 0); - type.asBig(name, inner.skinParam().getHorizontalAlignment(AlignmentParam.packageTitleAlignment, null, false), - TextBlockUtils.empty(0, 0), dimTotal.getWidth(), dimTotal.getHeight(), symbolContext, skinParam().getStereotypeAlignment()).drawU(ug); + final HorizontalAlignment align = inner.skinParam().getHorizontalAlignment(AlignmentParam.packageTitleAlignment, + null, false); + type.asBig(name, align, TextBlockUtils.empty(0, 0), dimTotal.getWidth(), dimTotal.getHeight(), symbolContext, + skinParam().getStereotypeAlignment()).drawU(ug); final Dimension2D dimHeaderNote = headerNote.calculateDimension(stringBounder); headerNote.drawU(ug.apply(new UTranslate(dimTotal.getWidth() - dimHeaderNote.getWidth() - 10, diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java index cfefaf174..b5072f105 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -56,20 +56,20 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside; import net.sourceforge.plantuml.creole.CreoleMode; -import net.sourceforge.plantuml.creole.CreoleParser; +import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.creole.Sheet; import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.creole.SheetBlock2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; class FtileIfAndStop extends AbstractFtile { @@ -106,7 +106,7 @@ public Swimlane getSwimlaneOut() { return getSwimlaneIn(); } - static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, + static Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch nonStop, ISkinParam skinParam, StringBounder stringBounder, Display labelTest) { @@ -119,13 +119,15 @@ static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColo final Ftile stopFtile = ftileFactory.stop(swimlane); - // final TextBlock tb1 = Display.create(branch1.getLabelPositive(), fcArrow, HorizontalAlignment.LEFT, + // final TextBlock tb1 = Display.create(branch1.getLabelPositive(), fcArrow, + // HorizontalAlignment.LEFT, // ftileFactory); - // final TextBlock tb2 = Display.create(branch2.getLabelPositive(), fcArrow, HorizontalAlignment.LEFT, + // final TextBlock tb2 = Display.create(branch2.getLabelPositive(), fcArrow, + // HorizontalAlignment.LEFT, // ftileFactory); - final Sheet sheet = new CreoleParser(fcTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), - skinParam, CreoleMode.FULL).createSheet(labelTest); + final Sheet sheet = Parser.build(fcTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL) + .createSheet(labelTest); final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()); final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), tileNonStop.getThickness()); @@ -144,9 +146,11 @@ static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColo // final Ftile diamond2; // if (tile1.calculateDimension(stringBounder).hasPointOut() // && tile2.calculateDimension(stringBounder).hasPointOut()) { - // diamond2 = new FtileDiamond(tile1.shadowing(), backColor, borderColor, swimlane); + // diamond2 = new FtileDiamond(tile1.shadowing(), backColor, borderColor, + // swimlane); // } else { - // diamond2 = new FtileEmpty(tile1.shadowing(), Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2, + // diamond2 = new FtileEmpty(tile1.shadowing(), Diamond.diamondHalfSize * 2, + // Diamond.diamondHalfSize * 2, // swimlane, swimlane); // } final FtileIfAndStop result = new FtileIfAndStop(diamond1, tileNonStop, arrowColor, stopFtile); @@ -156,14 +160,18 @@ static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColo // conns.add(result.new ConnectionHorizontalThenVertical(tile2)); // if (tile1.calculateDimension(stringBounder).hasPointOut() // && tile2.calculateDimension(stringBounder).hasPointOut()) { - // conns.add(result.new ConnectionVerticalThenHorizontal(tile1, branch1.getInlinkRenderingColor())); - // conns.add(result.new ConnectionVerticalThenHorizontal(tile2, branch2.getInlinkRenderingColor())); + // conns.add(result.new ConnectionVerticalThenHorizontal(tile1, + // branch1.getInlinkRenderingColor())); + // conns.add(result.new ConnectionVerticalThenHorizontal(tile2, + // branch2.getInlinkRenderingColor())); // } else if (tile1.calculateDimension(stringBounder).hasPointOut() // && tile2.calculateDimension(stringBounder).hasPointOut() == false) { - // conns.add(result.new ConnectionVerticalThenHorizontalDirect(tile1, branch1.getInlinkRenderingColor())); + // conns.add(result.new ConnectionVerticalThenHorizontalDirect(tile1, + // branch1.getInlinkRenderingColor())); // } else if (tile1.calculateDimension(stringBounder).hasPointOut() == false // && tile2.calculateDimension(stringBounder).hasPointOut()) { - // conns.add(result.new ConnectionVerticalThenHorizontalDirect(tile2, branch2.getInlinkRenderingColor())); + // conns.add(result.new ConnectionVerticalThenHorizontalDirect(tile2, + // branch2.getInlinkRenderingColor())); // } return FtileUtils.addConnection(result, conns); // return result; @@ -276,7 +284,8 @@ protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) { // final Dimension2D dimTotal = calculateDimensionInternal(stringBounder); // if (tile1.calculateDimension(stringBounder).hasPointOut()) { - // return new FtileGeometry(dimTotal, getLeft(stringBounder), 0, dimTotal.getHeight()); + // return new FtileGeometry(dimTotal, getLeft(stringBounder), 0, + // dimTotal.getHeight()); // } // return new FtileGeometry(dimTotal, getLeft(stringBounder), 0); } @@ -290,22 +299,26 @@ protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) { // return calculateDimensionInternal; // } // - // private Dimension2D calculateDimensionInternalSlow(StringBounder stringBounder) { + // private Dimension2D calculateDimensionInternalSlow(StringBounder + // stringBounder) { // final Dimension2D dim1 = tile1.calculateDimension(stringBounder); // final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder); // final Dimension2D dimStop2 = stop2.calculateDimension(stringBounder); // final double width = Math.max(dim1.getWidth(), // dimDiamond1.getWidth() + getDiamondStopDistance() + dimStop2.getWidth()); - // return new Dimension2DDouble(width + 30, dim1.getHeight() + dimDiamond1.getHeight() + 40); + // return new Dimension2DDouble(width + 30, dim1.getHeight() + + // dimDiamond1.getHeight() + 40); // } // // private double getLeft(StringBounder stringBounder) { // // return calculateDimension(stringBounder).getLeft(); - // return tile1.calculateDimension(stringBounder).translate(getTranslate1(stringBounder)).getLeft(); + // return + // tile1.calculateDimension(stringBounder).translate(getTranslate1(stringBounder)).getLeft(); // // final double left1 = // tile1.calculateDimension(stringBounder).translate(getTranslate1(stringBounder)).getLeft(); // // // final double left2 = - // // // tile2.calculateDimension(stringBounder).translate(getTranslate2(stringBounder)).getLeft(); + // // // + // tile2.calculateDimension(stringBounder).translate(getTranslate2(stringBounder)).getLeft(); // // // return (left1 + left2) / 2; // // return left1; // } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfDown.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfDown.java index 3e6107c11..f85987c63 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfDown.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfDown.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java index 1f58e2329..1ac02fc96 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,7 +40,6 @@ import java.util.Set; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; @@ -52,7 +51,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth; +import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidthCentered; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; import net.sourceforge.plantuml.activitydiagram3.ftile.MergeStrategy; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; @@ -62,13 +61,13 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; class FtileIfLongHorizontal extends AbstractFtile { @@ -136,7 +135,7 @@ public Swimlane getSwimlaneOut() { return getSwimlaneIn(); } - static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, + static Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, List thens, Branch branch2, FontConfiguration fcArrow, LinkRendering topInlinkRendering, LinkRendering afterEndwhile, FontConfiguration fcTest) { @@ -146,10 +145,10 @@ static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColo final List tiles = new ArrayList(); for (Branch branch : thens) { - tiles.add(new FtileMinWidth(branch.getFtile(), 30)); + tiles.add(new FtileMinWidthCentered(branch.getFtile(), 30)); } - final Ftile tile2 = new FtileMinWidth(branch2.getFtile(), 30); + final Ftile tile2 = new FtileMinWidthCentered(branch2.getFtile(), 30); List diamonds = new ArrayList(); List inlabelSizes = new ArrayList(); @@ -159,7 +158,7 @@ static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColo final TextBlock tbTest = branch.getLabelTest().create(fcTest, ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT), ftileFactory.skinParam()); - final HtmlColor diamondColor = branch.getColor() == null ? backColor : branch.getColor(); + final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor(); FtileDiamondInside2 diamond = new FtileDiamondInside2(branch.skinParam(), diamondColor, borderColor, swimlane, tbTest); @@ -182,7 +181,8 @@ static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColo diamonds = alignDiamonds(diamonds, ftileFactory.getStringBounder()); - final FtileIfLongHorizontal result = new FtileIfLongHorizontal(diamonds, inlabelSizes, tiles, tile2, arrowColor); + final FtileIfLongHorizontal result = new FtileIfLongHorizontal(diamonds, inlabelSizes, tiles, tile2, + arrowColor); final List conns = new ArrayList(); int nbOut = 0; @@ -200,8 +200,8 @@ static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColo final Rainbow rainbowOut = branch.getInlinkRenderingColorAndStyle(); TextBlock out2 = null; if (branch.getSpecial() != null) { - out2 = branch.getSpecial().getDisplay() - .create(fcTest, HorizontalAlignment.LEFT, ftileFactory.skinParam()); + out2 = branch.getSpecial().getDisplay().create(fcTest, HorizontalAlignment.LEFT, + ftileFactory.skinParam()); } conns.add(result.new ConnectionVerticalIn(diam, ftile, rainbowIn.size() == 0 ? arrowColor : rainbowIn)); conns.add(result.new ConnectionVerticalOut(ftile, rainbowOut.size() == 0 ? arrowColor : rainbowOut, out2)); @@ -230,13 +230,6 @@ static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColo return FtileUtils.addConnection(result, conns); } - static private TextBlock getSpecial(Branch branch, FontConfiguration fcTest, ISkinParam skinParam) { - if (branch.getSpecial() == null) { - return null; - } - return branch.getSpecial().getDisplay().create(fcTest, HorizontalAlignment.LEFT, skinParam); - } - class ConnectionHorizontal extends AbstractConnection { private final Rainbow color; @@ -259,8 +252,8 @@ public void drawU(UGraphic ug) { private Point2D getP1(StringBounder stringBounder) { final FtileGeometry dimDiamond1 = getFtile1().calculateDimension(stringBounder); - final Point2D p = new Point2D.Double(dimDiamond1.getLeft() * 2, getYdiamontOutToLeft(dimDiamond1, - stringBounder)); + final Point2D p = new Point2D.Double(dimDiamond1.getLeft() * 2, + getYdiamontOutToLeft(dimDiamond1, stringBounder)); return getTranslateDiamond1(getFtile1(), stringBounder).getTranslated(p); } @@ -322,8 +315,8 @@ public void drawU(UGraphic ug) { private Point2D getP1(StringBounder stringBounder) { final FtileGeometry dimDiamond1 = getFtile1().calculateDimension(stringBounder); - final Point2D p = new Point2D.Double(dimDiamond1.getLeft() * 2, getYdiamontOutToLeft(dimDiamond1, - stringBounder)); + final Point2D p = new Point2D.Double(dimDiamond1.getLeft() * 2, + getYdiamontOutToLeft(dimDiamond1, stringBounder)); return getTranslateDiamond1(getFtile1(), stringBounder).getTranslated(p); } @@ -465,45 +458,122 @@ public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D totalDim = calculateDimensionInternal(stringBounder); - final Swimlane intoSw; + final List allTiles = new ArrayList(couples); + allTiles.add(tile2); + + final double[] minmax; if (ug instanceof UGraphicInterceptorOneSwimlane) { - intoSw = ((UGraphicInterceptorOneSwimlane) ug).getSwimlane(); + final UGraphicInterceptorOneSwimlane interceptor = (UGraphicInterceptorOneSwimlane) ug; + final List allSwimlanes = interceptor.getOrderedListOfAllSwimlanes(); + minmax = getMinmax(stringBounder, totalDim.getWidth(), allTiles, interceptor.getSwimlane(), + allSwimlanes); } else { - intoSw = null; + minmax = getMinmaxSimple(stringBounder, totalDim.getWidth(), allTiles); + } + + final double minX = minmax[0]; + final double maxX = minmax[1]; + if (Double.isNaN(minX) || Double.isNaN(maxX)) { + return; + } + + final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor); + s.goUnmergeable(MergeStrategy.NONE); + s.addPoint(minX, totalDim.getHeight()); + s.addPoint(maxX, totalDim.getHeight()); + ug.draw(s); + } + + private Double getLeftOut(final StringBounder stringBounder) { + final FtileGeometry dim = calculateDimension(stringBounder); + if (dim.hasPointOut()) { + return dim.getLeft(); } + return null; + } + + private double[] getMinmax(StringBounder stringBounder, double width, List allTiles, Swimlane intoSw, + List allSwimlanes) { + final int current = allSwimlanes.indexOf(intoSw); + final Double leftOut = getLeftOut(stringBounder); + if (leftOut == null) + return new double[] { Double.NaN, Double.NaN }; - final List all = new ArrayList(couples); - all.add(tile2); - double minX = totalDim.getWidth() / 2; - double maxX = totalDim.getWidth() / 2; - boolean atLeastOne = false; - for (Ftile tmp : all) { + if (current == -1) { + throw new IllegalStateException(); + } + final int first = getFirstSwimlane(stringBounder, allTiles, allSwimlanes); + final int last = getLastSwimlane(stringBounder, allTiles, allSwimlanes); + if (current < first || current > last) + return new double[] { Double.NaN, Double.NaN }; + double minX = current != first ? 0 : width; + double maxX = current != last ? width : 0; + minX = Math.min(minX, leftOut); + maxX = Math.max(maxX, leftOut); + for (Ftile tmp : allTiles) { if (tmp.calculateDimension(stringBounder).hasPointOut() == false) { continue; } - if (intoSw != null && tmp.getSwimlanes().contains(intoSw) == false) { + if (ftileDoesOutcomeInThatSwimlane(tmp, intoSw) == false) { continue; } - if (intoSw != null && tmp.getSwimlaneOut() != intoSw) { + final UTranslate ut = getTranslateFor(tmp, stringBounder); + final double out = tmp.calculateDimension(stringBounder).translate(ut).getLeft(); + minX = Math.min(minX, out); + maxX = Math.max(maxX, out); + } + return new double[] { minX, maxX }; + } + + private double[] getMinmaxSimple(StringBounder stringBounder, double width, List allTiles) { + final Double leftOut = getLeftOut(stringBounder); + if (leftOut == null) + return new double[] { Double.NaN, Double.NaN }; + double minX = width / 2; + double maxX = width / 2; + minX = Math.min(minX, leftOut); + maxX = Math.max(maxX, leftOut); + for (Ftile tmp : allTiles) { + if (tmp.calculateDimension(stringBounder).hasPointOut() == false) { continue; } - atLeastOne = true; final UTranslate ut = getTranslateFor(tmp, stringBounder); final double out = tmp.calculateDimension(stringBounder).translate(ut).getLeft(); minX = Math.min(minX, out); maxX = Math.max(maxX, out); } - if (atLeastOne == false) { - return; + return new double[] { minX, maxX }; + } + + private int getFirstSwimlane(StringBounder stringBounder, List allTiles, List allSwimlanes) { + for (int i = 0; i < allSwimlanes.size(); i++) { + if (atLeastOne(stringBounder, allSwimlanes.get(i), allTiles)) { + return i; + } + } + throw new IllegalStateException(); + } + + private int getLastSwimlane(StringBounder stringBounder, List allTiles, List allSwimlanes) { + for (int i = allSwimlanes.size() - 1; i >= 0; i--) { + if (atLeastOne(stringBounder, allSwimlanes.get(i), allTiles)) { + return i; + } } + throw new IllegalStateException(); + } - final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor); - s.goUnmergeable(MergeStrategy.NONE); - final double height = totalDim.getHeight(); - s.addPoint(minX, height); - s.addPoint(maxX, height); - ug.draw(s); + private boolean atLeastOne(StringBounder stringBounder, Swimlane intoSw, List allTiles) { + for (Ftile tmp : allTiles) + if (tmp.calculateDimension(stringBounder).hasPointOut() && ftileDoesOutcomeInThatSwimlane(tmp, intoSw)) + return true; + return false; } + + private boolean ftileDoesOutcomeInThatSwimlane(Ftile ftile, Swimlane swimlane) { + return ftile.getSwimlaneOut() == swimlane && ftile.getSwimlanes().contains(swimlane); + } + } @Override diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java index a291930b2..ac3c8beeb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,6 +33,7 @@ import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -47,7 +48,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth; +import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidthCentered; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileOverpassing; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; @@ -57,13 +58,13 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside3; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; class FtileIfLongVertical extends AbstractFtile { @@ -78,6 +79,14 @@ class FtileIfLongVertical extends AbstractFtile { private final Rainbow arrowColor; + + @Override + public Collection getMyChildren() { + final List result = new ArrayList(tiles); + result.add(tile2); + return Collections.unmodifiableList(result); + } + private FtileIfLongVertical(List diamonds, List tiles, Ftile tile2, Rainbow arrowColor, Ftile lastDiamond) { super(tiles.get(0).skinParam()); @@ -113,16 +122,16 @@ public Swimlane getSwimlaneOut() { return getSwimlaneIn(); } - static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, + static Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, List thens, Branch branch2, FontConfiguration fc, LinkRendering topInlinkRendering, LinkRendering afterEndwhile) { final List tiles = new ArrayList(); for (Branch branch : thens) { - tiles.add(new FtileMinWidth(branch.getFtile(), 30)); + tiles.add(new FtileMinWidthCentered(branch.getFtile(), 30)); } - final Ftile tile2 = new FtileMinWidth(branch2.getFtile(), 30); + final Ftile tile2 = new FtileMinWidthCentered(branch2.getFtile(), 30); List diamonds = new ArrayList(); for (Branch branch : thens) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java index aeab0eb1b..c0cf28349 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,12 +39,13 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineBreakStrategy; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.creole.CreoleMode; -import net.sourceforge.plantuml.creole.CreoleParser; +import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.creole.Sheet; import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.creole.SheetBlock2; @@ -52,20 +53,29 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; 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.style.Styleable; import net.sourceforge.plantuml.svek.image.Opale; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; -public class FtileNoteAlone extends AbstractFtile implements Stencil { +public class FtileNoteAlone extends AbstractFtile implements Stencil, Styleable { private final Opale opale; private final boolean withOutPoint; private final Swimlane swimlane; - + + public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.note); + } + @Override public Collection getMyChildren() { return Collections.emptyList(); @@ -92,15 +102,28 @@ public FtileNoteAlone(boolean shadow, Display note, ISkinParam skinParam, boolea this.withOutPoint = withOutPoint; final Rose rose = new Rose(); - final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); - final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); + final HColor noteBackgroundColor; + final HColor borderColor; + final double shadowing; + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); + noteBackgroundColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet()); + borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet()); + shadowing = style.value(PName.Shadowing).asDouble(); + } else { + noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); + borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); + shadowing = skinParam.shadowing(null) ? 4 : 0; + } final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); - final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), - skinParam, CreoleMode.FULL).createSheet(note); - final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()), this, new UStroke(1)); - opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(null), false); + final Sheet sheet = Parser + .build(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL) + .createSheet(note); + final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()), + this, new UStroke(1)); + opale = new Opale(shadowing, borderColor, noteBackgroundColor, text, false); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java index 5aa505b59..a58a43f64 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -61,7 +61,6 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -70,6 +69,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; class FtileRepeat extends AbstractFtile { @@ -106,8 +106,8 @@ public Set getSwimlanes() { } public static Ftile create(LinkRendering backRepeatLinkRendering, Swimlane swimlane, Swimlane swimlaneOut, - Ftile backStart, Ftile repeat, Display test, Display yes, Display out, HtmlColor borderColor, - HtmlColor backColor, Rainbow arrowColor, Rainbow endRepeatLinkColor, ConditionStyle conditionStyle, + Ftile entry, Ftile repeat, Display test, Display yes, Display out, HColor borderColor, + HColor diamondColor, Rainbow arrowColor, Rainbow endRepeatLinkColor, ConditionStyle conditionStyle, ISkinSimple spriteContainer, FontConfiguration fcDiamond, FontConfiguration fcArrow, Ftile backward, boolean noOut) { @@ -120,11 +120,11 @@ public static Ftile create(LinkRendering backRepeatLinkRendering, Swimlane swiml final TextBlock outTb = out.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer); final Ftile diamond1; - assert swimlane == repeat.getSwimlaneIn(); - if (backStart == null) { - diamond1 = new FtileDiamond(repeat.skinParam(), backColor, borderColor, repeat.getSwimlaneIn()); + // assert swimlane == repeat.getSwimlaneIn(); + if (entry == null) { + diamond1 = new FtileDiamond(repeat.skinParam(), diamondColor, borderColor, repeat.getSwimlaneIn()); } else { - diamond1 = backStart; + diamond1 = entry; } final FtileRepeat result; if (conditionStyle == ConditionStyle.INSIDE) { @@ -132,16 +132,16 @@ public static Ftile create(LinkRendering backRepeatLinkRendering, Swimlane swiml if (noOut && Display.isNull(test)) { diamond2 = new FtileEmpty(repeat.skinParam()); } else { - diamond2 = new FtileDiamondInside(repeat.skinParam(), backColor, borderColor, swimlaneOut, tbTest) + diamond2 = new FtileDiamondInside(repeat.skinParam(), diamondColor, borderColor, swimlaneOut, tbTest) .withEast(yesTb).withSouth(outTb); } result = new FtileRepeat(repeat, diamond1, diamond2, TextBlockUtils.empty(0, 0), backward); } else if (conditionStyle == ConditionStyle.DIAMOND) { - final Ftile diamond2 = new FtileDiamond(repeat.skinParam(), backColor, borderColor, swimlane) + final Ftile diamond2 = new FtileDiamond(repeat.skinParam(), diamondColor, borderColor, swimlane) .withEast(tbTest); result = new FtileRepeat(repeat, diamond1, diamond2, tbTest, backward); } else if (conditionStyle == ConditionStyle.FOO1) { - final Ftile diamond2 = new FtileDiamondFoo1(repeat.skinParam(), backColor, borderColor, swimlane, tbTest); + final Ftile diamond2 = new FtileDiamondFoo1(repeat.skinParam(), diamondColor, borderColor, swimlane, tbTest); result = new FtileRepeat(repeat, diamond1, diamond2, TextBlockUtils.empty(0, 0), backward); } else { throw new IllegalStateException(); @@ -149,12 +149,12 @@ public static Ftile create(LinkRendering backRepeatLinkRendering, Swimlane swiml final List conns = new ArrayList(); final Display in1 = repeat.getInLinkRendering().getDisplay(); - final TextBlock tbin1 = in1 == null ? null : in1.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer, + final TextBlock tbin1 = in1 == null ? null : in1.create7(fcArrow, HorizontalAlignment.LEFT, spriteContainer, CreoleMode.SIMPLE_LINE); conns.add(result.new ConnectionIn(repeat.getInLinkRendering().getRainbow(arrowColor), tbin1)); final Display backLink1 = backRepeatLinkRendering.getDisplay(); - final TextBlock tbbackLink1 = backLink1 == null ? null : backLink1.create(fcArrow, HorizontalAlignment.LEFT, + final TextBlock tbbackLink1 = backLink1 == null ? null : backLink1.create7(fcArrow, HorizontalAlignment.LEFT, spriteContainer, CreoleMode.SIMPLE_LINE); if (repeat.getSwimlaneIn() == swimlaneOut) { if (backward == null) { @@ -171,7 +171,7 @@ public static Ftile create(LinkRendering backRepeatLinkRendering, Swimlane swiml } final Display out1 = repeat.getOutLinkRendering().getDisplay(); - final TextBlock tbout1 = out1 == null ? null : out1.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer, + final TextBlock tbout1 = out1 == null ? null : out1.create7(fcArrow, HorizontalAlignment.LEFT, spriteContainer, CreoleMode.SIMPLE_LINE); final Rainbow tmpColor = endRepeatLinkColor.withDefault(arrowColor); @@ -574,7 +574,7 @@ private UTranslate getTranslateForRepeat(StringBounder stringBounder) { private UTranslate getTranslateDiamond1(StringBounder stringBounder) { final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder); final double left = getLeft(stringBounder); - return new UTranslate(left - dimDiamond1.getWidth() / 2, 0); + return UTranslate.dx(left - dimDiamond1.getWidth() / 2); } private UTranslate getTranslateBackward(StringBounder stringBounder) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSplit1.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSplit1.java index 069c2f45d..7e70dc784 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSplit1.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSplit1.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -106,7 +106,7 @@ protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) { public UTranslate getTranslateFor(Ftile searched, StringBounder stringBounder) { final Dimension2D dim = searched.calculateDimension(stringBounder); final double xpos = calculateDimension(stringBounder).getWidth() - dim.getWidth(); - return new UTranslate(xpos / 2, 0); + return UTranslate.dx(xpos / 2); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSwitch.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSwitch.java index f846c49f5..2be9d62e3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSwitch.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSwitch.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -45,19 +45,19 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth; +import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidthCentered; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; class FtileSwitch extends AbstractFtile { @@ -90,7 +90,7 @@ public Swimlane getSwimlaneOut() { return getSwimlaneIn(); } - static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, + static Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, List thens, FontConfiguration fcArrow, LinkRendering topInlinkRendering, LinkRendering afterEndwhile, FontConfiguration fcTest) { if (afterEndwhile == null) { @@ -99,7 +99,7 @@ static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColo final List tiles = new ArrayList(); for (Branch branch : thens) { - tiles.add(new FtileMinWidth(branch.getFtile(), 30)); + tiles.add(new FtileMinWidthCentered(branch.getFtile(), 30)); } List inlabelSizes = new ArrayList(); @@ -109,7 +109,7 @@ static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColo final TextBlock tbTest = branch.getLabelTest().create(fcTest, ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT), ftileFactory.skinParam()); - final HtmlColor diamondColor = branch.getColor() == null ? backColor : branch.getColor(); + final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor(); FtileDiamondInside2 diamond = new FtileDiamondInside2(branch.skinParam(), diamondColor, borderColor, swimlane, tbTest); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java index 22423ab37..5c5e31833 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -61,23 +61,22 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.svek.ConditionStyle; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEmpty; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; class FtileWhile extends AbstractFtile { private final Ftile whileBlock; private final Ftile diamond1; private final Ftile specialOut; + private final Ftile backward; @Override public Collection getMyChildren() { @@ -101,21 +100,23 @@ public Swimlane getSwimlaneOut() { return getSwimlaneIn(); } - private FtileWhile(Ftile whileBlock, Ftile diamond1, Ftile specialOut) { + private FtileWhile(Ftile whileBlock, Ftile diamond1, Ftile specialOut, Ftile backward) { super(whileBlock.skinParam()); this.whileBlock = whileBlock; this.diamond1 = diamond1; this.specialOut = specialOut; + this.backward = backward; } - public static Ftile create(Swimlane swimlane, Ftile whileBlock, Display test, HtmlColor borderColor, - HtmlColor backColor, Rainbow arrowColor, Display yes, Display out2, Rainbow endInlinkColor, - LinkRendering afterEndwhile, FontConfiguration fontArrow, FtileFactory ftileFactory, - ConditionStyle conditionStyle, FontConfiguration fcTest, Instruction specialOut) { + public static Ftile create(Swimlane swimlane, Ftile whileBlock, Display test, HColor borderColor, HColor backColor, + Rainbow arrowColor, Display yes, Display out2, Rainbow endInlinkColor, LinkRendering afterEndwhile, + FontConfiguration fontArrow, FtileFactory ftileFactory, ConditionStyle conditionStyle, + FontConfiguration fcTest, Instruction specialOut, Ftile backward) { final TextBlock yesTb = yes.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam()); - final TextBlock testTb = test.isWhite() ? TextBlockUtils.empty(0, 0) : test.create(fcTest, whileBlock - .skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT), ftileFactory.skinParam()); + final TextBlock testTb = test.isWhite() ? TextBlockUtils.empty(0, 0) + : test.create(fcTest, whileBlock.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT), + ftileFactory.skinParam()); final TextBlock out = out2.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam()); final Ftile diamond1; @@ -134,7 +135,7 @@ public static Ftile create(Swimlane swimlane, Ftile whileBlock, Display test, Ht final Ftile special = specialOut == null ? null : specialOut.createFtile(ftileFactory); - final FtileWhile result = new FtileWhile(whileBlock, diamond1, special); + final FtileWhile result = new FtileWhile(whileBlock, diamond1, special, backward); Rainbow afterEndwhileColor = arrowColor; if (afterEndwhile != null && afterEndwhile.getRainbow() != null && afterEndwhile.getRainbow().size() != 0) { afterEndwhileColor = afterEndwhile.getRainbow(); @@ -149,7 +150,12 @@ public static Ftile create(Swimlane swimlane, Ftile whileBlock, Display test, Ht conns.add(result.new ConnectionBackEmpty(endInlinkColor)); } else { conns.add(result.new ConnectionIn(whileBlock.getInLinkRendering().getRainbow(arrowColor))); - conns.add(result.new ConnectionBack(endInlinkColor, back)); + if (backward == null) { + conns.add(result.new ConnectionBackSimple(endInlinkColor, back)); + } else { + conns.add(result.new ConnectionBackBackward1(endInlinkColor, back)); + conns.add(result.new ConnectionBackBackward2(endInlinkColor)); + } } if (specialOut == null) { conns.add(result.new ConnectionOut(afterEndwhileColor)); @@ -168,13 +174,13 @@ public ConnectionIn(Rainbow arrowColor) { } private Point2D getP1(final StringBounder stringBounder) { - return getTranslateDiamond1(stringBounder).getTranslated( - getFtile1().calculateDimension(stringBounder).getPointOut()); + return getTranslateDiamond1(stringBounder) + .getTranslated(getFtile1().calculateDimension(stringBounder).getPointOut()); } private Point2D getP2(final StringBounder stringBounder) { - return getTranslateForWhile(stringBounder).getTranslated( - getFtile2().calculateDimension(stringBounder).getPointIn()); + return getTranslateForWhile(stringBounder) + .getTranslated(getFtile2().calculateDimension(stringBounder).getPointIn()); } public void drawU(UGraphic ug) { @@ -204,11 +210,11 @@ public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate transla } } - class ConnectionBack extends AbstractConnection implements ConnectionTranslatable { + class ConnectionBackSimple extends AbstractConnection implements ConnectionTranslatable { private final Rainbow endInlinkColor; private final TextBlock back; - public ConnectionBack(Rainbow endInlinkColor, TextBlock back) { + public ConnectionBackSimple(Rainbow endInlinkColor, TextBlock back) { super(whileBlock, diamond1); this.endInlinkColor = endInlinkColor; this.back = back; @@ -260,7 +266,6 @@ public void drawU(UGraphic ug) { snake.emphasizeDirection(Direction.UP); ug.draw(snake); - ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Diamond.diamondHalfSize)); } @@ -294,14 +299,106 @@ public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate transla ug.apply(new UTranslate(x1, y1 + Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize)); - ug = ug.apply(new UChangeColor(endInlinkColor.getColor())).apply( - new UChangeBackColor(endInlinkColor.getColor())); + ug = ug.apply(endInlinkColor.getColor()).apply(endInlinkColor.getColor().bg()); ug.apply(new UTranslate(xx, (y1 + y2) / 2)).draw(Arrows.asToUp()); } } + class ConnectionBackBackward1 extends AbstractConnection { + private final Rainbow endInlinkColor; + private final TextBlock back; + + public ConnectionBackBackward1(Rainbow endInlinkColor, TextBlock back) { + super(whileBlock, backward); + this.endInlinkColor = endInlinkColor; + this.back = back; + } + + private Point2D getP1(final StringBounder stringBounder) { + final FtileGeometry geo = whileBlock.calculateDimension(stringBounder); + if (geo.hasPointOut() == false) { + return null; + } + return getTranslateForWhile(stringBounder).getTranslated(geo.getPointOut()); + } + + private double getBottom(final StringBounder stringBounder) { + final FtileGeometry geo = whileBlock.calculateDimension(stringBounder); + return getTranslateForWhile(stringBounder).getDy() + geo.getHeight(); + } + + private Point2D getP2(final StringBounder stringBounder) { + final FtileGeometry dim = backward.calculateDimension(stringBounder); + return getTranslateBackward(stringBounder).getTranslated(new Point2D.Double(dim.getLeft(), dim.getOutY())); + } + + public void drawU(UGraphic ug) { + final StringBounder stringBounder = ug.getStringBounder(); + + final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToUp()); + final Point2D p1 = getP1(stringBounder); + if (p1 == null) { + return; + } + final Point2D p2 = getP2(stringBounder); + final double x1 = p1.getX(); + final double y1 = p1.getY(); + final double x2 = p2.getX(); + final double y2 = p2.getY(); + + snake.setLabel(back); + snake.addPoint(x1, y1); + final double y1bis = Math.max(y1, getBottom(stringBounder)) + Diamond.diamondHalfSize; + snake.addPoint(x1, y1bis); + snake.addPoint(x2, y1bis); + snake.addPoint(x2, y2); + + ug.draw(snake); + ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Diamond.diamondHalfSize)); + } + } + + class ConnectionBackBackward2 extends AbstractConnection { + private final Rainbow endInlinkColor; + + public ConnectionBackBackward2(Rainbow endInlinkColor) { + super(backward, diamond1); + this.endInlinkColor = endInlinkColor; + } + + private Point2D getP1(final StringBounder stringBounder) { + final FtileGeometry dim = backward.calculateDimension(stringBounder); + return getTranslateBackward(stringBounder).getTranslated(new Point2D.Double(dim.getLeft(), dim.getInY())); + } + + private Point2D getP2(final StringBounder stringBounder) { + return getTranslateDiamond1(stringBounder).getTranslated(new Point2D.Double(0, 0)); + } + + public void drawU(UGraphic ug) { + final StringBounder stringBounder = ug.getStringBounder(); + + final Snake snake = new Snake(arrowHorizontalAlignment(), endInlinkColor, Arrows.asToLeft()); + final Point2D p1 = getP1(stringBounder); + final Point2D p2 = getP2(stringBounder); + final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); + + final double x1 = p1.getX(); + final double y1 = p1.getY(); + final double x2 = p2.getX() + dimDiamond1.getWidth(); + final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2; + final double y2 = p2.getY() + dimDiamond1.getInY() + half; + + snake.addPoint(x1, y1); + snake.addPoint(x1, y2); + snake.addPoint(x2, y2); + + ug.draw(snake); + } + } + class ConnectionBackEmpty extends AbstractConnection { private final Rainbow endInlinkColor; @@ -311,8 +408,8 @@ public ConnectionBackEmpty(Rainbow endInlinkColor) { } private Point2D getP1(final StringBounder stringBounder) { - return getTranslateDiamond1(stringBounder).getTranslated( - diamond1.calculateDimension(stringBounder).getPointOut()); + return getTranslateDiamond1(stringBounder) + .getTranslated(diamond1.calculateDimension(stringBounder).getPointOut()); } private double getBottom(final StringBounder stringBounder) { @@ -419,8 +516,8 @@ private Point2D getP1(final StringBounder stringBounder) { } private Point2D getP2(final StringBounder stringBounder) { - return getTranslateForSpecial(stringBounder).getTranslated( - specialOut.calculateDimension(stringBounder).getPointIn()); + return getTranslateForSpecial(stringBounder) + .getTranslated(specialOut.calculateDimension(stringBounder).getPointIn()); } public void drawU(UGraphic ug) { @@ -454,6 +551,18 @@ public void drawU(UGraphic ug) { if (specialOut != null) { ug.apply(getTranslateForSpecial(stringBounder)).draw(specialOut); } + if (backward != null) { + ug.apply(getTranslateBackward(stringBounder)).draw(backward); + } + } + + private UTranslate getTranslateBackward(StringBounder stringBounder) { + final Dimension2D dimTotal = calculateDimensionFtile(stringBounder); + final Dimension2D dimBackward = backward.calculateDimension(stringBounder); + final double x = dimTotal.getWidth() - dimBackward.getWidth(); + final double y = (dimTotal.getHeight() - dimBackward.getHeight()) / 2; + + return new UTranslate(x, y); } @Override @@ -468,7 +577,12 @@ protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) { final FtileGeometry geo = geoDiamond1.appendBottom(geoWhile); final double height = geo.getHeight() + 4 * Diamond.diamondHalfSize; final double dx = 2 * Diamond.diamondHalfSize; - return new FtileGeometry(xDeltaBecauseSpecial(stringBounder) + geo.getWidth() + dx + Diamond.diamondHalfSize, + double backwardWidth = 0; + if (backward != null) { + backwardWidth += backward.calculateDimension(stringBounder).getWidth(); + } + return new FtileGeometry( + xDeltaBecauseSpecial(stringBounder) + geo.getWidth() + dx + Diamond.diamondHalfSize + backwardWidth, height, xDeltaBecauseSpecial(stringBounder) + geo.getLeft() + dx, geoDiamond1.getInY(), height); } @@ -522,7 +636,8 @@ private UTranslate getTranslateForSpecial(StringBounder stringBounder) { final double xDiamond = getTranslateDiamond1(stringBounder).getDx(); // final double x1 = xWhile - xDeltaBecauseSpecial(stringBounder); final double x1 = Math.min(xWhile, xDiamond) - xDeltaBecauseSpecial(stringBounder); - // final double x1 = getTranslateForWhile(stringBounder).getDx() - dimDiamond1.getWidth() + // final double x1 = getTranslateForWhile(stringBounder).getDx() - + // dimDiamond1.getWidth() // - xDeltaBecauseSpecial(stringBounder); return new UTranslate(x1, y1); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java index ff9b22c16..da34bda21 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,31 +43,37 @@ import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.PositionedNote; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.creole.CreoleMode; -import net.sourceforge.plantuml.creole.CreoleParser; +import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.creole.Sheet; import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.creole.SheetBlock2; import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; 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.style.Styleable; import net.sourceforge.plantuml.svek.image.Opale; 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; -public class FtileWithNoteOpale extends AbstractFtile implements Stencil { +public class FtileWithNoteOpale extends AbstractFtile implements Stencil, Styleable { private final Ftile tile; private final Opale opale; @@ -77,6 +83,10 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil { private final double suppSpace = 20; private final Swimlane swimlaneNote; + public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.note); + } + public Set getSwimlanes() { if (swimlaneNote != null) { final Set result = new HashSet(tile.getSwimlanes()); @@ -123,16 +133,31 @@ private FtileWithNoteOpale(Ftile tile, PositionedNote note, ISkinParam skinParam final Rose rose = new Rose(); - final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); - final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); - - final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); + final HColor noteBackgroundColor; + final HColor borderColor; + final FontConfiguration fc; + + final double shadowing; + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()) + .eventuallyOverride(note.getColors()); + noteBackgroundColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet()); + borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet()); + fc = style.getFontConfiguration(getIHtmlColorSet()); + shadowing = style.value(PName.Shadowing).asDouble(); + } else { + noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); + borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); + fc = new FontConfiguration(skinParam, FontParam.NOTE, null); + shadowing = skinParam.shadowing(null) ? 4 : 0; + } - final HorizontalAlignment align = skinParam.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null, false); - final Sheet sheet = new CreoleParser(fc, align, skinParam, CreoleMode.FULL).createSheet(note.getDisplay()); + final HorizontalAlignment align = skinParam.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null, + false); + final Sheet sheet = Parser.build(fc, align, skinParam, CreoleMode.FULL).createSheet(note.getDisplay()); final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, skinParam.wrapWidth(), skinParam.getPadding()), this, new UStroke(1)); - opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(null), withLink); + opale = new Opale(shadowing, borderColor, noteBackgroundColor, text, withLink); } @@ -160,7 +185,7 @@ private UTranslate getTranslateForOpale(UGraphic ug) { final double yForNote = (dimTotal.getHeight() - dimNote.getHeight()) / 2; if (notePosition == NotePosition.LEFT) { - return new UTranslate(0, yForNote); + return UTranslate.dy(yForNote); } final double dx = dimTotal.getWidth() - dimNote.getWidth(); return new UTranslate(dx, yForNote); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java index 0695950a3..e91268b36 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNotes.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,29 +39,34 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineBreakStrategy; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.PositionedNote; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.creole.CreoleMode; -import net.sourceforge.plantuml.creole.CreoleParser; +import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.creole.Sheet; import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.creole.SheetBlock2; import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.sequencediagram.NotePosition; 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.image.Opale; 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.utils.MathUtils; public class FtileWithNotes extends AbstractFtile { @@ -73,6 +78,10 @@ public class FtileWithNotes extends AbstractFtile { private final double suppSpace = 20; + public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.note); + } + public Set getSwimlanes() { return tile.getSwimlanes(); } @@ -91,14 +100,33 @@ public FtileWithNotes(Ftile tile, Collection notes, ISkinParam s final Rose rose = new Rose(); - final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); - final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); - - final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); - for (PositionedNote note : notes) { - final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), - skinParam, CreoleMode.FULL).createSheet(note.getDisplay()); + ISkinParam skinParam2 = skinParam; + if (note.getColors() != null) { + skinParam2 = note.getColors().mute(skinParam2); + } + final HColor noteBackgroundColor; + final HColor borderColor; + final FontConfiguration fc; + final double shadowing; + + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()) + .eventuallyOverride(note.getColors()); + noteBackgroundColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet()); + borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet()); + fc = style.getFontConfiguration(getIHtmlColorSet()); + shadowing = style.value(PName.Shadowing).asDouble(); + } else { + noteBackgroundColor = rose.getHtmlColor(skinParam2, ColorParam.noteBackground); + borderColor = rose.getHtmlColor(skinParam2, ColorParam.noteBorder); + fc = new FontConfiguration(skinParam, FontParam.NOTE, null); + shadowing = skinParam.shadowing(null) ? 4 : 0; + } + + final Sheet sheet = Parser + .build(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL) + .createSheet(note.getDisplay()); final SheetBlock1 sheet1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()); final SheetBlock2 sheet2 = new SheetBlock2(sheet1, new Stencil() { // -6 and 15 value comes from Opale: this is very ugly! @@ -111,7 +139,7 @@ public double getEndingX(StringBounder stringBounder, double y) { } }, new UStroke()); - final Opale opale = new Opale(borderColor, noteBackgroundColor, sheet2, skinParam.shadowing(null), false); + final Opale opale = new Opale(shadowing, borderColor, noteBackgroundColor, sheet2, false); final TextBlock opaleMarged = TextBlockUtils.withMargin(opale, 10, 10); if (note.getNotePosition() == NotePosition.LEFT) { if (left == null) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java index d367594d1..a3d55665d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderFork.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,6 +37,7 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; @@ -44,63 +45,165 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; +import net.sourceforge.plantuml.activitydiagram3.ftile.FtileHeightFixedCentered; +import net.sourceforge.plantuml.activitydiagram3.ftile.FtileHeightFixedMarged; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBlackBlock; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class ParallelBuilderFork extends ParallelFtilesBuilder { +public class ParallelBuilderFork extends AbstractParallelFtilesBuilder { private final String label; + private final Swimlane in; + private final Swimlane out; - public ParallelBuilderFork(ISkinParam skinParam, StringBounder stringBounder, - final List list, Ftile inner, Swimlane swimlane, String label) { - super(skinParam, stringBounder, list, inner, swimlane); + public ParallelBuilderFork(ISkinParam skinParam, StringBounder stringBounder, String label, Swimlane in, + Swimlane out, List all) { + super(skinParam, stringBounder, all); this.label = label; + this.in = in; + this.out = out; + } + + protected List getFoo2(List all) { + final double maxHeight = computeMaxHeight(all); + final double ymargin1 = getSuppSpace1(all, getStringBounder()); + final double ymargin2 = getSuppSpace2(all, getStringBounder()); + final List result = new ArrayList(); + for (Ftile ftile : all) { + final Ftile newFtile = computeNewFtile(ftile, maxHeight, ymargin1, ymargin2); + result.add(newFtile); + } + return result; + } + + private Ftile computeNewFtile(Ftile ftile, double maxHeight, double ymargin1, double ymargin2) { + final double spaceArroundBlackBar = 20; + final double xMargin = 14; + Ftile tmp; + tmp = FtileUtils.addHorizontalMargin(ftile, xMargin, xMargin + getSuppForIncomingArrow(ftile)); + tmp = new FtileHeightFixedCentered(tmp, maxHeight + 2 * spaceArroundBlackBar); + tmp = new FtileHeightFixedMarged(ymargin1, tmp, ymargin2); + return tmp; + } + + private double getSuppForIncomingArrow(Ftile ftile) { + final double x1 = getXSuppForDisplay(ftile, ftile.getInLinkRendering().getDisplay()); + final double x2 = getXSuppForDisplay(ftile, ftile.getOutLinkRendering().getDisplay()); + return Math.max(x1, x2); + } + + private double getXSuppForDisplay(Ftile ftile, Display label) { + final TextBlock text = getTextBlock(label); + if (text == null) { + return 0; + } + final double textWidth = text.calculateDimension(getStringBounder()).getWidth(); + final FtileGeometry ftileDim = ftile.calculateDimension(getStringBounder()); + final double pos2 = ftileDim.getLeft() + textWidth; + if (pos2 > ftileDim.getWidth()) { + return pos2 - ftileDim.getWidth(); + } + return 0; + } + + @Override + protected Swimlane swimlaneOutForStep2() { + return out; } @Override - protected Ftile doStep1() { - Ftile result = getMiddle(); + protected Ftile doStep1(Ftile middle) { + Ftile result = middle; final List conns = new ArrayList(); - final Ftile black = new FtileBlackBlock(skinParam(), getRose() - .getHtmlColor(skinParam(), ColorParam.activityBar), getList().get(0).getSwimlaneIn()); + final Swimlane swimlaneBlack = in; + final Ftile black = new FtileBlackBlock(skinParam(), + getRose().getHtmlColor(skinParam(), ColorParam.activityBar), swimlaneBlack); double x = 0; - for (Ftile tmp : getList()) { + for (Ftile tmp : list99) { final Dimension2D dim = tmp.calculateDimension(getStringBounder()); - conns.add(new ConnectionIn(black, tmp, x, tmp.getInLinkRendering().getRainbow( - HtmlColorAndStyle.build(skinParam())))); + final Rainbow def; + if (SkinParam.USE_STYLES()) { + Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder()); + def = Rainbow.build(style, skinParam().getIHtmlColorSet()); + } else { + def = Rainbow.build(skinParam()); + } + final Rainbow rainbow = tmp.getInLinkRendering().getRainbow(def); + conns.add(new ConnectionIn(black, tmp, x, rainbow)); x += dim.getWidth(); } result = FtileUtils.addConnection(result, conns); - ((FtileBlackBlock) black).setBlackBlockDimension(result.calculateDimension(getStringBounder()).getWidth(), barHeight); + ((FtileBlackBlock) black).setBlackBlockDimension(result.calculateDimension(getStringBounder()).getWidth(), + barHeight); return new FtileAssemblySimple(black, result); } + private double getSuppSpace1(List all, StringBounder stringBounder) { + double result = 0; + for (Ftile child : all) { + final TextBlock text = getTextBlock(child.getInLinkRendering().getDisplay()); + if (text == null) { + continue; + } + final Dimension2D dim = text.calculateDimension(stringBounder); + result = Math.max(result, dim.getHeight()); + + } + return result; + } + + private double getSuppSpace2(List all, StringBounder stringBounder) { + double result = 0; + for (Ftile child : all) { + final TextBlock text = getTextBlock(child.getOutLinkRendering().getDisplay()); + if (text == null) { + continue; + } + final Dimension2D dim = text.calculateDimension(stringBounder); + result = Math.max(result, dim.getHeight()); + } + return result; + } + + private double getJustBeforeBar2(Ftile middle, StringBounder stringBounder) { + return barHeight + getHeightOfMiddle(middle); + } + @Override - protected Ftile doStep2(Ftile result) { + protected Ftile doStep2(Ftile middle, Ftile result) { + final Swimlane swimlaneBlack = out; final Ftile out = new FtileBlackBlock(skinParam(), getRose().getHtmlColor(skinParam(), ColorParam.activityBar), - getList().get(0).getSwimlaneIn()); - ((FtileBlackBlock) out).setBlackBlockDimension(result.calculateDimension(getStringBounder()).getWidth(), barHeight); + swimlaneBlack); + ((FtileBlackBlock) out).setBlackBlockDimension(result.calculateDimension(getStringBounder()).getWidth(), + barHeight); if (label != null) { ((FtileBlackBlock) out).setLabel(getTextBlock(Display.getWithNewlines(label))); } result = new FtileAssemblySimple(result, out); final List conns = new ArrayList(); double x = 0; - for (Ftile tmp : getList()) { - final UTranslate translate0 = new UTranslate(0, barHeight); + for (Ftile tmp : list99) { final Dimension2D dim = tmp.calculateDimension(getStringBounder()); - conns.add(new ConnectionOut(translate0, tmp, out, x, tmp.getOutLinkRendering().getRainbow( - HtmlColorAndStyle.build(skinParam())), getHeightOfMiddle())); + final Rainbow def; + if (SkinParam.USE_STYLES()) { + Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder()); + def = Rainbow.build(style, skinParam().getIHtmlColorSet()); + } else { + def = Rainbow.build(skinParam()); + } + final Rainbow rainbow = tmp.getOutLinkRendering().getRainbow(def); + conns.add(new ConnectionOut(tmp, out, x, rainbow, getJustBeforeBar2(middle, getStringBounder()))); x += dim.getWidth(); } result = FtileUtils.addConnection(result, conns); @@ -115,28 +218,30 @@ class ConnectionIn extends AbstractConnection implements ConnectionTranslatable public ConnectionIn(Ftile ftile1, Ftile ftile2, double x, Rainbow arrowColor) { super(ftile1, ftile2); - label = ftile2.getInLinkRendering().getDisplay(); + this.label = ftile2.getInLinkRendering().getDisplay(); this.x = x; this.arrowColor = arrowColor; } public void drawU(UGraphic ug) { - ug = ug.apply(new UTranslate(x, 0)); - final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); + ug = ug.apply(UTranslate.dx(x)); + final FtileGeometry geo2 = getFtile2().calculateDimension(getStringBounder()); final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { snake.setLabel(getTextBlock(label)); } - snake.addPoint(geo.getLeft(), 0); - snake.addPoint(geo.getLeft(), geo.getInY()); + final Point2D p1 = new Point2D.Double(geo2.getLeft(), 0); + final Point2D p2 = new Point2D.Double(geo2.getLeft(), geo2.getInY()); + snake.addPoint(p1); + snake.addPoint(p2); ug.draw(snake); } public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { - ug = ug.apply(new UTranslate(x, 0)); - final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); - final Point2D p1 = new Point2D.Double(geo.getLeft(), 0); - final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY()); + ug = ug.apply(UTranslate.dx(x)); + final FtileGeometry geo2 = getFtile2().calculateDimension(getStringBounder()); + final Point2D p1 = new Point2D.Double(geo2.getLeft(), 0); + final Point2D p2 = new Point2D.Double(geo2.getLeft(), geo2.getInY()); final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { @@ -149,7 +254,7 @@ public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate transla snake.addPoint(mp1a.getX(), middle); snake.addPoint(mp2b.getX(), middle); snake.addPoint(mp2b); - snake.setIgnoreForCompression(true); + snake.setIgnoreForCompression(); ug.draw(snake); } } @@ -158,45 +263,42 @@ class ConnectionOut extends AbstractConnection implements ConnectionTranslatable private final double x; private final Rainbow arrowColor; - private final double height; private final Display label; - private final UTranslate translate0; + private final double justBeforeBar2; - public ConnectionOut(UTranslate translate0, Ftile ftile1, Ftile ftile2, double x, Rainbow arrowColor, - double height) { + public ConnectionOut(Ftile ftile1, Ftile ftile2, double x, Rainbow arrowColor, double justBeforeBar2) { super(ftile1, ftile2); - this.translate0 = translate0; + this.justBeforeBar2 = justBeforeBar2; this.label = ftile1.getOutLinkRendering().getDisplay(); this.x = x; this.arrowColor = arrowColor; - this.height = height; } public void drawU(UGraphic ug) { - ug = ug.apply(new UTranslate(x, 0)); - final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder()); - if (geo.hasPointOut() == false) { + ug = ug.apply(UTranslate.dx(x)); + final FtileGeometry geo1 = getFtile1().calculateDimension(getStringBounder()); + if (geo1.hasPointOut() == false) { return; } final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { snake.setLabel(getTextBlock(label)); } - final Point2D p1 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), geo.getOutY())); - final Point2D p2 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), height)); + final Point2D p1 = new Point2D.Double(geo1.getLeft(), barHeight + geo1.getOutY()); + final Point2D p2 = new Point2D.Double(geo1.getLeft(), justBeforeBar2); snake.addPoint(p1); snake.addPoint(p2); ug.draw(snake); } public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { - ug = ug.apply(new UTranslate(x, 0)); + ug = ug.apply(UTranslate.dx(x)); final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder()); if (geo.hasPointOut() == false) { return; } - final Point2D p1 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), geo.getOutY())); - final Point2D p2 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), height)); + final Point2D p1 = new Point2D.Double(geo.getLeft(), barHeight + geo.getOutY()); + final Point2D p2 = new Point2D.Double(geo.getLeft(), justBeforeBar2); final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { @@ -209,7 +311,7 @@ public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate transla snake.addPoint(mp1a.getX(), middle); snake.addPoint(mp2b.getX(), middle); snake.addPoint(mp2b); - snake.setIgnoreForCompression(true); + snake.setIgnoreForCompression(); ug.draw(snake); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderMerge.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderMerge.java index e9fea4444..e64abed42 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderMerge.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderMerge.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,6 +37,7 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; @@ -46,61 +47,74 @@ 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.activitydiagram3.ftile.vertical.FtileBlackBlock; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; -public class ParallelBuilderMerge extends ParallelFtilesBuilder { +public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder { - public ParallelBuilderMerge(ISkinParam skinParam, StringBounder stringBounder, - final List list, Ftile inner, Swimlane swimlane) { - super(skinParam, stringBounder, list, inner, swimlane); + public ParallelBuilderMerge(ISkinParam skinParam, StringBounder stringBounder, List all) { + super(skinParam, stringBounder, all); } @Override - protected Ftile doStep1() { - Ftile result = getMiddle(); + protected Ftile doStep1(Ftile inner) { + Ftile result = inner; final List conns = new ArrayList(); - final HtmlColor colorBar = getRose().getHtmlColor(skinParam(), ColorParam.activityBar); + final HColor colorBar = getRose().getHtmlColor(skinParam(), ColorParam.activityBar); - final Ftile black = new FtileBlackBlock(skinParam(), colorBar, getList().get(0).getSwimlaneIn()); + final Ftile black = new FtileBlackBlock(skinParam(), colorBar, list99.get(0).getSwimlaneIn()); double x = 0; - for (Ftile tmp : getList()) { + for (Ftile tmp : list99) { final Dimension2D dim = tmp.calculateDimension(getStringBounder()); - conns.add(new ConnectionIn(black, tmp, x, tmp.getInLinkRendering().getRainbow( - HtmlColorAndStyle.build(skinParam())))); + final Rainbow def; + if (SkinParam.USE_STYLES()) { + Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder()); + def = Rainbow.build(style, skinParam().getIHtmlColorSet()); + } else { + def = Rainbow.build(skinParam()); + } + final Rainbow rainbow = tmp.getInLinkRendering().getRainbow(def); + conns.add(new ConnectionIn(black, tmp, x, rainbow)); x += dim.getWidth(); } result = FtileUtils.addConnection(result, conns); - ((FtileBlackBlock) black).setBlackBlockDimension(result.calculateDimension(getStringBounder()).getWidth(), barHeight); + ((FtileBlackBlock) black).setBlackBlockDimension(result.calculateDimension(getStringBounder()).getWidth(), + barHeight); return new FtileAssemblySimple(black, result); } @Override - protected Ftile doStep2(Ftile result) { - final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); - final HtmlColor backColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground); - final Ftile out = new FtileDiamond(skinParam(), backColor, borderColor, swimlane()); + protected Ftile doStep2(Ftile inner, Ftile result) { + final HColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); + final HColor backColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground); + final Ftile out = new FtileDiamond(skinParam(), backColor, borderColor, swimlaneOutForStep2()); result = new FtileAssemblySimple(result, out); final List conns = new ArrayList(); final UTranslate diamondTranslate = result.getTranslateFor(out, getStringBounder()); int i = 0; double x = 0; - for (Ftile tmp : getList()) { + for (Ftile tmp : list99) { final Dimension2D dim = tmp.calculateDimension(getStringBounder()); final UTranslate translate0 = new UTranslate(x, barHeight); - conns.add(new ConnectionHorizontalThenVertical(tmp, out, tmp.getOutLinkRendering().getRainbow( - HtmlColorAndStyle.build(skinParam())), translate0, diamondTranslate, i)); + final Rainbow def; + if (SkinParam.USE_STYLES()) { + Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder()); + def = Rainbow.build(style, skinParam().getIHtmlColorSet()); + } else { + def = Rainbow.build(skinParam()); + } + final Rainbow rainbow = tmp.getOutLinkRendering().getRainbow(def); + conns.add(new ConnectionHorizontalThenVertical(tmp, out, rainbow, translate0, diamondTranslate, i)); x += dim.getWidth(); i++; } @@ -179,7 +193,7 @@ public ConnectionIn(Ftile ftile1, Ftile ftile2, double x, Rainbow arrowColor) { } public void drawU(UGraphic ug) { - ug = ug.apply(new UTranslate(x, 0)); + ug = ug.apply(UTranslate.dx(x)); final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) { @@ -191,7 +205,7 @@ public void drawU(UGraphic ug) { } public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { - ug = ug.apply(new UTranslate(x, 0)); + ug = ug.apply(UTranslate.dx(x)); final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); final Point2D p1 = new Point2D.Double(geo.getLeft(), 0); final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY()); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit.java index 6fde377f4..0204c0fa9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,243 +30,280 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; -import java.awt.geom.Dimension2D; +import java.awt.geom.Point2D; import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; +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; import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; +import net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; -import net.sourceforge.plantuml.activitydiagram3.ftile.MergeStrategy; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; -import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; +import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileThinSplit; +import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.graphic.TextBlock; +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.HColor; -public class ParallelBuilderSplit extends ParallelFtilesBuilder { +public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder { - public ParallelBuilderSplit(ISkinParam skinParam, StringBounder stringBounder, - final List list, Ftile inner, Swimlane swimlane) { - super(skinParam, stringBounder, list, inner, swimlane); + public ParallelBuilderSplit(ISkinParam skinParam, StringBounder stringBounder, List all) { + super(skinParam, stringBounder, all); } @Override - protected Ftile doStep1() { - Ftile result = getMiddle(); - final List conns = new ArrayList(); - - double x1 = 0; - for (Ftile tmp : getList()) { - final Dimension2D dim = tmp.calculateDimension(getStringBounder()); - conns.add(new ConnectionIn(tmp, x1, tmp.getInLinkRendering().getRainbow( - HtmlColorAndStyle.build(skinParam())), getTextBlock(tmp.getInLinkRendering()))); - x1 += dim.getWidth(); - } - final double totalWidth1 = result.calculateDimension(getStringBounder()).getWidth(); - conns.add(new ConnectionHline2(result, HtmlColorAndStyle.build(skinParam()), 0, getList(), totalWidth1)); - result = FtileUtils.addConnection(result, conns); - return result; + public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow); } @Override - protected Ftile doStep2(Ftile result) { - final List conns2 = new ArrayList(); - double x2 = 0; - boolean hasOut = false; - for (Ftile tmp : getList()) { - final Dimension2D dim = tmp.calculateDimension(getStringBounder()); - final boolean hasOutTmp = tmp.calculateDimension(getStringBounder()).hasPointOut(); - if (hasOutTmp) { - conns2.add(new ConnectionOut(tmp, x2, tmp.getOutLinkRendering().getRainbow( - HtmlColorAndStyle.build(skinParam())), getHeightOfMiddle(), getTextBlock(tmp - .getOutLinkRendering()))); - hasOut = true; - } - x2 += dim.getWidth(); - } - - if (hasOut) { - final double totalWidth2 = result.calculateDimension(getStringBounder()).getWidth(); - conns2.add(new ConnectionHline2(result, HtmlColorAndStyle.build(skinParam()), getHeightOfMiddle(), - getList(), totalWidth2)); - result = FtileUtils.addConnection(result, conns2); + protected Ftile doStep1(Ftile inner) { + Ftile result = inner; + final List conns = new ArrayList(); + final Rainbow thinColor; + if (SkinParam.USE_STYLES()) { + Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder()); + thinColor = Rainbow.build(style, skinParam().getIHtmlColorSet()); } else { - result = new FtileKilled(result); + thinColor = result.getInLinkRendering().getRainbow(Rainbow.build(skinParam())); } - return result; - } + final Ftile thin = new FtileThinSplit(skinParam(), getThin1Color(thinColor), list99.get(0).getSwimlaneIn()); + double x = 0; + double first = 0; + double last = 0; + for (Ftile tmp : list99) { + final FtileGeometry dim = tmp.calculateDimension(getStringBounder()); + if (first == 0) { + first = x + dim.getLeft(); + } + last = x + dim.getLeft(); - static class ConnectionHline2 extends AbstractConnection { + final LinkRendering inLinkRendering = tmp.getInLinkRendering(); + final Rainbow rainbow; + if (SkinParam.USE_STYLES()) { + Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder()); + rainbow = inLinkRendering.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet())); + } else { + rainbow = inLinkRendering.getRainbow(Rainbow.build(skinParam())); + } - private final Ftile inner; - private final double y; - private final Rainbow arrowColor; - private final List list; - private final double totalWidth; + conns.add(new ConnectionIn(thin, tmp, x, rainbow)); + x += dim.getWidth(); + } - public ConnectionHline2(Ftile inner, Rainbow arrowColor, double y, List list, double totalWidth) { - super(null, null); - this.inner = inner; - this.y = y; - this.arrowColor = arrowColor; - this.list = list; - this.totalWidth = totalWidth; + result = FtileUtils.addConnection(result, conns); + final FtileGeometry geom = result.calculateDimension(getStringBounder()); + if (last < geom.getLeft()) { + last = geom.getLeft(); } + if (first > geom.getLeft()) { + first = geom.getLeft(); + } + ((FtileThinSplit) thin).setGeom(first, last, result.calculateDimension(getStringBounder()).getWidth()); - public void drawU(UGraphic ug) { - double minX = Double.MAX_VALUE; - double maxX = 0; - if (y == 0 && ug instanceof UGraphicInterceptorOneSwimlane) { - final Swimlane intoSw = ((UGraphicInterceptorOneSwimlane) ug).getSwimlane(); - boolean found = false; - for (Ftile tmp : list) { - if (tmp.getSwimlaneIn() == intoSw) { - found = true; - } - } - if (found == false) { - return; - } - } - final StringBounder stringBounder = ug.getStringBounder(); - for (Ftile tmp : list) { - if (y > 0 && tmp.calculateDimension(stringBounder).hasPointOut() == false) { - continue; - } - final UTranslate ut = inner.getTranslateFor(tmp, stringBounder); - if (ut == null) { - continue; - } - final double middle = tmp.calculateDimension(stringBounder).translate(ut).getLeft(); - minX = Math.min(minX, middle); - maxX = Math.max(maxX, middle); - } - if (minX > totalWidth / 2) { - minX = totalWidth / 2; + return new FtileAssemblySimple(thin, result); + } + + private HColor getThin1Color(final Rainbow thinColor) { + for (Ftile tmp : list99) { + final Rainbow rainbow; + final LinkRendering inLinkRendering = tmp.getInLinkRendering(); + if (SkinParam.USE_STYLES()) { + Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder()); + rainbow = inLinkRendering.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet())); + } else { + rainbow = inLinkRendering.getRainbow(Rainbow.build(skinParam())); } - if (maxX < totalWidth / 2) { - maxX = totalWidth / 2; + if (rainbow.isInvisible() == false) { + return thinColor.getColor(); } - - final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor); - s.goUnmergeable(MergeStrategy.NONE); - s.addPoint(minX, y); - s.addPoint(maxX, y); - ug.draw(s); } + return null; } - static class ConnectionHline3 extends AbstractConnection implements ConnectionTranslatable { + private boolean hasOut() { + for (Ftile tmp : list99) { + final boolean hasOutTmp = tmp.calculateDimension(getStringBounder()).hasPointOut(); + if (hasOutTmp) { + return true; + } + } + return false; + } - private final Ftile inner; - private final double y; - private final Rainbow arrowColor; - private final List list; - private final double totalWidth; + @Override + protected Ftile doStep2(Ftile inner, Ftile result) { - public ConnectionHline3(Ftile inner, Rainbow arrowColor, double y, List list, double totalWidth) { - super(null, null); - this.inner = inner; - this.y = y; - this.arrowColor = arrowColor; - this.list = list; - this.totalWidth = totalWidth; + final FtileGeometry geom = result.calculateDimension(getStringBounder()); + if (hasOut() == false) { + return new FtileKilled(result); } - public void drawU(UGraphic ug) { - throw new UnsupportedOperationException(); + final Rainbow thinColor; + final LinkRendering inLinkRendering = result.getInLinkRendering(); + if (SkinParam.USE_STYLES()) { + Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder()); + thinColor = inLinkRendering.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet())); + } else { + thinColor = inLinkRendering.getRainbow(Rainbow.build(skinParam())); } - public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { - final StringBounder stringBounder = ug.getStringBounder(); - final UTranslate left = inner.getSwimlaneIn().getTranslate(); - double minX = inner.calculateDimension(stringBounder).getLeft() + left.getDx(); - double maxX = minX; - - for (Ftile tmp : list) { - final FtileGeometry tmpGeom = tmp.calculateDimension(stringBounder); - final UTranslate tpos = inner.getTranslateFor(tmp, stringBounder); - for (Swimlane sw : tmp.getSwimlanes()) { - final double x = tmpGeom.translate(sw.getTranslate().compose(tpos)).getLeft(); - minX = Math.min(minX, x); - maxX = Math.max(maxX, x); + final Ftile out = new FtileThinSplit(skinParam(), thinColor.getColor(), swimlaneOutForStep2()); + result = new FtileAssemblySimple(result, out); + final List conns = new ArrayList(); + double x = 0; + double first = 0; + double last = 0; + for (Ftile tmp : list99) { + final UTranslate translate0 = UTranslate.dy(1.5); + final FtileGeometry dim = tmp.calculateDimension(getStringBounder()); + if (dim.hasPointOut()) { + if (first == 0) { + first = x + dim.getLeft(); } + last = x + dim.getLeft(); + } + + final Rainbow rainbow; + final LinkRendering outLinkRendering = tmp.getOutLinkRendering(); + if (SkinParam.USE_STYLES()) { + Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder()); + rainbow = outLinkRendering.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet())); + } else { + rainbow = outLinkRendering.getRainbow(Rainbow.build(skinParam())); } - final Dimension2D dimInner = inner.calculateDimension(stringBounder); - - final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor); - // final Snake s = new Snake(HtmlColorUtils.GREEN); - s.goUnmergeable(MergeStrategy.LIMITED); - s.addPoint(minX, y); - s.addPoint(maxX, y); - ug.draw(s); + + conns.add(new ConnectionOut(translate0, tmp, out, x, rainbow, getHeightOfMiddle(inner))); + x += dim.getWidth(); } + if (last < geom.getLeft()) { + last = geom.getLeft(); + } + if (first > geom.getLeft()) { + first = geom.getLeft(); + } + ((FtileThinSplit) out).setGeom(first, last, geom.getWidth()); + result = FtileUtils.addConnection(result, conns); + return result; } - static class ConnectionIn extends AbstractConnection { + class ConnectionIn extends AbstractConnection implements ConnectionTranslatable { private final double x; private final Rainbow arrowColor; - private final TextBlock text; + private final Display label; - public ConnectionIn(Ftile tmp, double x, Rainbow arrowColor, TextBlock text) { - super(null, tmp); + public ConnectionIn(Ftile ftile1, Ftile ftile2, double x, Rainbow arrowColor) { + super(ftile1, ftile2); + label = ftile2.getInLinkRendering().getDisplay(); this.x = x; this.arrowColor = arrowColor; - this.text = text; } public void drawU(UGraphic ug) { - ug = ug.apply(new UTranslate(x, 0)); - final FtileGeometry geo = getFtile2().calculateDimension(ug.getStringBounder()); - final double left = geo.getLeft(); - final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); - s.setLabel(text); - s.addPoint(left, 0); - s.addPoint(left, geo.getInY()); - ug.draw(s); + ug = ug.apply(UTranslate.dx(x)); + final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); + if (Display.isNull(label) == false) { + snake.setLabel(getTextBlock(label)); + } + snake.addPoint(geo.getLeft(), 0); + snake.addPoint(geo.getLeft(), geo.getInY()); + ug.draw(snake); + } + + public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { + ug = ug.apply(UTranslate.dx(x)); + final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); + final Point2D p1 = new Point2D.Double(geo.getLeft(), 0); + final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY()); + + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); + if (Display.isNull(label) == false) { + snake.setLabel(getTextBlock(label)); + } + final Point2D mp1a = translate1.getTranslated(p1); + final Point2D mp2b = translate2.getTranslated(p2); + final double middle = mp1a.getY() + 4; + snake.addPoint(mp1a); + snake.addPoint(mp1a.getX(), middle); + snake.addPoint(mp2b.getX(), middle); + snake.addPoint(mp2b); + ug.draw(snake); } } - static class ConnectionOut extends AbstractConnection { + class ConnectionOut extends AbstractConnection implements ConnectionTranslatable { private final double x; private final Rainbow arrowColor; private final double height; - private final TextBlock text; + private final Display label; + private final UTranslate translate0; - public ConnectionOut(Ftile tmp, double x, Rainbow arrowColor, double height, TextBlock text) { - super(tmp, null); + public ConnectionOut(UTranslate translate0, Ftile ftile1, Ftile ftile2, double x, Rainbow arrowColor, + double height) { + super(ftile1, ftile2); + this.translate0 = translate0; + this.label = ftile1.getOutLinkRendering().getDisplay(); this.x = x; this.arrowColor = arrowColor; this.height = height; - this.text = text; } public void drawU(UGraphic ug) { - ug = ug.apply(new UTranslate(x, 0)); - final FtileGeometry geo = getFtile1().calculateDimension(ug.getStringBounder()); + ug = ug.apply(UTranslate.dx(x)); + final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder()); + if (geo.hasPointOut() == false) { + return; + } + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); + if (Display.isNull(label) == false) { + snake.setLabel(getTextBlock(label)); + } + final Point2D p1 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), geo.getOutY())); + final Point2D p2 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), height)); + snake.addPoint(p1); + snake.addPoint(p2); + ug.draw(snake); + } + + public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { + ug = ug.apply(UTranslate.dx(x)); + final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder()); if (geo.hasPointOut() == false) { - assert false; return; } - final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); - s.setLabel(text); - s.goUnmergeable(MergeStrategy.NONE); - s.addPoint(geo.getLeft(), geo.getOutY()); - s.addPoint(geo.getLeft(), height); - ug.draw(s); + final Point2D p1 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), geo.getOutY())); + final Point2D p2 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), height)); + + final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); + if (Display.isNull(label) == false) { + snake.setLabel(getTextBlock(label)); + } + final Point2D mp1a = translate1.getTranslated(p1); + final Point2D mp2b = translate2.getTranslated(p2); + final double middle = mp2b.getY() - 14; + snake.addPoint(mp1a); + snake.addPoint(mp1a.getX(), middle); + snake.addPoint(mp2b.getX(), middle); + snake.addPoint(mp2b); + ug.draw(snake); } + } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit2.java deleted file mode 100644 index 585b7bd0a..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelBuilderSplit2.java +++ /dev/null @@ -1,264 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; - -import java.awt.geom.Point2D; -import java.util.ArrayList; -import java.util.List; - -import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; -import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; -import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; -import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable; -import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; -import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; -import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileThinSplit; -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; -import net.sourceforge.plantuml.graphic.Rainbow; -import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UTranslate; - -public class ParallelBuilderSplit2 extends ParallelFtilesBuilder { - - public ParallelBuilderSplit2(ISkinParam skinParam, StringBounder stringBounder, final List list, - Ftile inner, Swimlane swimlane) { - super(skinParam, stringBounder, list, inner, swimlane); - } - - @Override - protected Ftile doStep1() { - Ftile result = getMiddle(); - final List conns = new ArrayList(); - final Rainbow thinColor = result.getInLinkRendering().getRainbow(HtmlColorAndStyle.build(skinParam())); - final Ftile thin = new FtileThinSplit(skinParam(), getThin1Color(thinColor), getList().get(0).getSwimlaneIn()); - double x = 0; - double first = 0; - double last = 0; - for (Ftile tmp : getList()) { - final FtileGeometry dim = tmp.calculateDimension(getStringBounder()); - if (first == 0) { - first = x + dim.getLeft(); - } - last = x + dim.getLeft(); - final Rainbow rainbow = tmp.getInLinkRendering().getRainbow(HtmlColorAndStyle.build(skinParam())); - conns.add(new ConnectionIn(thin, tmp, x, rainbow)); - x += dim.getWidth(); - } - - result = FtileUtils.addConnection(result, conns); - final FtileGeometry geom = result.calculateDimension(getStringBounder()); - if (last < geom.getLeft()) { - last = geom.getLeft(); - } - if (first > geom.getLeft()) { - first = geom.getLeft(); - } - ((FtileThinSplit) thin).setGeom(first, last, result.calculateDimension(getStringBounder()).getWidth()); - - return new FtileAssemblySimple(thin, result); - } - - private HtmlColor getThin1Color(final Rainbow thinColor) { - for (Ftile tmp : getList()) { - final Rainbow rainbow = tmp.getInLinkRendering().getRainbow(HtmlColorAndStyle.build(skinParam())); - if (rainbow.isInvisible() == false) { - return thinColor.getColor(); - } - } - return null; - } - - private boolean hasOut() { - for (Ftile tmp : getList()) { - final boolean hasOutTmp = tmp.calculateDimension(getStringBounder()).hasPointOut(); - if (hasOutTmp) { - return true; - } - } - return false; - } - - @Override - protected Ftile doStep2(Ftile result) { - - final FtileGeometry geom = result.calculateDimension(getStringBounder()); - if (hasOut() == false) { - return new FtileKilled(result); - } - - final Rainbow thinColor = result.getInLinkRendering().getRainbow(HtmlColorAndStyle.build(skinParam())); - // final Ftile out = new FtileThinSplit(skinParam(), thinColor.getColor(), getList().get(0).getSwimlaneIn()); - final Ftile out = new FtileThinSplit(skinParam(), thinColor.getColor(), swimlane()); - result = new FtileAssemblySimple(result, out); - final List conns = new ArrayList(); - double x = 0; - double first = 0; - double last = 0; - for (Ftile tmp : getList()) { - final UTranslate translate0 = new UTranslate(0, 1.5); - final FtileGeometry dim = tmp.calculateDimension(getStringBounder()); - if (dim.hasPointOut()) { - if (first == 0) { - first = x + dim.getLeft(); - } - last = x + dim.getLeft(); - } - conns.add(new ConnectionOut(translate0, tmp, out, x, tmp.getOutLinkRendering().getRainbow( - HtmlColorAndStyle.build(skinParam())), getHeightOfMiddle())); - x += dim.getWidth(); - } - if (last < geom.getLeft()) { - last = geom.getLeft(); - } - if (first > geom.getLeft()) { - first = geom.getLeft(); - } - ((FtileThinSplit) out).setGeom(first, last, geom.getWidth()); - result = FtileUtils.addConnection(result, conns); - return result; - } - - class ConnectionIn extends AbstractConnection implements ConnectionTranslatable { - - private final double x; - private final Rainbow arrowColor; - private final Display label; - - public ConnectionIn(Ftile ftile1, Ftile ftile2, double x, Rainbow arrowColor) { - super(ftile1, ftile2); - label = ftile2.getInLinkRendering().getDisplay(); - this.x = x; - this.arrowColor = arrowColor; - } - - public void drawU(UGraphic ug) { - ug = ug.apply(new UTranslate(x, 0)); - final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); - final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); - if (Display.isNull(label) == false) { - snake.setLabel(getTextBlock(label)); - } - snake.addPoint(geo.getLeft(), 0); - snake.addPoint(geo.getLeft(), geo.getInY()); - ug.draw(snake); - } - - public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { - ug = ug.apply(new UTranslate(x, 0)); - final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder()); - final Point2D p1 = new Point2D.Double(geo.getLeft(), 0); - final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY()); - - final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); - if (Display.isNull(label) == false) { - snake.setLabel(getTextBlock(label)); - } - final Point2D mp1a = translate1.getTranslated(p1); - final Point2D mp2b = translate2.getTranslated(p2); - final double middle = mp1a.getY() + 4; - snake.addPoint(mp1a); - snake.addPoint(mp1a.getX(), middle); - snake.addPoint(mp2b.getX(), middle); - snake.addPoint(mp2b); - ug.draw(snake); - } - } - - class ConnectionOut extends AbstractConnection implements ConnectionTranslatable { - - private final double x; - private final Rainbow arrowColor; - private final double height; - private final Display label; - private final UTranslate translate0; - - public ConnectionOut(UTranslate translate0, Ftile ftile1, Ftile ftile2, double x, Rainbow arrowColor, - double height) { - super(ftile1, ftile2); - this.translate0 = translate0; - this.label = ftile1.getOutLinkRendering().getDisplay(); - this.x = x; - this.arrowColor = arrowColor; - this.height = height; - } - - public void drawU(UGraphic ug) { - ug = ug.apply(new UTranslate(x, 0)); - final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder()); - if (geo.hasPointOut() == false) { - return; - } - final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); - if (Display.isNull(label) == false) { - snake.setLabel(getTextBlock(label)); - } - final Point2D p1 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), geo.getOutY())); - final Point2D p2 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), height)); - snake.addPoint(p1); - snake.addPoint(p2); - ug.draw(snake); - } - - public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) { - ug = ug.apply(new UTranslate(x, 0)); - final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder()); - if (geo.hasPointOut() == false) { - return; - } - final Point2D p1 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), geo.getOutY())); - final Point2D p2 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), height)); - - final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); - if (Display.isNull(label) == false) { - snake.setLabel(getTextBlock(label)); - } - final Point2D mp1a = translate1.getTranslated(p1); - final Point2D mp2b = translate2.getTranslated(p2); - final double middle = mp2b.getY() - 14; - snake.addPoint(mp1a); - snake.addPoint(mp1a.getX(), middle); - snake.addPoint(mp2b.getX(), middle); - snake.addPoint(mp2b); - ug.draw(snake); - } - - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelFtilesBuilder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelFtilesBuilder.java deleted file mode 100644 index d27e3f99b..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/ParallelFtilesBuilder.java +++ /dev/null @@ -1,126 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; - -import java.util.Collections; -import java.util.List; - -import net.sourceforge.plantuml.FontParam; -import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.activitydiagram3.LinkRendering; -import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; -import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.creole.CreoleMode; -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.skin.rose.Rose; - -public abstract class ParallelFtilesBuilder { - - protected final double barHeight = 6; - - private final Rose rose = new Rose(); - - private final ISkinParam skinParam; - private final StringBounder stringBounder; - - private final List list; - private final Ftile middle; - private final FtileGeometry middleDimension; - private final Swimlane swimlane; - - public ParallelFtilesBuilder(ISkinParam skinParam, StringBounder stringBounder, final List list, - Ftile middle, Swimlane swimlane) { - this.skinParam = skinParam; - this.stringBounder = stringBounder; - this.list = list; - this.middle = middle; - this.middleDimension = middle.calculateDimension(getStringBounder()); - this.swimlane = swimlane; - } - - public final Ftile build() { - final Ftile step1 = doStep1(); - return doStep2(step1); - } - - protected abstract Ftile doStep1(); - - protected abstract Ftile doStep2(Ftile step1); - - protected StringBounder getStringBounder() { - return stringBounder; - } - - protected Rose getRose() { - return rose; - } - - protected ISkinParam skinParam() { - return skinParam; - } - - protected final TextBlock getTextBlock(Display display) { - // DUP3945 - if (Display.isNull(display)) { - return null; - } - final FontConfiguration fontConfiguration = new FontConfiguration(skinParam(), FontParam.ARROW, null); - return display.create(fontConfiguration, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE); - } - - protected TextBlock getTextBlock(LinkRendering linkRendering) { - // DUP1433 - final Display display = linkRendering.getDisplay(); - return getTextBlock(display); - } - - protected final List getList() { - return Collections.unmodifiableList(list); - } - - protected final Ftile getMiddle() { - return middle; - } - - protected final double getHeightOfMiddle() { - return middleDimension.getHeight(); - } - - protected final Swimlane swimlane() { - return swimlane; - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorGoto.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorGoto.java index e70efd782..e1f58c146 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorGoto.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorGoto.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorOneSwimlane.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorOneSwimlane.java index ead86fbe4..23a4daa21 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorOneSwimlane.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorOneSwimlane.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,27 +30,29 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; +import java.util.Collections; +import java.util.List; import java.util.Set; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UGraphicDelegator; import net.sourceforge.plantuml.ugraphic.UChange; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class UGraphicInterceptorOneSwimlane extends UGraphicDelegator { private final Swimlane swimlane; + private final List orderedList; - public UGraphicInterceptorOneSwimlane(UGraphic ug, Swimlane swimlane) { + public UGraphicInterceptorOneSwimlane(UGraphic ug, Swimlane swimlane, List orderedList) { super(ug); this.swimlane = swimlane; + this.orderedList = orderedList; } public void draw(UShape shape) { @@ -83,17 +85,20 @@ public void draw(UShape shape) { } private void drawGoto() { - final UGraphic ugGoto = getUg().apply(new UChangeColor(HtmlColorUtils.GREEN)).apply( - new UChangeBackColor(HtmlColorUtils.GREEN)); + final UGraphic ugGoto = getUg().apply(HColorUtils.GREEN).apply(HColorUtils.GREEN.bg()); ugGoto.draw(new ULine(100, 100)); } public UGraphic apply(UChange change) { - return new UGraphicInterceptorOneSwimlane(getUg().apply(change), swimlane); + return new UGraphicInterceptorOneSwimlane(getUg().apply(change), swimlane, orderedList); } public final Swimlane getSwimlane() { return swimlane; } + public final List getOrderedListOfAllSwimlanes() { + return Collections.unmodifiableList(orderedList); + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java index a6c8b3550..50c2e0d3e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,6 +37,7 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.ForkStyle; @@ -56,12 +57,17 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateIn; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateOut; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.Colors; 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.StyleBuilder; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class VCompactFactory implements FtileFactory { @@ -73,38 +79,70 @@ public StringBounder getStringBounder() { return stringBounder; } + public StyleBuilder getCurrentStyleBuilder() { + return skinParam.getCurrentStyleBuilder(); + } + public VCompactFactory(ISkinParam skinParam, StringBounder stringBounder) { this.skinParam = skinParam; this.stringBounder = stringBounder; } + final public StyleSignature getDefaultStyleDefinitionCircle() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle); + } + public Ftile start(Swimlane swimlane) { - final HtmlColor color = rose.getHtmlColor(skinParam, ColorParam.activityStart); - return new FtileCircleStart(skinParam(), color, swimlane); + final HColor color; + Style style = null; + if (SkinParam.USE_STYLES()) { + style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder()); + color = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); + } else { + color = rose.getHtmlColor(skinParam, ColorParam.activityStart); + } + return new FtileCircleStart(skinParam(), color, swimlane, style); } public Ftile stop(Swimlane swimlane) { - final HtmlColor color = rose.getHtmlColor(skinParam, ColorParam.activityEnd); - return new FtileCircleStop(skinParam(), color, swimlane); + final HColor color; + Style style = null; + if (SkinParam.USE_STYLES()) { + style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder()); + color = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); + } else { + color = rose.getHtmlColor(skinParam, ColorParam.activityEnd); + } + return new FtileCircleStop(skinParam(), color, swimlane, style); } - public Ftile spot(Swimlane swimlane, String spot) { - // final HtmlColor color = rose.getHtmlColor(skinParam, ColorParam.activityBackground); + public Ftile spot(Swimlane swimlane, String spot, HColor color) { + // final HtmlColor color = rose.getHtmlColor(skinParam, + // ColorParam.activityBackground); final UFont font = skinParam.getFont(null, false, FontParam.ACTIVITY); - return new FtileCircleSpot(skinParam(), swimlane, spot, font); + return new FtileCircleSpot(skinParam(), swimlane, spot, font, color); } public Ftile end(Swimlane swimlane) { - final HtmlColor color = rose.getHtmlColor(skinParam, ColorParam.activityEnd); - return new FtileCircleEnd(skinParam(), color, swimlane); + final HColor color; + Style style = null; + if (SkinParam.USE_STYLES()) { + style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder()); + color = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); + } else { + color = rose.getHtmlColor(skinParam, ColorParam.activityEnd); + } + return new FtileCircleEnd(skinParam(), color, swimlane, style); } - public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors) { - // final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.activityBorder); - // final HtmlColor backColor = color == null ? rose.getHtmlColor(skinParam, ColorParam.activityBackground) : + public Ftile activity(Display label, Swimlane swimlane, BoxStyle boxStyle, Colors colors) { + // final HtmlColor borderColor = rose.getHtmlColor(skinParam, + // ColorParam.activityBorder); + // final HtmlColor backColor = color == null ? rose.getHtmlColor(skinParam, + // ColorParam.activityBackground) : // color; final UFont font = skinParam.getFont(null, false, FontParam.ACTIVITY); - return new FtileBox(colors.mute(skinParam), label, font, swimlane, style); + return FtileBox.create(colors.mute(skinParam), label, swimlane, boxStyle); } public Ftile addNote(Ftile ftile, Swimlane swimlane, Collection notes) { @@ -119,14 +157,14 @@ public Ftile assembly(Ftile tile1, Ftile tile2) { return new FtileAssemblySimple(tile1, tile2); } - public Ftile repeat(Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, Ftile repeat, Display test, - Display yes, Display out, HtmlColor color, LinkRendering backRepeatLinkRendering, Ftile backward, - boolean noOut) { + public Ftile repeat(BoxStyle boxStyleIn, Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, Ftile repeat, + Display test, Display yes, Display out, Colors colors, LinkRendering backRepeatLinkRendering, + Ftile backward, boolean noOut) { return repeat; } public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out, - LinkRendering afterEndwhile, HtmlColor color, Instruction specialOut) { + LinkRendering afterEndwhile, HColor color, Instruction specialOut, Ftile back) { return whileBlock; } @@ -149,12 +187,12 @@ public Ftile createSwitch(Swimlane swimlane, List branches, LinkRenderin return new FtileForkInner(ftiles); } - public Ftile createParallel(Swimlane swimlane, List all, ForkStyle style, String label) { + public Ftile createParallel(List all, ForkStyle style, String label, Swimlane in, Swimlane out) { return new FtileForkInner(all); } - public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, PositionedNote note, - HtmlColor borderColor, USymbol type, double roundCorner) { + public Ftile createGroup(Ftile list, Display name, HColor backColor, HColor titleColor, PositionedNote note, + HColor borderColor, USymbol type, double roundCorner) { return list; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java index 5f54237d7..96aa03bb8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,13 +34,14 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineBreakStrategy; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth; +import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidthCentered; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileWithUrl; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; @@ -48,25 +49,29 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside; import net.sourceforge.plantuml.creole.CreoleMode; -import net.sourceforge.plantuml.creole.CreoleParser; +import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.creole.Sheet; import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.creole.SheetBlock2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; 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.ConditionEndStyle; import net.sourceforge.plantuml.svek.ConditionStyle; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ConditionalBuilder { private final Swimlane swimlane; - private final HtmlColor borderColor; - private final HtmlColor backColor; + private final HColor borderColor; + private final HColor backColor; private final Rainbow arrowColor; private final FtileFactory ftileFactory; private final ConditionStyle conditionStyle; @@ -82,31 +87,52 @@ public class ConditionalBuilder { private final Ftile tile2; private final Url url; - public ConditionalBuilder(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, + public StyleSignature getDefaultStyleDefinitionDiamond() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond); + } + + public StyleSignature getDefaultStyleDefinitionArrow() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow); + } + + public ConditionalBuilder(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle, Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fontArrow, FontConfiguration fontTest, Url url) { - this.swimlane = swimlane; - this.borderColor = borderColor; - this.backColor = backColor; - this.arrowColor = arrowColor; + if (SkinParam.USE_STYLES()) { + final Style styleArrow = getDefaultStyleDefinitionArrow() + .getMergedStyle(skinParam.getCurrentStyleBuilder()); + final Style styleDiamond = getDefaultStyleDefinitionDiamond() + .getMergedStyle(skinParam.getCurrentStyleBuilder()); + this.borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); + this.backColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); + this.arrowColor = Rainbow.fromColor(styleArrow.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()), + null); + this.fontTest = styleDiamond.getFontConfiguration(skinParam.getIHtmlColorSet()); + this.fontArrow = styleArrow.getFontConfiguration(skinParam.getIHtmlColorSet()); + } else { + this.borderColor = borderColor; + this.backColor = backColor; + this.arrowColor = arrowColor; + this.fontTest = fontTest; + this.fontArrow = fontArrow; + } this.ftileFactory = ftileFactory; + this.swimlane = swimlane; this.conditionStyle = conditionStyle; this.conditionEndStyle = conditionEndStyle; this.branch1 = branch1; this.branch2 = branch2; this.skinParam = skinParam; this.stringBounder = stringBounder; - this.fontArrow = fontArrow; - this.fontTest = fontTest; this.url = url; - this.tile1 = new FtileMinWidth(branch1.getFtile(), 30); - this.tile2 = new FtileMinWidth(branch2.getFtile(), 30); + this.tile1 = new FtileMinWidthCentered(branch1.getFtile(), 30); + this.tile2 = new FtileMinWidthCentered(branch2.getFtile(), 30); } - static public Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, + static public Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle, Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fcArrow, FontConfiguration fcTest, Url url) { @@ -135,8 +161,8 @@ private static boolean isEmptyOrOnlySingleStopOrSpot(Branch branch) { } private Ftile createDown(Branch branch1, Branch branch2) { - final Ftile tile1 = new FtileMinWidth(branch1.getFtile(), 30); - final Ftile tile2 = new FtileMinWidth(branch2.getFtile(), 30); + final Ftile tile1 = new FtileMinWidthCentered(branch1.getFtile(), 30); + final Ftile tile2 = new FtileMinWidthCentered(branch2.getFtile(), 30); final TextBlock tb1 = getLabelPositive(branch1); final TextBlock tb2 = getLabelPositive(branch2); final Ftile diamond1 = getDiamond1(false, tb1, tb2); @@ -207,7 +233,7 @@ private Ftile getDiamond1(boolean eastWest) { private Ftile getDiamond1(boolean eastWest, TextBlock tb1, TextBlock tb2) { final Display labelTest = branch1.getLabelTest(); - final Sheet sheet = new CreoleParser(fontTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), + final Sheet sheet = Parser.build(fontTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL).createSheet(labelTest); final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()); final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), tile1.getThickness()); @@ -236,7 +262,7 @@ private Ftile getDiamond1(boolean eastWest, TextBlock tb1, TextBlock tb2) { } private TextBlock getLabelPositive(Branch branch) { - return branch.getLabelPositive().create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam(), + return branch.getLabelPositive().create7(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam(), CreoleMode.SIMPLE_LINE); } @@ -248,11 +274,13 @@ private Ftile getDiamond2(Branch branch1, Branch branch2, boolean useNorth) { // else use default ConditionEndStyle.DIAMOND if (hasTwoBranches()) { final Display out1 = branch1.getFtile().getOutLinkRendering().getDisplay(); - final TextBlock tbout1 = out1 == null ? null : out1.create(fontArrow, HorizontalAlignment.LEFT, - ftileFactory.skinParam(), CreoleMode.SIMPLE_LINE); + final TextBlock tbout1 = out1 == null ? null + : out1.create7(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam(), + CreoleMode.SIMPLE_LINE); final Display out2 = branch2.getFtile().getOutLinkRendering().getDisplay(); - final TextBlock tbout2 = out2 == null ? null : out2.create(fontArrow, HorizontalAlignment.LEFT, - ftileFactory.skinParam(), CreoleMode.SIMPLE_LINE); + final TextBlock tbout2 = out2 == null ? null + : out2.create7(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam(), + CreoleMode.SIMPLE_LINE); FtileDiamond tmp = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane); tmp = useNorth ? tmp.withNorth(tbout1) : tmp.withWest(tbout1); tmp = tmp.withEast(tbout2); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileDimensionMemoize.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileDimensionMemoize.java index 967515090..fa9ac5502 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileDimensionMemoize.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileDimensionMemoize.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfNude.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfNude.java index bb558737b..f0f5b2843 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfNude.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfNude.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithDiamonds.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithDiamonds.java index 401ff294c..0079f58c8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithDiamonds.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithDiamonds.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -111,14 +111,14 @@ public void drawU(UGraphic ug) { protected UTranslate getTranslate1(StringBounder stringBounder) { final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); return super.getTranslate1(stringBounder).compose( - new UTranslate(0, dimDiamond1.getHeight() + getYdelta1a(stringBounder))); + UTranslate.dy(dimDiamond1.getHeight() + getYdelta1a(stringBounder))); } @Override protected UTranslate getTranslate2(StringBounder stringBounder) { final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); return super.getTranslate2(stringBounder).compose( - new UTranslate(0, dimDiamond1.getHeight() + getYdelta1a(stringBounder))); + UTranslate.dy(dimDiamond1.getHeight() + getYdelta1a(stringBounder))); } protected UTranslate getTranslateDiamond1(StringBounder stringBounder) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java index 0e45c107f..aec0d6b13 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchNude.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchNude.java index 66fc77ea4..92aa93cd5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchNude.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchNude.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -95,7 +95,7 @@ protected UTranslate getTranslateNude(Ftile tile, StringBounder stringBounder) { for (Ftile candidate : tiles) { final FtileGeometry dim1 = candidate.calculateDimension(stringBounder); if (candidate == tile) { - return new UTranslate(x1, 0); + return UTranslate.dx(x1); } x1 += dim1.getWidth() + xSeparation; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithDiamonds.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithDiamonds.java index f44f9ac07..5553d5289 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithDiamonds.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithDiamonds.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -150,14 +150,14 @@ protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) { final double suppx = (w13 - w9) / (tiles.size() - 1); for (int i = 0; i < tiles.size() - 1; i++) { if (tile == tiles.get(i)) { - return main.compose(new UTranslate(dx, 0)); + return main.compose(UTranslate.dx(dx)); } 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; - return main.compose(new UTranslate(dx9, 0)); + return main.compose(UTranslate.dx(dx9)); } throw new IllegalArgumentException(); @@ -168,7 +168,7 @@ protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) { protected UTranslate getTranslateMain(StringBounder stringBounder) { final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); final double dy1 = dimDiamond1.getHeight() + getYdelta1a(stringBounder); - return new UTranslate(0, dy1); + return UTranslate.dy(dy1); } protected UTranslate getTranslateDiamond1(StringBounder stringBounder) { @@ -189,7 +189,7 @@ protected UTranslate getTranslateDiamond2(StringBounder stringBounder) { protected TextBlock getLabelPositive(Branch branch) { final FontConfiguration fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null); - return branch.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE); + return branch.getLabelPositive().create7(fcArrow, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithManyLinks.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithManyLinks.java index bcccd46a9..3e1ee525a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithManyLinks.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithManyLinks.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithOneLink.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithOneLink.java index dcbfa4bd6..35b36721b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithOneLink.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithOneLink.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,7 +34,6 @@ import java.util.ArrayList; import java.util.List; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; @@ -44,12 +43,8 @@ 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.creole.CreoleMode; -import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UGraphic; public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java index 5df22d2ee..66f08e9e0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,15 +38,13 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; 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; public class FtileBlackBlock extends AbstractFtile { @@ -55,10 +53,10 @@ public class FtileBlackBlock extends AbstractFtile { private double width; private double height; private TextBlock label = TextBlockUtils.empty(0, 0); - private final HtmlColor colorBar; + private final HColor colorBar; private final Swimlane swimlane; - public FtileBlackBlock(ISkinParam skinParam, HtmlColor colorBar, Swimlane swimlane) { + public FtileBlackBlock(ISkinParam skinParam, HColor colorBar, Swimlane swimlane) { super(skinParam); this.colorBar = colorBar; this.swimlane = swimlane; @@ -86,12 +84,11 @@ protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) { } public void drawU(UGraphic ug) { - final URectangle rect = new URectangle(width, height, 5, 5); - rect.setIgnoreForCompression(true); + final URectangle rect = new URectangle(width, height).rounded(5).ignoreForCompressionOnX(); if (skinParam().shadowing(null)) { rect.setDeltaShadow(3); } - ug.apply(new UChangeColor(colorBar)).apply(new UChangeBackColor(colorBar)).draw(rect); + ug.apply(colorBar).apply(colorBar.bg()).draw(rect); final Dimension2D dimLabel = label.calculateDimension(ug.getStringBounder()); label.drawU(ug.apply(new UTranslate(width + labelMargin, -dimLabel.getHeight() / 2))); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java index e756fc7b7..1f60c67df 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,6 +39,9 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.LineBreakStrategy; +import net.sourceforge.plantuml.SkinParam; +import net.sourceforge.plantuml.SkinParamColors; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; @@ -47,7 +50,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.creole.CreoleMode; -import net.sourceforge.plantuml.creole.CreoleParser; +import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.creole.Sheet; import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.creole.SheetBlock2; @@ -55,31 +58,52 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; +import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont; +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.StyleBuilder; +import net.sourceforge.plantuml.style.StyleSignature; 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.HColorNone; public class FtileBox extends AbstractFtile { - private static final int MARGIN = 10; - + private double padding1 = 10; + private double padding2 = 10; + private double paddingTop = 10; + private double paddingBottom = 10; private final TextBlock tb; + private double roundCorner = 25; + private final double shadowing; + private final HorizontalAlignment horizontalAlignment; + private double minimumWidth = 0; - private final LinkRendering inRenreding; + private final LinkRendering inRendering; private final Swimlane swimlane; - private final BoxStyle style; - // private final ISkinParam skinParam; + private final BoxStyle boxStyle; + + private final HColor borderColor; + private final HColor backColor; + private final Style style; + + static public StyleSignature getDefaultStyleDefinitionActivity() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity); + } + + static public StyleSignature getDefaultStyleDefinitionArrow() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow); + } final public LinkRendering getInLinkRendering() { - return inRenreding; + return inRendering; } public Set getSwimlanes() { @@ -100,27 +124,100 @@ public Swimlane getSwimlaneOut() { class MyStencil implements Stencil { public double getStartingX(StringBounder stringBounder, double y) { - return -MARGIN; + return -padding1; } public double getEndingX(StringBounder stringBounder, double y) { final Dimension2D dim = calculateDimension(stringBounder); - return dim.getWidth() - MARGIN; + return dim.getWidth() - padding2; + } + + } + + public static FtileBox create(ISkinParam skinParam, Display label, Swimlane swimlane, BoxStyle boxStyle) { + Style style = null; + Style styleArrow = null; + if (SkinParam.USE_STYLES()) { + style = getDefaultStyleDefinitionActivity().getMergedStyle(skinParam.getCurrentStyleBuilder()); + styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam.getCurrentStyleBuilder()); + } + return new FtileBox(skinParam, label, swimlane, boxStyle, style, styleArrow); + } + + public static FtileBox createWbs(StyleBuilder styleBuilder, ISkinParam skinParam, Display label, + StyleSignature styleDefinition) { + Style style = null; + Style styleArrow = null; + if (SkinParam.USE_STYLES()) { + style = styleDefinition.getMergedStyle(styleBuilder); + styleArrow = style; } + return new FtileBox(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow); + } + public static FtileBox createWbs(Style style, ISkinParam skinParam, Display label) { + Style styleArrow = null; + if (SkinParam.USE_STYLES()) { + styleArrow = style; + } + return new FtileBox(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow); } - public FtileBox(ISkinParam skinParam, Display label, UFont font, Swimlane swimlane, BoxStyle style) { + public static FtileBox createMindMap(StyleBuilder styleBuilder, ISkinParam skinParam, Display label, + StyleSignature styleDefinition) { + Style style = null; + Style styleArrow = null; + if (SkinParam.USE_STYLES()) { + style = styleDefinition.getMergedStyle(styleBuilder); + styleArrow = style; + } + return new FtileBox(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow); + } + + private FtileBox(ISkinParam skinParam, Display label, Swimlane swimlane, BoxStyle boxStyle, Style style, + Style styleArrow) { super(skinParam); this.style = style; - // this.skinParam = skinParam; + this.boxStyle = boxStyle; this.swimlane = swimlane; - this.inRenreding = new LinkRendering(HtmlColorAndStyle.build(skinParam)); - final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.ACTIVITY, null); - final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), - skinParam, CreoleMode.FULL).createSheet(label); - this.tb = new SheetBlock2(new SheetBlock1(sheet, skinParam.wrapWidth(), skinParam.getPadding()), new MyStencil(), new UStroke(1)); + final FontConfiguration fc; + final LineBreakStrategy wrapWidth; + if (SkinParam.USE_STYLES()) { + this.inRendering = new LinkRendering(Rainbow.build(styleArrow, getIHtmlColorSet())); + Colors specBack = null; + if (skinParam instanceof SkinParamColors) { + specBack = ((SkinParamColors) skinParam).getColors(); + } + style = style.eventuallyOverride(specBack); + this.borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet()); + this.backColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet()); + fc = style.getFontConfiguration(getIHtmlColorSet()); + horizontalAlignment = style.getHorizontalAlignment(); + this.padding1 = style.getPadding().getLeft(); + this.padding2 = style.getPadding().getRight(); + this.paddingTop = style.getPadding().getTop(); + this.paddingBottom = style.getPadding().getBottom(); + this.roundCorner = style.value(PName.RoundCorner).asDouble(); + this.shadowing = style.value(PName.Shadowing).asDouble(); + wrapWidth = style.wrapWidth(); + this.minimumWidth = style.value(PName.MinimumWidth).asDouble(); + } else { + this.inRendering = new LinkRendering(Rainbow.build(skinParam)); + this.borderColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBorder); + this.backColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBackground); + fc = new FontConfiguration(skinParam, FontParam.ACTIVITY, null); + horizontalAlignment = HorizontalAlignment.LEFT; + this.shadowing = skinParam().shadowing(null) ? 3.0 : 0.0; + wrapWidth = skinParam.wrapWidth(); + + } + final Sheet sheet = Parser + .build(fc, skinParam.getDefaultTextAlignment(horizontalAlignment), skinParam, CreoleMode.FULL) + .createSheet(label); + this.tb = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()), new MyStencil(), + new UStroke(1)); this.print = label.toString(); + } final private String print; @@ -134,22 +231,46 @@ public void drawU(UGraphic ug) { final Dimension2D dimTotal = calculateDimension(ug.getStringBounder()); final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final UDrawable rect = style.getUDrawable(widthTotal, heightTotal, skinParam().shadowing(null)); + final UDrawable rect = boxStyle.getUDrawable(widthTotal, heightTotal, shadowing, roundCorner); + + final UStroke thickness; + if (SkinParam.USE_STYLES()) { + thickness = style.getStroke(); + } else { + thickness = getThickness(); + } - final HtmlColor borderColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBorder); - final HtmlColor backColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBackground); + if (borderColor == null) { + ug = ug.apply(new HColorNone()); + } else { + ug = ug.apply(borderColor); + } + if (backColor == null) { + ug = ug.apply(new HColorNone().bg()); + } else { + ug = ug.apply(backColor.bg()); + } - ug = ug.apply(new UChangeColor(borderColor)).apply(new UChangeBackColor(backColor)).apply(getThickness()); + ug = ug.apply(thickness); rect.drawU(ug); - tb.drawU(ug.apply(new UTranslate(MARGIN, MARGIN))); + if (horizontalAlignment == HorizontalAlignment.LEFT) { + tb.drawU(ug.apply(new UTranslate(padding1, paddingTop))); + } else if (horizontalAlignment == HorizontalAlignment.RIGHT) { + final Dimension2D dimTb = tb.calculateDimension(ug.getStringBounder()); + tb.drawU(ug.apply(new UTranslate(dimTotal.getWidth() - dimTb.getWidth() - padding2, paddingBottom))); + } else if (horizontalAlignment == HorizontalAlignment.CENTER) { + final Dimension2D dimTb = tb.calculateDimension(ug.getStringBounder()); + tb.drawU(ug.apply(new UTranslate((dimTotal.getWidth() - dimTb.getWidth()) / 2, paddingBottom))); + } } @Override protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) { - final Dimension2D dim = tb.calculateDimension(stringBounder); - return new FtileGeometry(Dimension2DDouble.delta(dim, 2 * MARGIN, 2 * MARGIN), dim.getWidth() / 2 + MARGIN, 0, - dim.getHeight() + 2 * MARGIN); + Dimension2D dim = tb.calculateDimension(stringBounder); + dim = Dimension2DDouble.delta(dim, padding1 + padding2, paddingBottom + paddingTop); + dim = Dimension2DDouble.atLeast(dim, minimumWidth, 0); + return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight()); } public Collection getMyChildren() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java index 89380ca29..02348a868 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,37 +35,46 @@ import java.util.Set; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class FtileCircleEnd extends AbstractFtile { private static final int SIZE = 20; - private final HtmlColor backColor; + private final HColor backColor; private final Swimlane swimlane; + private double shadowing; @Override public Collection getMyChildren() { return Collections.emptyList(); } - public FtileCircleEnd(ISkinParam skinParam, HtmlColor backColor, Swimlane swimlane) { + public FtileCircleEnd(ISkinParam skinParam, HColor backColor, Swimlane swimlane, Style style) { super(skinParam); this.backColor = backColor; this.swimlane = swimlane; + if (SkinParam.USE_STYLES()) { + this.shadowing = style.value(PName.Shadowing).asDouble(); + } else { + if (skinParam().shadowing(null)) { + this.shadowing = 3; + } + } } public Set getSwimlanes() { @@ -90,12 +99,10 @@ public void drawU(UGraphic ug) { yTheoricalPosition = Math.round(yTheoricalPosition); final UEllipse circle = new UEllipse(SIZE, SIZE); - if (skinParam().shadowing(null)) { - circle.setDeltaShadow(3); - } - ug = ug.apply(new UChangeColor(backColor)); + circle.setDeltaShadow(shadowing); + ug = ug.apply(backColor); final double thickness = 2.5; - ug.apply(new UChangeBackColor(HtmlColorUtils.WHITE)).apply(new UStroke(1.5)) + ug.apply(HColorUtils.WHITE.bg()).apply(new UStroke(1.5)) .apply(new UTranslate(xTheoricalPosition, yTheoricalPosition)).draw(circle); final double size2 = (SIZE - thickness) / Math.sqrt(2); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleSpot.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleSpot.java index 1d3eac2c6..8b9ede946 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleSpot.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleSpot.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,15 +43,13 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; 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; public class FtileCircleSpot extends AbstractFtile { @@ -60,12 +58,13 @@ public class FtileCircleSpot extends AbstractFtile { private final Swimlane swimlane; private final String spot; private final FontConfiguration fc; + private final HColor backColor; - public FtileCircleSpot(ISkinParam skinParam, Swimlane swimlane, String spot, UFont font) { + public FtileCircleSpot(ISkinParam skinParam, Swimlane swimlane, String spot, UFont font, HColor backColor) { super(skinParam); this.spot = spot; this.swimlane = swimlane; - // this.font = font; + this.backColor = backColor; this.fc = new FontConfiguration(skinParam, FontParam.ACTIVITY, null); } @@ -91,17 +90,18 @@ public Swimlane getSwimlaneOut() { public void drawU(UGraphic ug) { - final HtmlColor borderColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBorder); - final HtmlColor backColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBackground); + final HColor borderColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBorder); + final HColor backColor = this.backColor == null ? SkinParamUtils.getColor(skinParam(), null, + ColorParam.activityBackground) : this.backColor; final UEllipse circle = new UEllipse(SIZE, SIZE); if (skinParam().shadowing(null)) { circle.setDeltaShadow(3); } - ug.apply(new UChangeColor(borderColor)).apply(new UChangeBackColor(backColor)).apply(getThickness()) + ug.apply(borderColor).apply(backColor.bg()).apply(getThickness()) .draw(circle); - ug.apply(new UChangeColor(fc.getColor())).apply(new UTranslate(SIZE / 2, SIZE / 2)) + ug.apply(fc.getColor()).apply(new UTranslate(SIZE / 2, SIZE / 2)) .draw(new UCenteredCharacter(spot.charAt(0), fc.getFont())); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java index 43481aab8..ac6662393 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,28 +35,39 @@ import java.util.Set; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; public class FtileCircleStart extends AbstractFtile { private static final int SIZE = 20; - private final HtmlColor backColor; + private final HColor backColor; private final Swimlane swimlane; + private double shadowing; - public FtileCircleStart(ISkinParam skinParam, HtmlColor backColor, Swimlane swimlane) { + public FtileCircleStart(ISkinParam skinParam, HColor backColor, Swimlane swimlane, Style style) { super(skinParam); this.backColor = backColor; this.swimlane = swimlane; + if (SkinParam.USE_STYLES()) { + this.shadowing = style.value(PName.Shadowing).asDouble(); + } else { + if (skinParam().shadowing(null)) { + this.shadowing = 3; + } + } + } @Override @@ -81,10 +92,8 @@ public Swimlane getSwimlaneOut() { public void drawU(UGraphic ug) { final UEllipse circle = new UEllipse(SIZE, SIZE); - if (skinParam().shadowing(null)) { - circle.setDeltaShadow(3); - } - ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(backColor)).draw(circle); + circle.setDeltaShadow(shadowing); + ug.apply(new HColorNone()).apply(backColor.bg()).draw(circle); } @Override diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java index 3ca2a660b..ec5bc8262 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,36 +35,45 @@ import java.util.Set; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorMiddle; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UEllipse; 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.HColorMiddle; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class FtileCircleStop extends AbstractFtile { private static final int SIZE = 22; - private final HtmlColor backColor; + private final HColor backColor; private final Swimlane swimlane; + private double shadowing; @Override public Collection getMyChildren() { return Collections.emptyList(); } - public FtileCircleStop(ISkinParam skinParam, HtmlColor backColor, Swimlane swimlane) { + public FtileCircleStop(ISkinParam skinParam, HColor backColor, Swimlane swimlane, Style style) { super(skinParam); this.backColor = backColor; this.swimlane = swimlane; + if (SkinParam.USE_STYLES()) { + this.shadowing = style.value(PName.Shadowing).asDouble(); + } else { + if (skinParam().shadowing(null)) { + this.shadowing = 3; + } + } } public Set getSwimlanes() { @@ -84,18 +93,16 @@ public Swimlane getSwimlaneOut() { public void drawU(UGraphic ug) { final UEllipse circle = new UEllipse(SIZE, SIZE); - if (skinParam().shadowing(null)) { - circle.setDeltaShadow(3); - } - ug.apply(new UChangeColor(backColor)).apply(new UChangeBackColor(HtmlColorUtils.WHITE)).draw(circle); + circle.setDeltaShadow(shadowing); + ug.apply(backColor).apply(HColorUtils.WHITE.bg()).draw(circle); final double delta = 5; final UEllipse circleSmall = new UEllipse(SIZE - delta * 2, SIZE - delta * 2); // if (skinParam().shadowing(null)) { // circleSmall.setDeltaShadow(3); // } - ug.apply(new UChangeColor(new HtmlColorMiddle(backColor, HtmlColorUtils.WHITE))) - .apply(new UChangeBackColor(backColor)).apply(new UTranslate(delta, delta)).draw(circleSmall); + ug.apply(new HColorMiddle(backColor, HColorUtils.WHITE)) + .apply(backColor.bg()).apply(new UTranslate(delta, delta)).draw(circleSmall); } @Override diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java index b51fb1cdc..e51ac6fd3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorateIn.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorateIn.java index d56659bc6..1f42d5cb0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorateIn.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorateIn.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorateOut.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorateOut.java index b367b5cf5..8ace1a8d9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorateOut.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorateOut.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecoratePointOut.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecoratePointOut.java index d5b66c545..c4ba74ba3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecoratePointOut.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecoratePointOut.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamond.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamond.java index db1a414c1..e278117d1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamond.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamond.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,35 +37,43 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; +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.HColor; public class FtileDiamond extends AbstractFtile { - private final HtmlColor backColor; - private final HtmlColor borderColor; + private final HColor backColor; + private final HColor borderColor; private final Swimlane swimlane; private final TextBlock north; private final TextBlock south; private final TextBlock west1; private final TextBlock east1; + private final double shadowing; - public FtileDiamond(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane) { + public FtileDiamond(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane) { this(skinParam, backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0)); } - + + public StyleSignature getDefaultStyleDefinitionDiamond() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.diamond); + } + @Override public Collection getMyChildren() { return Collections.emptyList(); @@ -93,9 +101,16 @@ public FtileDiamond withSouth(TextBlock south) { return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east1, west1); } - private FtileDiamond(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + private FtileDiamond(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock north, TextBlock south, TextBlock east1, TextBlock west1) { super(skinParam); + if (SkinParam.USE_STYLES()) { + Style style = getDefaultStyleDefinitionDiamond().getMergedStyle(skinParam.getCurrentStyleBuilder()); + shadowing = style.value(PName.Shadowing).asDouble(); + } else { + shadowing = skinParam().shadowing(null) ? 3 : 0; + } + this.backColor = backColor; this.swimlane = swimlane; this.borderColor = borderColor; @@ -123,9 +138,9 @@ public Swimlane getSwimlaneOut() { public void drawU(UGraphic ug) { final double suppY1 = north.calculateDimension(ug.getStringBounder()).getHeight(); - ug = ug.apply(new UTranslate(0, suppY1)); - ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor)) - .draw(Diamond.asPolygon(skinParam().shadowing(null))); + ug = ug.apply(UTranslate.dy(suppY1)); + ug.apply(borderColor).apply(getThickness()).apply(backColor.bg()) + .draw(Diamond.asPolygon(shadowing)); // final Dimension2D dimNorth = north.calculateDimension(ug.getStringBounder()); north.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 1.5, -suppY1))); @@ -139,7 +154,7 @@ public void drawU(UGraphic ug) { final Dimension2D dimEast1 = east1.calculateDimension(ug.getStringBounder()); east1.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 2, -dimEast1.getHeight() - + Diamond.diamondHalfSize))); + + Diamond.diamondHalfSize))); } @Override @@ -157,11 +172,10 @@ public double getEastLabelWidth(StringBounder stringBounder) { final Dimension2D dimEast = east1.calculateDimension(stringBounder); return dimEast.getWidth(); } - + public double getSouthLabelHeight(StringBounder stringBounder) { final Dimension2D dimSouth = south.calculateDimension(stringBounder); return dimSouth.getHeight(); } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondFoo1.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondFoo1.java index 20a132920..d26ffc9b1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondFoo1.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondFoo1.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,26 +40,24 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FtileDiamondFoo1 extends AbstractFtile { - private final HtmlColor backColor; - private final HtmlColor borderColor; + private final HColor backColor; + private final HColor borderColor; private final Swimlane swimlane; private final TextBlock label; private final TextBlock west; private final TextBlock east; private final TextBlock north; - public FtileDiamondFoo1(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + public FtileDiamondFoo1(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock label) { this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0)); @@ -77,7 +75,7 @@ public FtileDiamondFoo1 withEast(TextBlock east) { return new FtileDiamondFoo1(skinParam(), backColor, borderColor, swimlane, label, north, west, east); } - private FtileDiamondFoo1(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + private FtileDiamondFoo1(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock label, TextBlock north, TextBlock west, TextBlock east) { super(skinParam); this.backColor = backColor; @@ -108,7 +106,7 @@ public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimTotal = calculateDimensionInternal(stringBounder); - ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor)); + ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg()); ug.draw(Diamond.asPolygonFoo1(skinParam().shadowing(null), dimTotal.getWidth(), dimTotal.getHeight())); north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside.java index 7480dbead..aecd02a4d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,37 +37,46 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; +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.style.Styleable; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; -public class FtileDiamondInside extends AbstractFtile { +public class FtileDiamondInside extends AbstractFtile implements Styleable { - private final HtmlColor backColor; - private final HtmlColor borderColor; + private final HColor backColor; + private final HColor borderColor; private final Swimlane swimlane; private final TextBlock label; private final TextBlock west; private final TextBlock east; private final TextBlock north; private final TextBlock south; + private final double shadowing; @Override public Collection getMyChildren() { return Collections.emptyList(); } - public FtileDiamondInside(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond); + } + + public FtileDiamondInside(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock label) { this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0)); @@ -93,12 +102,20 @@ public FtileDiamondInside withSouth(TextBlock south) { return new FtileDiamondInside(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } - private FtileDiamondInside(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + private FtileDiamondInside(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) { super(skinParam); - this.backColor = backColor; + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); + this.borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet()); + this.backColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet()); + this.shadowing = style.value(PName.Shadowing).asDouble(); + } else { + this.backColor = backColor; + this.borderColor = borderColor; + this.shadowing = skinParam().shadowing(null) ? 3 : 0; + } this.swimlane = swimlane; - this.borderColor = borderColor; this.label = label; this.west = west; this.east = east; @@ -125,8 +142,8 @@ public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimTotal = calculateDimensionAlone(stringBounder); - ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor)); - ug.draw(Diamond.asPolygon(skinParam().shadowing(null), dimTotal.getWidth(), dimTotal.getHeight())); + ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg()); + ug.draw(Diamond.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight())); north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside2.java index bfb150d62..3bdd579db 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,31 +36,35 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; +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.HColor; public class FtileDiamondInside2 extends AbstractFtile { - private final HtmlColor backColor; - private final HtmlColor borderColor; + private final HColor backColor; + private final HColor borderColor; private final Swimlane swimlane; private final TextBlock label; private final TextBlock west; private final TextBlock east; private final TextBlock north; private final TextBlock south; + private final double shadowing; - public FtileDiamondInside2(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + public FtileDiamondInside2(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock label) { this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0)); @@ -81,10 +85,20 @@ public FtileDiamondInside2 withEast(TextBlock east) { public FtileDiamondInside2 withSouth(TextBlock south) { return new FtileDiamondInside2(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } + + public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond); + } - private FtileDiamondInside2(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + private FtileDiamondInside2(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) { super(skinParam); + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); + this.shadowing = style.value(PName.Shadowing).asDouble(); + } else { + this.shadowing = skinParam().shadowing(null) ? 3 : 0; + } this.backColor = backColor; this.swimlane = swimlane; this.borderColor = borderColor; @@ -114,8 +128,8 @@ public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimTotal = calculateDimensionAlone(stringBounder); - ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor)); - ug.draw(Diamond.asPolygon(skinParam().shadowing(null), dimTotal.getWidth(), dimTotal.getHeight())); + ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg()); + ug.draw(Diamond.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight())); north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside3.java index 125e702f6..4a32e52fa 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,20 +41,18 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileOverpassing; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.MathUtils; public class FtileDiamondInside3 extends AbstractFtile implements FtileOverpassing { - private final HtmlColor backColor; - private final HtmlColor borderColor; + private final HColor backColor; + private final HColor borderColor; private final Swimlane swimlane; private final TextBlock label; private final TextBlock west; @@ -62,7 +60,7 @@ public class FtileDiamondInside3 extends AbstractFtile implements FtileOverpassi private final TextBlock north; private final TextBlock south; - public FtileDiamondInside3(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + public FtileDiamondInside3(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock label) { this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0)); @@ -84,7 +82,7 @@ public FtileDiamondInside3 withSouth(TextBlock south) { return new FtileDiamondInside3(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } - private FtileDiamondInside3(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + private FtileDiamondInside3(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) { super(skinParam); this.backColor = backColor; @@ -116,18 +114,19 @@ public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimTotal = calculateDimensionAlone(stringBounder); - ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor)); - ug.draw(Diamond.asPolygon(skinParam().shadowing(null), dimTotal.getWidth(), dimTotal.getHeight())); + ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg()); + final double shadowing = skinParam().shadowing(null) ? 3 : 0; + ug.draw(Diamond.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight())); - north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); - south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); + north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); + south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); final double lx = (dimTotal.getWidth() - dimLabel.getWidth()) / 2; final double ly = (dimTotal.getHeight() - dimLabel.getHeight()) / 2; label.drawU(ug.apply(new UTranslate(lx, ly))); final Dimension2D dimWeat = west.calculateDimension(stringBounder); - west.drawU(ug.apply(new UTranslate(-dimWeat.getWidth(), -dimWeat.getHeight() + dimTotal.getHeight() / 2))); + west.drawU(ug.apply(new UTranslate(-dimWeat.getWidth(), -dimWeat.getHeight() + dimTotal.getHeight() / 2))); final Dimension2D dimEast = east.calculateDimension(stringBounder); east.drawU(ug.apply(new UTranslate(dimTotal.getWidth(), -dimEast.getHeight() + dimTotal.getHeight() / 2))); @@ -163,7 +162,7 @@ public FtileGeometry getOverpassDimension(StringBounder stringBounder) { final Dimension2D north = this.north.calculateDimension(stringBounder); final Dimension2D east = this.east.calculateDimension(stringBounder); final Dimension2D west = this.west.calculateDimension(stringBounder); - final double height = total.getHeight(); // + north.getHeight(); + final double height = total.getHeight(); // + north.getHeight(); final double left = total.getWidth() / 2; final double supp = MathUtils.max(north.getWidth(), east.getWidth(), west.getWidth()); // final double width = supp > left ? left + supp : diamond.getWidth(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileThinSplit.java b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileThinSplit.java index 02cf8c2a4..cba6a71bd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileThinSplit.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileThinSplit.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,14 +37,14 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UShape; 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.HColorNone; public class FtileThinSplit extends AbstractFtile { @@ -52,10 +52,10 @@ public class FtileThinSplit extends AbstractFtile { private double first; private double last; private final double height = 1.5; - private final HtmlColor colorBar; + private final HColor colorBar; private final Swimlane swimlane; - public FtileThinSplit(ISkinParam skinParam, HtmlColor colorBar, Swimlane swimlane) { + public FtileThinSplit(ISkinParam skinParam, HColor colorBar, Swimlane swimlane) { super(skinParam); this.colorBar = colorBar; this.swimlane = swimlane; @@ -73,9 +73,14 @@ protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) { } public void drawU(UGraphic ug) { - final UShape rect = new ULine(last - first, 0); - ug = ug.apply(new UTranslate(first, 0)); - ug.apply(new UChangeColor(colorBar)).apply(new UStroke(1.5)).draw(rect); + final UShape rect = ULine.hline(last - first); + ug = ug.apply(UTranslate.dx(first)); + if (colorBar == null) { + ug = ug.apply(new HColorNone()); + } else { + ug = ug.apply(colorBar); + } + ug.apply(new UStroke(1.5)).draw(rect); } public Set getSwimlanes() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/anim/AffineTransformation.java b/src/plantuml-asl/src/net/sourceforge/plantuml/anim/AffineTransformation.java index bb97151a6..635025920 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/anim/AffineTransformation.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/anim/AffineTransformation.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/anim/Animation.java b/src/plantuml-asl/src/net/sourceforge/plantuml/anim/Animation.java index eb787c59b..28abaefc3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/anim/Animation.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/anim/Animation.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/anim/AnimationDecoder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/anim/AnimationDecoder.java index d47403dbb..607942188 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/anim/AnimationDecoder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/anim/AnimationDecoder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/anim/AnimationScript.java b/src/plantuml-asl/src/net/sourceforge/plantuml/anim/AnimationScript.java index 0cc7dcd01..ff9b82eaa 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/anim/AnimationScript.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/anim/AnimationScript.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ant/CheckZipTask.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ant/CheckZipTask.java index 5e9d56bbb..1cb6df114 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ant/CheckZipTask.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ant/CheckZipTask.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,9 +30,9 @@ */ package net.sourceforge.plantuml.ant; -import java.io.File; -import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; +import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; @@ -44,6 +44,9 @@ import org.apache.tools.ant.types.FileList; import org.apache.tools.ant.types.FileSet; +import net.sourceforge.plantuml.security.SFile; +import net.sourceforge.plantuml.security.SecurityUtils; + public class CheckZipTask extends Task { private String zipfile = null; @@ -71,7 +74,7 @@ public void execute() throws BuildException { myLog("Check " + zipfile); try { - loadZipFile(new File(zipfile)); + loadZipFile(new SFile(zipfile)); for (FileList fileList : filelists) { manageFileList(fileList); } @@ -101,11 +104,15 @@ private boolean isPresentInFile(String s) { private final List entries = new ArrayList(); - private void loadZipFile(File file) throws IOException { + private void loadZipFile(SFile file) throws IOException { this.entries.clear(); - final PrintWriter pw = new PrintWriter("tmp.txt"); - final ZipInputStream zis = new ZipInputStream(new FileInputStream(file)); + final PrintWriter pw = SecurityUtils.createPrintWriter("tmp.txt"); + final InputStream tmp = file.openFile(); + if (tmp == null) { + throw new FileNotFoundException(); + } + final ZipInputStream zis = new ZipInputStream(tmp); ZipEntry ze = zis.getNextEntry(); while (ze != null) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ant/PlantUmlTask.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ant/PlantUmlTask.java index 1ccc4e776..6aa646066 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ant/PlantUmlTask.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ant/PlantUmlTask.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,6 +41,12 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.DirectoryScanner; +import org.apache.tools.ant.Task; +import org.apache.tools.ant.types.FileList; +import org.apache.tools.ant.types.FileSet; + import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.GeneratedImage; @@ -52,12 +58,6 @@ import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.stats.StatsUtils; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.types.FileList; -import org.apache.tools.ant.types.FileSet; - // // // @@ -206,8 +206,8 @@ public Boolean call() throws Exception { return false; } - private boolean doFile(final File f, final SourceFileReader sourceFileReader) throws IOException, - InterruptedException { + private boolean doFile(final File f, final SourceFileReader sourceFileReader) + throws IOException, InterruptedException { final Collection result = sourceFileReader.getGeneratedImages(); boolean error = false; for (GeneratedImage g : result) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/ApiWarning.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/ApiWarning.java index 0c1133d54..89bc97b77 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/ApiWarning.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/ApiWarning.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/CountRate.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/CountRate.java index 640fce929..3055f6210 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/CountRate.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/CountRate.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/INumberAnalyzed.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/INumberAnalyzed.java index 2a6bc9cf7..aac3e04e1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/INumberAnalyzed.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/INumberAnalyzed.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/ImageDataAbstract.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/ImageDataAbstract.java index 8279c3c48..159d150c4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/ImageDataAbstract.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/ImageDataAbstract.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/ImageDataComplex.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/ImageDataComplex.java index 81aed9949..bf73ea870 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/ImageDataComplex.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/ImageDataComplex.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/ImageDataSimple.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/ImageDataSimple.java index 844906af1..f8828ccbb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/ImageDataSimple.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/ImageDataSimple.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/MagicArray.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/MagicArray.java index d84306e84..97bb64e0c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/MagicArray.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/MagicArray.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/MyRunnable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/MyRunnable.java index 53e5d5958..c6c9df5d4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/MyRunnable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/MyRunnable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/NiceNumber.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/NiceNumber.java index 53eac1d15..b1fe570ba 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/NiceNumber.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/NiceNumber.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/NumberAnalyzed.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/NumberAnalyzed.java index ffc435b84..b36403857 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/NumberAnalyzed.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/NumberAnalyzed.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/NumberAnalyzed2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/NumberAnalyzed2.java index a8d289896..4fd7c47c1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/NumberAnalyzed2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/NumberAnalyzed2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/NumberAnalyzedDated.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/NumberAnalyzedDated.java index 80c4893b4..0e2646ffb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/NumberAnalyzedDated.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/NumberAnalyzedDated.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/PSystemFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/PSystemFactory.java index d31f38a97..b7c279157 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/PSystemFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/PSystemFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/PlantumlUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/PlantumlUtils.java index 6c5ca4a35..6ee59bb96 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/PlantumlUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/PlantumlUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/TimeoutExecutor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/TimeoutExecutor.java index df33bbe67..fff328a05 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/TimeoutExecutor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/TimeoutExecutor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option2/MDADiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option2/MDADiagram.java index fd8ec5f9f..bf9ff4c7d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option2/MDADiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option2/MDADiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option2/MDAEntity.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option2/MDAEntity.java index d8c0b5210..ee5c64e55 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option2/MDAEntity.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option2/MDAEntity.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option2/MDAPackage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option2/MDAPackage.java index 360342655..080b60199 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option2/MDAPackage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option2/MDAPackage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option2/MDAUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option2/MDAUtils.java index 4bf560baf..ec43997cf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option2/MDAUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option2/MDAUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option3/MDAVisitor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option3/MDAVisitor.java index 45c362e9b..cc63675ad 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option3/MDAVisitor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/api/mda/option3/MDAVisitor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/AbstractComponentText.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/AbstractComponentText.java index e70c4cbc5..5bd635ad4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/AbstractComponentText.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/AbstractComponentText.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,7 +36,7 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.style.StyleDefinition; +import net.sourceforge.plantuml.style.StyleSignature; public abstract class AbstractComponentText implements Component { @@ -50,7 +50,7 @@ public Style[] getUsedStyles() { throw new UnsupportedOperationException(); } - public StyleDefinition getDefaultStyleDefinition() { + public StyleSignature getDefaultStyleDefinition() { throw new UnsupportedOperationException(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/AsciiShape.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/AsciiShape.java index 8c2511f43..1d53e09d9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/AsciiShape.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/AsciiShape.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/BasicCharArea.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/BasicCharArea.java index dd8a080de..82b36b252 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/BasicCharArea.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/BasicCharArea.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/BasicCharAreaImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/BasicCharAreaImpl.java index 4ed511716..6a10964be 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/BasicCharAreaImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/BasicCharAreaImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextActiveLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextActiveLine.java index f743891d2..af4783c3d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextActiveLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextActiveLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextActor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextActor.java index 7cb9bd64e..fc86d4ec4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextActor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextActor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextArrow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextArrow.java index 74d7502c4..783677d1d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextArrow.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextArrow.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,7 +32,6 @@ import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; -import java.awt.geom.Point2D.Double; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.StringUtils; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextDelay.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextDelay.java index a22962759..8d057e0c9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextDelay.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextDelay.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextDestroy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextDestroy.java index 113bd71f3..8c74069da 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextDestroy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextDestroy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextDivider.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextDivider.java index 6fa8c33e3..290291122 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextDivider.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextDivider.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingBody.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingBody.java index 64ad54877..1f9ad8f8b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingBody.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingBody.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingElse.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingElse.java index c7073a68c..7e4e43c0c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingElse.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingElse.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingHeader.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingHeader.java index 4b8086bf6..a537bfe30 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingHeader.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingHeader.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingTail.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingTail.java index 012c93d4e..5796593ec 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingTail.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextGroupingTail.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextLine.java index a40388dc0..1e756b12f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextNewpage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextNewpage.java index 076ce0254..af07865b0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextNewpage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextNewpage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextNote.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextNote.java index b007d38b6..a9ff926d0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextNote.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextNote.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextParticipant.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextParticipant.java index f1b7e0825..9cfe3d335 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextParticipant.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextParticipant.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextSelfArrow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextSelfArrow.java index 45f27fefe..0f6c4c188 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextSelfArrow.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextSelfArrow.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextShape.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextShape.java index ab5c44ee7..3dbca3ca8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextShape.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/ComponentTextShape.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/TextSkin.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/TextSkin.java index 47116686b..a747f0c8a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/TextSkin.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/TextSkin.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/TextStringBounder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/TextStringBounder.java index da512b293..484379abc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/TextStringBounder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/TextStringBounder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/TranslatedCharArea.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/TranslatedCharArea.java index d5c8c8928..65fc7f193 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/TranslatedCharArea.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/TranslatedCharArea.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/UmlCharArea.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/UmlCharArea.java index d395cc7e7..7c83db88e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/UmlCharArea.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/UmlCharArea.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/UmlCharAreaImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/UmlCharAreaImpl.java index a3a00012b..0a34407ea 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/UmlCharAreaImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/UmlCharAreaImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/Wcwidth.java b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/Wcwidth.java index 2cfa002b5..2229587e8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/Wcwidth.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/asciiart/Wcwidth.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/AbstractConnectorPuzzle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/AbstractConnectorPuzzle.java index c7c46ecfc..913d65031 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/AbstractConnectorPuzzle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/AbstractConnectorPuzzle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmBranch.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmBranch.java index 9d735b5a0..418e6ba24 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmBranch.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmBranch.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmDiagram.java index 30ed2ce6c..450d99120 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -45,6 +45,7 @@ import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.UDrawable; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.ugraphic.ImageBuilder; public class BpmDiagram extends UmlDiagram { @@ -78,10 +79,17 @@ public UmlDiagramType getUmlDiagramType() { protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { final double dpiFactor = 1; - final double margin = 10; - final ImageBuilder imageBuilder = new ImageBuilder(getSkinParam(), dpiFactor, - fileFormatOption.isWithMetadata() ? getMetadata() : null, getWarningOrError(), margin, margin, - getAnimation()); + final int margin1; + final int margin2; + if (SkinParam.USE_STYLES()) { + margin1 = SkinParam.zeroMargin(10); + margin2 = SkinParam.zeroMargin(10); + } else { + margin1 = 10; + margin2 = 10; + } + final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), getAnimation(), fileFormatOption.isWithMetadata() ? getMetadata() : null, + getWarningOrError(), dpiFactor); imageBuilder.setUDrawable(getUDrawable()); return imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed(), os); @@ -92,7 +100,7 @@ private UDrawable getUDrawable() { cleanGrid(grid); final GridArray gridArray = grid.toArray(SkinParam.create(getUmlDiagramType())); // gridArray.addEdges(edges); - System.err.println("gridArray=" + gridArray); + // System.err.println("gridArray=" + gridArray); return gridArray; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmDiagramFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmDiagramFactory.java index a009e8d06..7dd387a45 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmDiagramFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmDiagramFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmElement.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmElement.java index a1f83204b..38e0c6297 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmElement.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmElement.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,17 +43,16 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.MinMax; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class BpmElement extends AbstractConnectorPuzzle implements ConnectorPuzzle { @@ -93,7 +92,7 @@ public TextBlock toTextBlock(ISkinParam skinParam) { public void drawU(UGraphic ug) { raw.drawU(ug); - ug = ug.apply(new UChangeColor(HtmlColorUtils.RED)); + ug = ug.apply(HColorUtils.RED); for (Where w : Where.values()) { if (have(w)) { drawLine(ug, w, raw.calculateDimension(ug.getStringBounder())); @@ -119,34 +118,34 @@ private void drawLine(UGraphic ug, Where w, Dimension2D total) { final double width = total.getWidth(); final double height = total.getHeight(); if (w == Where.WEST) { - ug.apply(new UTranslate(-10, height / 2)).draw(new ULine(10, 0)); + ug.apply(new UTranslate(-10, height / 2)).draw(ULine.hline(10)); } if (w == Where.EAST) { - ug.apply(new UTranslate(width, height / 2)).draw(new ULine(10, 0)); + ug.apply(new UTranslate(width, height / 2)).draw(ULine.hline(10)); } if (w == Where.NORTH) { - ug.apply(new UTranslate(width / 2, -10)).draw(new ULine(0, 10)); + ug.apply(new UTranslate(width / 2, -10)).draw(ULine.vline(10)); } if (w == Where.SOUTH) { - ug.apply(new UTranslate(width / 2, height)).draw(new ULine(0, 10)); + ug.apply(new UTranslate(width / 2, height)).draw(ULine.vline(10)); } } public TextBlock toTextBlockInternal(ISkinParam skinParam) { if (type == BpmElementType.START) { - return new FtileCircleStart(skinParam, HtmlColorUtils.BLACK, null); + return new FtileCircleStart(skinParam, HColorUtils.BLACK, null, null); } if (type == BpmElementType.MERGE) { - final HtmlColor borderColor = SkinParamUtils.getColor(skinParam, null, ColorParam.activityBorder); - final HtmlColor backColor = SkinParamUtils.getColor(skinParam, null, ColorParam.activityBackground); + final HColor borderColor = SkinParamUtils.getColor(skinParam, null, ColorParam.activityBorder); + final HColor backColor = SkinParamUtils.getColor(skinParam, null, ColorParam.activityBackground); return new FtileDiamond(skinParam, backColor, borderColor, null); } if (type == BpmElementType.DOCKED_EVENT) { final UFont font = UFont.serif(14); - return new FtileBox(skinParam, display, font, null, BoxStyle.PLAIN); + return FtileBox.create(skinParam, display, null, BoxStyle.PLAIN); } final UFont font = UFont.serif(14); - final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.RED, HtmlColorUtils.RED, false); + final FontConfiguration fc = new FontConfiguration(font, HColorUtils.RED, HColorUtils.RED, false); if (Display.isNull(display)) { return Display.getWithNewlines(type.toString()).create(fc, HorizontalAlignment.LEFT, skinParam); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmElementType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmElementType.java index ffc6de476..11e0d1974 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmElementType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmElementType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmEvent.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmEvent.java index b4314a508..92d8ee98f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmEvent.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmEvent.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmEventAdd.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmEventAdd.java index ef5ac8a0b..bbb6ffccd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmEventAdd.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmEventAdd.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmEventGoto.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmEventGoto.java index d30b0710d..7d823d490 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmEventGoto.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmEventGoto.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmEventResume.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmEventResume.java index 87845dc22..046e0b86f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmEventResume.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/BpmEventResume.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Cell.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Cell.java index 6db6b7239..6cf4dc6fd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Cell.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Cell.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Chain.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Chain.java index 99efdf212..198cad0c3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Chain.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Chain.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/ChainImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/ChainImpl.java index 52a139455..bf41a369e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/ChainImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/ChainImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CleanerEmptyLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CleanerEmptyLine.java index 891c75eaa..291fafe9a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CleanerEmptyLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CleanerEmptyLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CleanerInterleavingLines.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CleanerInterleavingLines.java index 5c0634aac..206c5f264 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CleanerInterleavingLines.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CleanerInterleavingLines.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CleanerMoveBlock.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CleanerMoveBlock.java index 5f812f5b2..a756d8217 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CleanerMoveBlock.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CleanerMoveBlock.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,7 +34,7 @@ public class CleanerMoveBlock implements GridCleaner { public boolean clean(Grid grid) { - System.err.println("CleanerMoveBlock"); + // System.err.println("CleanerMoveBlock"); for (Line line : grid.lines().toList()) { tryGrid(grid, line); } @@ -84,6 +84,6 @@ private void tryGrid(Grid grid, Line line) { } private void tryBridge(Line line, Col col1, final Col col2) { - System.err.println("LINE=" + line + " " + col1 + " " + col2 + " "); + // System.err.println("LINE=" + line + " " + col1 + " " + col2 + " "); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Col.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Col.java index 1e02b8ed1..885a7dd80 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Col.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Col.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandDockedEvent.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandDockedEvent.java index 954c84bb2..35007cdf2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandDockedEvent.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandDockedEvent.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandElseBranch.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandElseBranch.java index 49e40c2c0..4f2cd7f28 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandElseBranch.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandElseBranch.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandEndBranch.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandEndBranch.java index 6c2776053..b12d05aa8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandEndBranch.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandEndBranch.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandGoto.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandGoto.java index 942c3db0d..836da517b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandGoto.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandGoto.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandMerge.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandMerge.java index 3e8ba49dc..9ff1f9415 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandMerge.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandMerge.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandNewBranch.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandNewBranch.java index c9f20011b..bfa0986ea 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandNewBranch.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandNewBranch.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandResume.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandResume.java index cb1f2f053..4c708e5ed 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandResume.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/CommandResume.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/ConnectorPuzzle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/ConnectorPuzzle.java index 037b762e5..ae3f7d8e9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/ConnectorPuzzle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/ConnectorPuzzle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/ConnectorPuzzleEmpty.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/ConnectorPuzzleEmpty.java index affb277a9..f59ca8fc0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/ConnectorPuzzleEmpty.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/ConnectorPuzzleEmpty.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,15 +35,14 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.MinMax; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class ConnectorPuzzleEmpty extends AbstractConnectorPuzzle implements Placeable, TextBlock, ConnectorPuzzle { @@ -84,7 +83,7 @@ public String getId() { public void drawU(UGraphic ug) { // System.err.println("DRAWING " + toString()); - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLUE)); + ug = ug.apply(HColorUtils.BLUE); for (Where w : Where.values()) { if (have(w)) { drawLine(ug, w); @@ -95,16 +94,16 @@ public void drawU(UGraphic ug) { private void drawLine(UGraphic ug, Where w) { if (w == Where.WEST) { - ug.apply(new UTranslate(0, 10)).draw(new ULine(10, 0)); + ug.apply(UTranslate.dy(10)).draw(ULine.hline(10)); } if (w == Where.EAST) { - ug.apply(new UTranslate(10, 10)).draw(new ULine(10, 0)); + ug.apply(new UTranslate(10, 10)).draw(ULine.hline(10)); } if (w == Where.NORTH) { - ug.apply(new UTranslate(10, 0)).draw(new ULine(0, 10)); + ug.apply(UTranslate.dx(10)).draw(ULine.vline(10)); } if (w == Where.SOUTH) { - ug.apply(new UTranslate(10, 10)).draw(new ULine(0, 10)); + ug.apply(new UTranslate(10, 10)).draw(ULine.vline(10)); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Coord.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Coord.java index 0d1e0df80..f3d6c7562 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Coord.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Coord.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/FootPrint.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/FootPrint.java index dae29d51a..3eb1009d9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/FootPrint.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/FootPrint.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Grid.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Grid.java index 52ad80784..440277b77 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Grid.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Grid.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/GridArray.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/GridArray.java index ba496549f..07f025750 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/GridArray.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/GridArray.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,13 +34,12 @@ import java.awt.geom.Point2D; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class GridArray implements UDrawable { @@ -132,7 +131,7 @@ public void drawU(UGraphic ug) { cell.toTextBlock(skinParam).drawU( ug.apply(new UTranslate(dx + (widthOfCol + margin - dim.getWidth()) / 2, dy - + (heightOfLine + margin - dim.getHeight()) / 2))); + + (heightOfLine + margin - dim.getHeight()) / 2))); } dx += widthOfCol + margin; } @@ -150,22 +149,22 @@ private void drawInternalGrid(UGraphic ug) { for (int c = 0; c < cols; c++) { widthMax += getWidthOfCol(ug.getStringBounder(), c) + margin; } - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); + ug = ug.apply(HColorUtils.BLACK); double y = 0; for (int l = 0; l < lines; l++) { - ug.apply(new UTranslate(0, y)).draw(new ULine(widthMax, 0)); + ug.apply(UTranslate.dy(y)).draw(ULine.hline(widthMax)); y += getHeightOfLine(ug.getStringBounder(), l) + margin; } double x = 0; for (int c = 0; c < cols; c++) { - ug.apply(new UTranslate(x, 0)).draw(new ULine(0, heightMax)); + ug.apply(UTranslate.dx(x)).draw(ULine.vline(heightMax)); x += getWidthOfCol(ug.getStringBounder(), c) + margin; } } private void drawArrow(UGraphic ug, Point2D pt1, Point2D pt2) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLUE)); + ug = ug.apply(HColorUtils.BLUE); final ULine line = new ULine(pt2.getX() - pt1.getX(), pt2.getY() - pt1.getY()); ug.apply(new UTranslate(pt1)).draw(line); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/GridCleaner.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/GridCleaner.java index 7763b3c5a..dda83665f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/GridCleaner.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/GridCleaner.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Line.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Line.java index 61a1301b8..9d9ead977 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Line.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Line.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Navigator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Navigator.java index 42f4919db..eaa0d00da 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Navigator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Navigator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Navigators.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Navigators.java index 209425302..cc7318738 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Navigators.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Navigators.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Placeable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Placeable.java index ad41c5663..5be1e5c0f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Placeable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/bpm/Placeable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleChar.java b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleChar.java index 01dc4c159..cec088e41 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleChar.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleChar.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleCharFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleCharFactory.java index 4d2a449eb..3e075bb08 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleCharFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleCharFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleDrawer.java b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleDrawer.java index 6681c6dd5..e33672f19 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleDrawer.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleDrawer.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,15 +30,13 @@ */ package net.sourceforge.plantuml.braille; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class BrailleDrawer implements UDrawable { @@ -51,16 +49,16 @@ public BrailleDrawer(BrailleGrid grid) { } public void drawU(UGraphic ug) { - ug = ug.apply(new UChangeColor(new HtmlColorSetSimple().getColorIfValid("#F0F0F0"))); + ug = ug.apply(HColorSet.instance().getColorIfValid("#F0F0F0")); for (int x = grid.getMinX(); x <= grid.getMaxX(); x++) { - ug.apply(new UTranslate(x * step + spotSize + 1, 0)).draw( - new ULine(0, (grid.getMaxY() - grid.getMinY()) * step)); + ug.apply(UTranslate.dx(x * step + spotSize + 1)).draw( + ULine.vline((grid.getMaxY() - grid.getMinY()) * step)); } for (int y = grid.getMinY(); y <= grid.getMaxY(); y++) { - ug.apply(new UTranslate(0, y * step + spotSize + 1)).draw( - new ULine((grid.getMaxX() - grid.getMinX()) * step, 0)); + ug.apply(UTranslate.dy(y * step + spotSize + 1)).draw( + ULine.hline((grid.getMaxX() - grid.getMinX()) * step)); } - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(HtmlColorUtils.BLACK)); + ug = ug.apply(HColorUtils.BLACK).apply(HColorUtils.BLACK.bg()); for (int x = grid.getMinX(); x <= grid.getMaxX(); x++) { for (int y = grid.getMinY(); y <= grid.getMaxY(); y++) { if (grid.getState(x, y)) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleGrid.java b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleGrid.java index 152a2f736..80fcfc0e8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleGrid.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleGrid.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleUtils.java index 07b93fdd1..bedf10f65 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/BrailleUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/Coords.java b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/Coords.java index 245989307..f1c24eca6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/Coords.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/Coords.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverCenteredCharacterBraille.java b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverCenteredCharacterBraille.java index eb4c5fe24..0561bf068 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverCenteredCharacterBraille.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverCenteredCharacterBraille.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,11 +30,11 @@ */ package net.sourceforge.plantuml.braille; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverCenteredCharacterBraille implements UDriver { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverDotPathBraille.java b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverDotPathBraille.java index 38bff5df8..594671fd9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverDotPathBraille.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverDotPathBraille.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,10 +31,10 @@ package net.sourceforge.plantuml.braille; import net.sourceforge.plantuml.posimo.DotPath; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverDotPathBraille implements UDriver { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverLineBraille.java b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverLineBraille.java index 814a39980..f5ed399da 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverLineBraille.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverLineBraille.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,12 +33,12 @@ import java.awt.geom.Line2D; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverLineBraille implements UDriver { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverNoneBraille.java b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverNoneBraille.java index cdc16490b..688a00bc7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverNoneBraille.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverNoneBraille.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,10 +30,10 @@ */ package net.sourceforge.plantuml.braille; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverNoneBraille implements UDriver { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverPolygonBraille.java b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverPolygonBraille.java index 8955e9e46..19a729516 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverPolygonBraille.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverPolygonBraille.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,13 +35,13 @@ import java.util.List; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverPolygonBraille implements UDriver { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverRectangleBraille.java b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverRectangleBraille.java index f5216bf68..f07a06549 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverRectangleBraille.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverRectangleBraille.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,12 +33,12 @@ import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverRectangleBraille implements UDriver { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverTextBraille.java b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverTextBraille.java index 9af54a8d9..e31611568 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverTextBraille.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/DriverTextBraille.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,11 +30,11 @@ */ package net.sourceforge.plantuml.braille; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UDriver; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public class DriverTextBraille implements UDriver { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/UGraphicBraille.java b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/UGraphicBraille.java index 4ded1cc0e..b6146df03 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/braille/UGraphicBraille.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/braille/UGraphicBraille.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,15 +36,11 @@ import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.TikzFontDistortion; -import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.ugraphic.AbstractCommonUGraphic; import net.sourceforge.plantuml.ugraphic.AbstractUGraphic; import net.sourceforge.plantuml.ugraphic.ClipContainer; -import net.sourceforge.plantuml.ugraphic.ColorMapper; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UEllipse; @@ -55,6 +51,9 @@ import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; // https://www.branah.com/braille-translator public class UGraphicBraille extends AbstractUGraphic implements ClipContainer, UGraphic2 { @@ -117,15 +116,9 @@ public StringBounder getStringBounder() { return FileFormat.BRAILLE_PNG.getDefaultStringBounder(TikzFontDistortion.getDefault()); } - public void startUrl(Url url) { - } - - public void closeAction() { - } - public void writeImageTOBEMOVED(OutputStream os, String metadata, int dpi) throws IOException { - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, - metadata, null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), + false, null, metadata, null, 1.0, HColorUtils.WHITE); imageBuilder.setUDrawable(new BrailleDrawer(getGraphicObject())); imageBuilder.writeImageTOBEMOVED(new FileFormatOption(FileFormat.PNG), 42, os); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/BitReader.java b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/BitReader.java index cdbbaed0e..4c2f0b5e7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/BitReader.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/BitReader.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/BrotliInputStream.java b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/BrotliInputStream.java index 52572c617..d84604d9e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/BrotliInputStream.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/BrotliInputStream.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/BrotliRuntimeException.java b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/BrotliRuntimeException.java index 2f5300b98..64a99399f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/BrotliRuntimeException.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/BrotliRuntimeException.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Context.java b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Context.java index c3585a00f..487eb3391 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Context.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Context.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Decode.java b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Decode.java index b01bad51c..36f68d496 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Decode.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Decode.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Dictionary.java b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Dictionary.java index cd45bd73a..828bf13cc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Dictionary.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Dictionary.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/DictionaryData.java b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/DictionaryData.java index c5df9707d..90ab47a80 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/DictionaryData.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/DictionaryData.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Huffman.java b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Huffman.java index e733816da..5d991c441 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Huffman.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Huffman.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/State.java b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/State.java index 51657ae58..f003a5e08 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/State.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/State.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Transform.java b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Transform.java index c1380c46f..3181e1796 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Transform.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Transform.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Utils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Utils.java index acb866df5..285009b56 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Utils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/brotli/Utils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/AbstractEntityDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/AbstractEntityDiagram.java index e1725cfd9..57b2e8d62 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/AbstractEntityDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/AbstractEntityDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java index 2b8f840bf..c7dffa3d7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,6 +35,7 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.creole.CreoleMode; @@ -44,11 +45,13 @@ import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.svek.image.EntityImageClass; import net.sourceforge.plantuml.ugraphic.ImageBuilder; @@ -58,98 +61,94 @@ public ClassDiagram(ISkinSimple skinParam) { super(skinParam); } - private final String getNamespace(Code fullyCode) { - return getNamespace(fullyCode, fullyCode.getSeparator()); - } - - private final String getNamespace(Code fullyCode, String separator) { - String name = fullyCode.getFullName(); - if (separator == null) { - throw new IllegalArgumentException(toString()); - } - do { - final int x = name.lastIndexOf(separator); - if (x == -1) { - return null; - } - name = name.substring(0, x); - } while (entityFactory.getLeafsget(Code.of(name, separator)) != null); - return name; - } - - public final Code getShortName(Code code) { - final String separator = code.getSeparator(); + private Code getShortName1972(Code code) { + final String separator = getNamespaceSeparator(); if (separator == null) { throw new IllegalArgumentException(); } - final String codeString = code.getFullName(); - final String namespace = getNamespace(code); + final String codeString = code.getName(); + final String namespace = getNamespace1972(code, getNamespaceSeparator()); if (namespace == null) { - return Code.of(codeString, separator); + return buildCode(codeString); } - return Code.of(codeString.substring(namespace.length() + separator.length()), separator); + return buildCode(codeString.substring(namespace.length() + separator.length())); } @Override - public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) { - if (getNamespaceSeparator() != null) { - code = code.withSeparator(getNamespaceSeparator()); + public ILeaf getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) { + checkNotNull(ident); + if (this.V1972()) { + if (type == null) { + type = LeafType.CLASS; + } + return getOrCreateLeafDefault(ident, code, type, symbol); } if (type == null) { code = code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"); if (getNamespaceSeparator() == null) { - return getOrCreateLeafDefault(code, LeafType.CLASS, symbol); + return getOrCreateLeafDefault(ident, code, LeafType.CLASS, symbol); } - code = getFullyQualifiedCode(code); + code = getFullyQualifiedCode1972(code); if (super.leafExist(code)) { - return getOrCreateLeafDefault(code, LeafType.CLASS, symbol); + return getOrCreateLeafDefault(ident, code, LeafType.CLASS, symbol); } - return createEntityWithNamespace(code, Display.getWithNewlines(getShortName(code)), LeafType.CLASS, symbol); + return createEntityWithNamespace1972(ident, code, Display.getWithNewlines(ident.getLast()), LeafType.CLASS, + symbol); } if (getNamespaceSeparator() == null) { - return getOrCreateLeafDefault(code, type, symbol); + return getOrCreateLeafDefault(ident, code, type, symbol); } - code = getFullyQualifiedCode(code); + code = getFullyQualifiedCode1972(code); if (super.leafExist(code)) { - return getOrCreateLeafDefault(code, type, symbol); + return getOrCreateLeafDefault(ident, code, type, symbol); } - return createEntityWithNamespace(code, Display.getWithNewlines(getShortName(code)), type, symbol); + return createEntityWithNamespace1972(ident, code, Display.getWithNewlines(ident.getLast()), type, symbol); } @Override - public ILeaf createLeaf(Code code, Display display, LeafType type, USymbol symbol) { - if (getNamespaceSeparator() != null) { - code = code.withSeparator(getNamespaceSeparator()); - } + public ILeaf createLeaf(Ident idNewLong, Code code, Display display, LeafType type, USymbol symbol) { + checkNotNull(idNewLong); if (type != LeafType.ABSTRACT_CLASS && type != LeafType.ANNOTATION && type != LeafType.CLASS && type != LeafType.INTERFACE && type != LeafType.ENUM && type != LeafType.LOLLIPOP_FULL && type != LeafType.LOLLIPOP_HALF && type != LeafType.NOTE) { - return super.createLeaf(code, display, type, symbol); + return super.createLeaf(idNewLong, code, display, type, symbol); + } + if (this.V1972()) { + return super.createLeaf(idNewLong, code, display, type, symbol); } if (getNamespaceSeparator() == null) { - return super.createLeaf(code, display, type, symbol); + return super.createLeaf(idNewLong, code, display, type, symbol); } - code = getFullyQualifiedCode(code); + code = getFullyQualifiedCode1972(code); if (super.leafExist(code)) { throw new IllegalArgumentException("Already known: " + code); } - return createEntityWithNamespace(code, display, type, symbol); + return createEntityWithNamespace1972(idNewLong, code, display, type, symbol); } - private ILeaf createEntityWithNamespace(Code fullyCode, Display display, LeafType type, USymbol symbol) { + private ILeaf createEntityWithNamespace1972(Ident id, Code fullyCode, Display display, LeafType type, + USymbol symbol) { + if (this.V1972()) + throw new UnsupportedOperationException(); + checkNotNull(id); final IGroup backupCurrentGroup = getCurrentGroup(); final IGroup group = backupCurrentGroup; - final String namespace = getNamespace(fullyCode, getNamespaceSeparator()); - if (namespace != null - && (EntityUtils.groupRoot(group) || group.getCode().getFullName().equals(namespace) == false)) { - final Code namespace2 = Code.of(namespace); - gotoGroupInternal(namespace2, Display.getWithNewlines(namespace), namespace2, GroupType.PACKAGE, - getRootGroup()); - } - final ILeaf result = createLeafInternal( - fullyCode, - Display.isNull(display) ? Display.getWithNewlines(getShortName(fullyCode)).withCreoleMode( - CreoleMode.SIMPLE_LINE) : display, type, symbol); + final String namespaceString = getNamespace1972(fullyCode, getNamespaceSeparator()); + if (namespaceString != null + && (EntityUtils.groupRoot(group) || group.getCodeGetName().equals(namespaceString) == false)) { + final Code namespace = buildCode(namespaceString); + final Display tmp = Display.getWithNewlines(namespaceString); + final Ident newIdLong = buildLeafIdentSpecial(namespaceString); + // final Ident newIdLong = buildLeafIdentSpecial2(namespaceString); + gotoGroupExternal(newIdLong, namespace, tmp, namespace, GroupType.PACKAGE, getRootGroup()); + } + final Display tmpDisplay; + if (Display.isNull(display)) { + tmpDisplay = Display.getWithNewlines(getShortName1972(fullyCode)).withCreoleMode(CreoleMode.SIMPLE_LINE); + } else { + tmpDisplay = display; + } + final ILeaf result = createLeafInternal(id, fullyCode, tmpDisplay, type, symbol); gotoThisGroup(backupCurrentGroup); return result; } @@ -159,8 +158,7 @@ public final boolean leafExist(Code code) { if (getNamespaceSeparator() == null) { return super.leafExist(code); } - code = code.withSeparator(getNamespaceSeparator()); - return super.leafExist(getFullyQualifiedCode(code)); + return super.leafExist(getFullyQualifiedCode1972(code)); } @Override @@ -201,14 +199,24 @@ final protected ImageData exportLayoutExplicit(OutputStream os, int index, FileF final RowLayout rawLayout = getRawLayout(i); fullLayout.addRowLayout(rawLayout); } - final ImageBuilder imageBuilder = new ImageBuilder(getSkinParam(), 1, null, null, 0, 10, null); + final int margin1; + final int margin2; + if (SkinParam.USE_STYLES()) { + margin1 = SkinParam.zeroMargin(0); + margin2 = SkinParam.zeroMargin(10); + } else { + margin1 = 0; + margin2 = 10; + } + final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, null, null, 1); imageBuilder.setUDrawable(fullLayout); return imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed(), os); } private RowLayout getRawLayout(int raw) { final RowLayout rawLayout = new RowLayout(); - for (ILeaf leaf : entityFactory.getLeafsvalues()) { + for (ILeaf leaf : entityFactory.leafs()) { if (leaf.getRawLayout() == raw) { rawLayout.addLeaf(getEntityImageClass(leaf)); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java index b1c4dfdce..3095a1c2b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.classdiagram.command.CommandCreateElementFull2.Mode; import net.sourceforge.plantuml.classdiagram.command.CommandDiamondAssociation; import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2; -import net.sourceforge.plantuml.classdiagram.command.CommandImport; import net.sourceforge.plantuml.classdiagram.command.CommandLayoutNewLine; import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass; import net.sourceforge.plantuml.classdiagram.command.CommandLinkLollipop; @@ -55,21 +54,26 @@ import net.sourceforge.plantuml.command.CommandEndPackage; import net.sourceforge.plantuml.command.CommandFootboxIgnored; import net.sourceforge.plantuml.command.CommandNamespace; +import net.sourceforge.plantuml.command.CommandNamespace2; +import net.sourceforge.plantuml.command.CommandNamespaceEmpty; import net.sourceforge.plantuml.command.CommandPackage; import net.sourceforge.plantuml.command.CommandPackageEmpty; import net.sourceforge.plantuml.command.CommandPage; import net.sourceforge.plantuml.command.CommandRankDir; import net.sourceforge.plantuml.command.UmlDiagramFactory; -import net.sourceforge.plantuml.command.note.FactoryNoteCommand; -import net.sourceforge.plantuml.command.note.FactoryNoteOnEntityCommand; -import net.sourceforge.plantuml.command.note.FactoryNoteOnLinkCommand; -import net.sourceforge.plantuml.command.note.FactoryTipOnEntityCommand; +import net.sourceforge.plantuml.command.note.CommandConstraintOnLinks; +import net.sourceforge.plantuml.command.note.CommandFactoryNote; +import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnEntity; +import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnLink; +import net.sourceforge.plantuml.command.note.CommandFactoryTipOnEntity; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.descdiagram.command.CommandCreateElementMultilines; +import net.sourceforge.plantuml.descdiagram.command.CommandCreateElementParenthesis; import net.sourceforge.plantuml.descdiagram.command.CommandNewpage; import net.sourceforge.plantuml.descdiagram.command.CommandPackageWithUSymbol; import net.sourceforge.plantuml.objectdiagram.command.CommandCreateEntityObject; import net.sourceforge.plantuml.objectdiagram.command.CommandCreateEntityObjectMultilines; +import net.sourceforge.plantuml.objectdiagram.command.CommandCreateMap; public class ClassDiagramFactory extends UmlDiagramFactory { @@ -101,10 +105,12 @@ protected List createCommands() { cmds.add(new CommandRemoveRestore()); cmds.add(new CommandCreateClassMultilines()); cmds.add(new CommandCreateEntityObjectMultilines()); + cmds.add(new CommandCreateMap()); cmds.add(new CommandCreateClass()); cmds.add(new CommandCreateEntityObject()); cmds.add(new CommandAllowMixing()); + cmds.add(new CommandCreateElementParenthesis()); cmds.add(new CommandLayoutNewLine()); cmds.add(new CommandPackage()); @@ -114,23 +120,23 @@ protected List createCommands() { cmds.add(new CommandCreateElementFull2(Mode.NORMAL_KEYWORD)); cmds.add(new CommandCreateElementFull2(Mode.WITH_MIX_PREFIX)); - final FactoryNoteCommand factoryNoteCommand = new FactoryNoteCommand(); + final CommandFactoryNote factoryNoteCommand = new CommandFactoryNote(); cmds.add(factoryNoteCommand.createSingleLine()); cmds.add(new CommandNamespace()); + cmds.add(new CommandNamespace2()); + cmds.add(new CommandNamespaceEmpty()); cmds.add(new CommandStereotype()); cmds.add(new CommandLinkClass(UmlDiagramType.CLASS)); cmds.add(new CommandLinkLollipop(UmlDiagramType.CLASS)); - cmds.add(new CommandImport()); - - final FactoryTipOnEntityCommand factoryTipOnEntityCommand = new FactoryTipOnEntityCommand("a", new RegexLeaf( + final CommandFactoryTipOnEntity factoryTipOnEntityCommand = new CommandFactoryTipOnEntity("a", new RegexLeaf( "ENTITY", "(" + CommandCreateClass.CODE_NO_DOTDOT + "|[%g][^%g]+[%g])::([%g][^%g]+[%g]|[^%s]+)")); cmds.add(factoryTipOnEntityCommand.createMultiLine(true)); cmds.add(factoryTipOnEntityCommand.createMultiLine(false)); - final FactoryNoteOnEntityCommand factoryNoteOnEntityCommand = new FactoryNoteOnEntityCommand("class", + final CommandFactoryNoteOnEntity factoryNoteOnEntityCommand = new CommandFactoryNoteOnEntity("class", new RegexLeaf("ENTITY", "(" + CommandCreateClass.CODE + "|[%g][^%g]+[%g])")); cmds.add(factoryNoteOnEntityCommand.createSingleLine()); cmds.add(new CommandUrl()); @@ -139,9 +145,10 @@ protected List createCommands() { cmds.add(factoryNoteOnEntityCommand.createMultiLine(false)); cmds.add(factoryNoteCommand.createMultiLine(false)); - final FactoryNoteOnLinkCommand factoryNoteOnLinkCommand = new FactoryNoteOnLinkCommand(); + final CommandFactoryNoteOnLink factoryNoteOnLinkCommand = new CommandFactoryNoteOnLink(); cmds.add(factoryNoteOnLinkCommand.createSingleLine()); cmds.add(factoryNoteOnLinkCommand.createMultiLine(false)); + cmds.add(new CommandConstraintOnLinks()); cmds.add(new CommandDiamondAssociation()); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/FullLayout.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/FullLayout.java index ad5956270..ffbe2a29f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/FullLayout.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/FullLayout.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -48,7 +48,7 @@ public void addRowLayout(RowLayout rawLayout) { public void drawU(UGraphic ug) { double y = 0; for (RowLayout rawLayout : all) { - rawLayout.drawU(ug.apply(new UTranslate(0, y))); + rawLayout.drawU(ug.apply(UTranslate.dy(y))); y += rawLayout.getHeight(ug.getStringBounder()) + 20; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/RowLayout.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/RowLayout.java index 83688d337..444aa5699 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/RowLayout.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/RowLayout.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -58,7 +58,7 @@ public double getHeight(StringBounder stringBounder) { public void drawU(UGraphic ug) { double x = 0; for (TextBlock leaf : all) { - leaf.drawU(ug.apply(new UTranslate(x, 0))); + leaf.drawU(ug.apply(UTranslate.dx(x))); x += leaf.calculateDimension(ug.getStringBounder()).getWidth() + 20; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java index e4f8bc66c..7e56a1b3e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,6 +40,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.skin.VisibilityModifier; public class CommandAddMethod extends SingleLineCommand2 { @@ -59,14 +60,25 @@ static IRegex getRegexConcat() { } @Override - protected CommandExecutionResult executeArg(ClassDiagram system, LineLocation location, RegexResult arg) { - final IEntity entity = system.getOrCreateLeaf(Code.of(arg.get("NAME", 0)), null, null); + protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { + final String idShort = arg.get("NAME", 0); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); + /* final */IEntity entity; + if (diagram.V1972()) { + entity = diagram.getLeafVerySmart(diagram.cleanIdent(ident)); + if (entity == null) { + entity = diagram.getOrCreateLeaf(ident, code, null, null); + } + } else { + entity = diagram.getOrCreateLeaf(ident, code, null, null); + } final String field = arg.get("DATA", 0); if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field)) { - system.setVisibilityModifierPresent(true); + diagram.setVisibilityModifierPresent(true); } - entity.getBodier().addFieldOrMethod(field, entity); + entity.getBodier().addFieldOrMethod(field); return CommandExecutionResult.ok(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandAllowMixing.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandAllowMixing.java index 4f6e0d3c9..46982390f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandAllowMixing.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandAllowMixing.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java index 2580fc742..f663facf9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -48,13 +48,14 @@ import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotag; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandCreateClass extends SingleLineCommand2 { @@ -71,7 +72,8 @@ public CommandCreateClass() { } private static IRegex getRegexConcat() { - return RegexConcat.build(CommandCreateClass.class.getName(), RegexLeaf.start(), // + return RegexConcat.build(CommandCreateClass.class.getName(), + RegexLeaf.start(), // new RegexLeaf("TYPE", // "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|circle|diamond)"), // RegexLeaf.spaceOneOrMore(), // @@ -90,7 +92,8 @@ private static IRegex getRegexConcat() { new RegexLeaf("DISPLAY2", DISPLAY_WITH_GENERIC)), // new RegexLeaf("CODE3", "(" + CODE + ")"), // new RegexLeaf("CODE4", "[%g]([^%g]+)[%g]")), // - new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(), new RegexLeaf("GENERIC", "\\<(" + GenericRegexProducer.PATTERN + ")\\>"))), // + new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(), new RegexLeaf("GENERIC", "\\<(" + + GenericRegexProducer.PATTERN + ")\\>"))), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // RegexLeaf.spaceZeroOrMore(), // @@ -100,9 +103,14 @@ private static IRegex getRegexConcat() { RegexLeaf.spaceZeroOrMore(), // color().getRegex(), // RegexLeaf.spaceZeroOrMore(), // - new RegexOptional(new RegexConcat(new RegexLeaf("##"), new RegexLeaf("LINECOLOR", "(?:\\[(dotted|dashed|bold)\\])?(\\w+)?"))), // - new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), new RegexLeaf("EXTENDS", "(extends)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), // - new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), new RegexLeaf("IMPLEMENTS", "(implements)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), // + new RegexOptional(new RegexConcat(new RegexLeaf("##"), new RegexLeaf("LINECOLOR", + "(?:\\[(dotted|dashed|bold)\\])?(\\w+)?"))), // + new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), new RegexLeaf("EXTENDS", + "(extends)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), // + new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), new RegexLeaf("IMPLEMENTS", + "(implements)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), // + new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(), new RegexLeaf("\\{"), RegexLeaf + .spaceZeroOrMore(), new RegexLeaf("\\}"))), // RegexLeaf.end()); } @@ -113,20 +121,34 @@ private static ColorParser color() { @Override protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { final LeafType type = LeafType.getLeafType(StringUtils.goUpperCase(arg.get("TYPE", 0))); - final Code code = Code.of(arg.getLazzy("CODE", 0)).eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"); + final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("CODE", 0), + "\"([:"); final String display = arg.getLazzy("DISPLAY", 0); final String genericOption = arg.getLazzy("DISPLAY", 1); final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0); final String stereotype = arg.get("STEREO", 0); final ILeaf entity; - if (diagram.leafExist(code)) { - entity = diagram.getOrCreateLeaf(code, type, null); - if (entity.muteToType(type, null) == false) { - return CommandExecutionResult.error("Bad name"); + final Ident idNewLong = diagram.buildLeafIdent(idShort); + if (diagram.V1972()) { + if (diagram.leafExistSmart(idNewLong)) { + entity = diagram.getOrCreateLeaf(idNewLong, idNewLong, type, null); + if (entity.muteToType(type, null) == false) { + return CommandExecutionResult.error("Bad name"); + } + } else { + entity = diagram.createLeaf(idNewLong, idNewLong, Display.getWithNewlines(display), type, null); } } else { - entity = diagram.createLeaf(code, Display.getWithNewlines(display), type, null); + final Code code = diagram.buildCode(idShort); + if (diagram.leafExist(code)) { + entity = diagram.getOrCreateLeaf(idNewLong, code, type, null); + if (entity.muteToType(type, null) == false) { + return CommandExecutionResult.error("Bad name"); + } + } else { + entity = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display), type, null); + } } if (stereotype != null) { entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram @@ -146,7 +168,7 @@ protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation l Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); - final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); + final HColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); if (lineColor != null) { colors = colors.add(ColorType.LINE, lineColor); } @@ -176,7 +198,7 @@ protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation l // public static void manageExtends(ClassDiagram system, RegexResult arg, final IEntity entity) { // if (arg.get("EXTENDS", 1) != null) { // final Mode mode = arg.get("EXTENDS", 1).equalsIgnoreCase("extends") ? Mode.EXTENDS : Mode.IMPLEMENTS; - // final Code other = Code.of(arg.get("EXTENDS", 2)); + // final Code other = diagram.buildCode(arg.get("EXTENDS", 2)); // LeafType type2 = LeafType.CLASS; // if (mode == Mode.IMPLEMENTS) { // type2 = LeafType.INTERFACE; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java index d8d5c2f3f..594fca439 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -51,17 +51,18 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.cucadiagram.Stereotag; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.skin.VisibilityModifier; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandCreateClassMultilines extends CommandMultilines2 { @@ -102,8 +103,8 @@ private static IRegex getRegexConcat() { new RegexLeaf("DISPLAY2", CommandCreateClass.DISPLAY_WITH_GENERIC)), // new RegexLeaf("CODE3", "(" + CommandCreateClass.CODE + ")"), // new RegexLeaf("CODE4", "[%g]([^%g]+)[%g]")), // - new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(), new RegexLeaf("GENERIC", "\\<(" - + GenericRegexProducer.PATTERN + ")\\>"))), // + new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(), + new RegexLeaf("GENERIC", "\\<(" + GenericRegexProducer.PATTERN + ")\\>"))), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STEREO", "(\\<\\<.+\\>\\>)?"), // RegexLeaf.spaceZeroOrMore(), // @@ -113,17 +114,17 @@ private static IRegex getRegexConcat() { RegexLeaf.spaceZeroOrMore(), // color().getRegex(), // RegexLeaf.spaceZeroOrMore(), // - new RegexOptional(new RegexConcat(new RegexLeaf("##"), new RegexLeaf("LINECOLOR", - "(?:\\[(dotted|dashed|bold)\\])?(\\w+)?"))), // - new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), new RegexLeaf("EXTENDS", - "(extends)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), // - new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), new RegexLeaf("IMPLEMENTS", - "(implements)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), // + new RegexOptional(new RegexConcat(new RegexLeaf("##"), + new RegexLeaf("LINECOLOR", "(?:\\[(dotted|dashed|bold)\\])?(\\w+)?"))), // + new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), + new RegexLeaf("EXTENDS", "(extends)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), // + new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(), + new RegexLeaf("IMPLEMENTS", "(implements)[%s]+(" + CommandCreateClassMultilines.CODES + ")"))), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("\\{"), // RegexLeaf.spaceZeroOrMore(), // RegexLeaf.end() // - ); + ); } @Override @@ -135,18 +136,20 @@ private static ColorParser color() { return ColorParser.simpleColor(ColorType.BACK); } + @Override protected CommandExecutionResult executeNow(ClassDiagram diagram, BlocLines lines) { lines = lines.trimSmart(1); - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final IEntity entity = executeArg0(diagram, line0); if (entity == null) { return CommandExecutionResult.error("No such entity"); } if (lines.size() > 1) { lines = lines.subExtract(1, 1); - final Url url = null; + // final Url url = null; // if (lines.size() > 0) { - // final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + // final UrlBuilder urlBuilder = new + // UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); // url = urlBuilder.getUrl(lines.getFirst499().toString()); // } else { // url = null; @@ -158,15 +161,11 @@ protected CommandExecutionResult executeNow(ClassDiagram diagram, BlocLines line if (s.getString().length() > 0 && VisibilityModifier.isVisibilityCharacter(s.getString())) { diagram.setVisibilityModifierPresent(true); } - if (s instanceof StringLocated) { - entity.getBodier().addFieldOrMethod(((StringLocated) s).getString(), entity); - } else { - entity.getBodier().addFieldOrMethod(s.toString(), entity); - } - } - if (url != null) { - entity.addUrl(url); + entity.getBodier().addFieldOrMethod(s.getString()); } +// if (url != null) { +// entity.addUrl(url); +// } } manageExtends("EXTENDS", diagram, line0, entity); @@ -199,15 +198,17 @@ public static void manageExtends(String keyword, ClassDiagram diagram, RegexResu } final String codes = arg.get(keyword, 1); for (String s : codes.split(",")) { - final Code other = Code.of(StringUtils.trin(s)); - final IEntity cl2 = diagram.getOrCreateLeaf(other, type2, null); + final String idShort = StringUtils.trin(s); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code other = diagram.V1972() ? ident : diagram.buildCode(idShort); + final IEntity cl2 = diagram.getOrCreateLeaf(ident, other, type2, null); LinkType typeLink = new LinkType(LinkDecor.NONE, LinkDecor.EXTENDS); if (type2 == LeafType.INTERFACE && entity.getLeafType() != LeafType.INTERFACE) { typeLink = typeLink.goDashed(); } final Link link = new Link(cl2, entity, typeLink, Display.NULL, 2, null, null, - diagram.getLabeldistance(), diagram.getLabelangle(), diagram.getSkinParam() - .getCurrentStyleBuilder()); + diagram.getLabeldistance(), diagram.getLabelangle(), + diagram.getSkinParam().getCurrentStyleBuilder()); diagram.addLink(link); } } @@ -222,27 +223,43 @@ private IEntity executeArg0(ClassDiagram diagram, RegexResult arg) { visibilityModifier = VisibilityModifier.getVisibilityModifier(visibilityString + "FOO", false); } - final Code code = Code.of(arg.getLazzy("CODE", 0)).eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"); + final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("CODE", 0), + "\"([:"); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); final String display = arg.getLazzy("DISPLAY", 0); final String genericOption = arg.getLazzy("DISPLAY", 1); final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0); final String stereotype = arg.get("STEREO", 0); - final ILeaf result; - if (diagram.leafExist(code)) { - result = diagram.getOrCreateLeaf(code, null, null); - if (result.muteToType(type, null) == false) { - return null; + /* final */ILeaf result; + if (diagram.V1972()) { + result = diagram.getLeafSmart(ident); + if (result != null) { + // result = diagram.getOrCreateLeaf(ident, code, null, null); + diagram.setLastEntity(result); + if (result.muteToType(type, null) == false) { + return null; + } + } else { + result = diagram.createLeaf(ident, code, Display.getWithNewlines(display), type, null); } } else { - result = diagram.createLeaf(code, Display.getWithNewlines(display), type, null); + if (diagram.leafExist(code)) { + result = diagram.getOrCreateLeaf(ident, code, null, null); + if (result.muteToType(type, null) == false) { + return null; + } + } else { + result = diagram.createLeaf(ident, code, Display.getWithNewlines(display), type, null); + } } result.setVisibilityModifier(visibilityModifier); if (stereotype != null) { - result.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram - .getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam() - .getIHtmlColorSet())); + result.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), + diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), + diagram.getSkinParam().getIHtmlColorSet())); } final String urlString = arg.get("URL", 0); @@ -254,7 +271,7 @@ private IEntity executeArg0(ClassDiagram diagram, RegexResult arg) { Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); - final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); + final HColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); if (lineColor != null) { colors = colors.add(ColorType.LINE, lineColor); } @@ -264,9 +281,11 @@ private IEntity executeArg0(ClassDiagram diagram, RegexResult arg) { result.setColors(colors); // result.setSpecificColorTOBEREMOVED(ColorType.BACK, - // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); + // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", + // 0))); // result.setSpecificColorTOBEREMOVED(ColorType.LINE, - // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1))); + // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", + // 1))); // result.applyStroke(arg.get("LINECOLOR", 0)); if (generic != null) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateElementFull2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateElementFull2.java index 102999228..e1423661b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateElementFull2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateElementFull2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -27,6 +27,7 @@ * * * Original Author: Arnaud Roques + * Contribution : Hisashi Miyashita */ package net.sourceforge.plantuml.classdiagram.command; @@ -47,6 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotag; import net.sourceforge.plantuml.cucadiagram.Stereotype; @@ -171,7 +173,10 @@ protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation l if (symbol == null) { type = LeafType.DESCRIPTION; - usymbol = USymbol.ACTOR; + usymbol = diagram.getSkinParam().actorStyle().toUSymbol(); + } else if (symbol.equalsIgnoreCase("port")) { + type = LeafType.PORT; + usymbol = null; } else if (symbol.equalsIgnoreCase("usecase")) { type = LeafType.USECASE; usymbol = null; @@ -180,20 +185,22 @@ protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation l usymbol = null; } else { type = LeafType.DESCRIPTION; - usymbol = USymbol.getFromString(symbol, diagram.getSkinParam().useUml2ForComponent()); + usymbol = USymbol.fromString(symbol, diagram.getSkinParam()); if (usymbol == null) { throw new IllegalStateException(); } } - final Code code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw)); + final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); String display = displayRaw; if (display == null) { - display = code.getFullName(); + display = code.getName(); } display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display); final String stereotype = arg.getLazzy("STEREOTYPE", 0); - final IEntity entity = diagram.getOrCreateLeaf(code, type, usymbol); + final IEntity entity = diagram.getOrCreateLeaf(ident, code, type, usymbol); entity.setDisplay(Display.getWithNewlines(display)); entity.setUSymbol(usymbol); if (stereotype != null) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandDiamondAssociation.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandDiamondAssociation.java index 3607d58d8..675062a3f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandDiamondAssociation.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandDiamondAssociation.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,6 +40,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; public class CommandDiamondAssociation extends SingleLineCommand2 { @@ -58,11 +59,14 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { - final Code code = Code.of(arg.get("CODE", 0)); - if (diagram.leafExist(code)) { - return CommandExecutionResult.error("Already existing : " + code.getFullName()); + final String idShort = arg.get("CODE", 0); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); + final boolean leafExist = diagram.V1972() ? diagram.leafExistSmart(ident) : diagram.leafExist(code); + if (leafExist) { + return CommandExecutionResult.error("Already existing : " + code.getName()); } - diagram.createLeaf(code, Display.NULL, LeafType.ASSOCIATION, null); + diagram.createLeaf(ident, code, Display.NULL, LeafType.ASSOCIATION, null); return CommandExecutionResult.ok(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow2.java index e763bf3bf..5258d2f8b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByGender.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByGender.java index 010704424..45947469c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByGender.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByGender.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,9 +30,6 @@ */ package net.sourceforge.plantuml.classdiagram.command; -import java.util.EnumSet; -import java.util.Set; - import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.UmlDiagram; @@ -49,6 +46,7 @@ import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.EntityUtils; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.descdiagram.DescriptionDiagram; import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram; @@ -56,11 +54,6 @@ public class CommandHideShowByGender extends SingleLineCommand2 { - private static final EnumSet PORTION_METHOD = EnumSet. of(EntityPortion.METHOD); - private static final EnumSet PORTION_MEMBER = EnumSet. of(EntityPortion.FIELD, - EntityPortion.METHOD); - private static final EnumSet PORTION_FIELD = EnumSet. of(EntityPortion.FIELD); - public CommandHideShowByGender() { super(getRegexConcat()); } @@ -80,14 +73,14 @@ static IRegex getRegexConcat() { RegexLeaf.end()); } - private final EntityGender emptyByGender(Set portion) { - if (portion == PORTION_METHOD) { + private final EntityGender emptyByGender(EntityPortion portion) { + if (portion == EntityPortion.METHOD) { return EntityGenderUtils.emptyMethods(); } - if (portion == PORTION_FIELD) { + if (portion == EntityPortion.FIELD) { return EntityGenderUtils.emptyFields(); } - if (portion == PORTION_MEMBER) { + if (portion == EntityPortion.MEMBER) { throw new IllegalArgumentException(); // return EntityGenderUtils.emptyMembers(); } @@ -110,13 +103,13 @@ protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation loc } private CommandExecutionResult executeSequenceDiagram(SequenceDiagram diagram, RegexResult arg) { - final Set portion = getEntityPortion(arg.get("PORTION", 0)); - diagram.hideOrShow(portion, arg.get("COMMAND", 0).equalsIgnoreCase("show")); + final EntityPortion portion = getEntityPortion(arg.get("PORTION", 0)); + diagram.hideOrShow(portion.asSet(), arg.get("COMMAND", 0).equalsIgnoreCase("show")); return CommandExecutionResult.ok(); } private CommandExecutionResult executeDescriptionDiagram(DescriptionDiagram diagram, RegexResult arg) { - final Set portion = getEntityPortion(arg.get("PORTION", 0)); + final EntityPortion portion = getEntityPortion(arg.get("PORTION", 0)); final EntityGender gender; final String arg1 = arg.get("GENDER", 0); if (arg1 == null) { @@ -136,7 +129,8 @@ private CommandExecutionResult executeDescriptionDiagram(DescriptionDiagram diag } else if (arg1.startsWith("<<")) { gender = EntityGenderUtils.byStereotype(arg1); } else { - final IEntity entity = diagram.getOrCreateLeaf(Code.of(arg1), null, null); + final IEntity entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(arg1), diagram.buildCode(arg1), null, + null); gender = EntityGenderUtils.byEntityAlone(entity); } @@ -144,12 +138,12 @@ private CommandExecutionResult executeDescriptionDiagram(DescriptionDiagram diag return CommandExecutionResult.ok(); } - private CommandExecutionResult executeClassDiagram(AbstractClassOrObjectDiagram classDiagram, RegexResult arg) { + private CommandExecutionResult executeClassDiagram(AbstractClassOrObjectDiagram diagram, RegexResult arg) { - final Set portion = getEntityPortion(arg.get("PORTION", 0)); + final EntityPortion portion = getEntityPortion(arg.get("PORTION", 0)); EntityGender gender = null; - final String arg1 = arg.get("GENDER", 0); + String arg1 = arg.get("GENDER", 0); if (arg1 == null) { gender = EntityGenderUtils.all(); } else if (arg1.equalsIgnoreCase("class")) { @@ -167,47 +161,50 @@ private CommandExecutionResult executeClassDiagram(AbstractClassOrObjectDiagram } else if (arg1.startsWith("<<")) { gender = EntityGenderUtils.byStereotype(arg1); } else { - final IEntity entity = classDiagram.getOrCreateLeaf(Code.of(arg1), null, null); + arg1 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg1); + final Ident ident = diagram.buildLeafIdent(arg1); + final Code code = diagram.V1972() ? ident : diagram.buildCode(arg1); + final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null); gender = EntityGenderUtils.byEntityAlone(entity); } if (gender != null) { final boolean empty = arg.get("EMPTY", 0) != null; - final boolean emptyMembers = empty && portion == PORTION_MEMBER; + final boolean emptyMembers = empty && portion == EntityPortion.MEMBER; if (empty == true && emptyMembers == false) { gender = EntityGenderUtils.and(gender, emptyByGender(portion)); } - if (EntityUtils.groupRoot(classDiagram.getCurrentGroup()) == false) { - gender = EntityGenderUtils.and(gender, EntityGenderUtils.byPackage(classDiagram.getCurrentGroup())); + if (EntityUtils.groupRoot(diagram.getCurrentGroup()) == false) { + gender = EntityGenderUtils.and(gender, EntityGenderUtils.byPackage(diagram.getCurrentGroup())); } if (emptyMembers) { - classDiagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(PORTION_FIELD)), PORTION_FIELD, arg - .get("COMMAND", 0).equalsIgnoreCase("show")); - classDiagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(PORTION_METHOD)), PORTION_METHOD, - arg.get("COMMAND", 0).equalsIgnoreCase("show")); + diagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.FIELD)), + EntityPortion.FIELD, arg.get("COMMAND", 0).equalsIgnoreCase("show")); + diagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(EntityPortion.METHOD)), + EntityPortion.METHOD, arg.get("COMMAND", 0).equalsIgnoreCase("show")); } else { - classDiagram.hideOrShow(gender, portion, arg.get("COMMAND", 0).equalsIgnoreCase("show")); + diagram.hideOrShow(gender, portion, arg.get("COMMAND", 0).equalsIgnoreCase("show")); } } return CommandExecutionResult.ok(); } - private Set getEntityPortion(String s) { + private EntityPortion getEntityPortion(String s) { final String sub = StringUtils.goLowerCase(s.substring(0, 3)); if (sub.equals("met")) { - return PORTION_METHOD; + return EntityPortion.METHOD; } if (sub.equals("mem")) { - return PORTION_MEMBER; + return EntityPortion.MEMBER; } if (sub.equals("att") || sub.equals("fie")) { - return PORTION_FIELD; + return EntityPortion.FIELD; } if (sub.equals("cir")) { - return EnumSet. of(EntityPortion.CIRCLED_CHARACTER); + return EntityPortion.CIRCLED_CHARACTER; } if (sub.equals("ste")) { - return EnumSet. of(EntityPortion.STEREOTYPE); + return EntityPortion.STEREOTYPE; } throw new IllegalArgumentException(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByVisibility.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByVisibility.java index 3ad8bf02c..4be7dbac8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByVisibility.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByVisibility.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -49,11 +49,6 @@ public class CommandHideShowByVisibility extends SingleLineCommand2 { - private static final EnumSet PORTION_METHOD = EnumSet. of(EntityPortion.METHOD); - private static final EnumSet PORTION_MEMBER = EnumSet. of(EntityPortion.FIELD, - EntityPortion.METHOD); - private static final EnumSet PORTION_FIELD = EnumSet. of(EntityPortion.FIELD); - public CommandHideShowByVisibility() { super(getRegexConcat()); } @@ -79,7 +74,7 @@ protected CommandExecutionResult executeArg(UmlDiagram classDiagram, LineLocatio private CommandExecutionResult executeArgClass(ClassDiagram classDiagram, RegexResult arg) { - final Set portion = getEntityPortion(arg.get("PORTION", 0)); + final EntityPortion portion = getEntityPortion(arg.get("PORTION", 0)); final Set visibilities = EnumSet. noneOf(VisibilityModifier.class); final StringTokenizer st = new StringTokenizer(StringUtils.goLowerCase(arg.get("VISIBILITY", 0)), " ,"); @@ -92,43 +87,43 @@ private CommandExecutionResult executeArgClass(ClassDiagram classDiagram, RegexR return CommandExecutionResult.ok(); } - private void addVisibilities(String token, Set portion, Set result) { - if (token.equals("public") && portion.contains(EntityPortion.FIELD)) { + private void addVisibilities(String token, EntityPortion portion, Set result) { + if (token.equals("public") && (portion == EntityPortion.MEMBER || portion == EntityPortion.FIELD)) { result.add(VisibilityModifier.PUBLIC_FIELD); } - if (token.equals("public") && portion.contains(EntityPortion.METHOD)) { + if (token.equals("public") && (portion == EntityPortion.MEMBER || portion == EntityPortion.METHOD)) { result.add(VisibilityModifier.PUBLIC_METHOD); } - if (token.equals("private") && portion.contains(EntityPortion.FIELD)) { + if (token.equals("private") && (portion == EntityPortion.MEMBER || portion == EntityPortion.FIELD)) { result.add(VisibilityModifier.PRIVATE_FIELD); } - if (token.equals("private") && portion.contains(EntityPortion.METHOD)) { + if (token.equals("private") && (portion == EntityPortion.MEMBER || portion == EntityPortion.METHOD)) { result.add(VisibilityModifier.PRIVATE_METHOD); } - if (token.equals("protected") && portion.contains(EntityPortion.FIELD)) { + if (token.equals("protected") && (portion == EntityPortion.MEMBER || portion == EntityPortion.FIELD)) { result.add(VisibilityModifier.PROTECTED_FIELD); } - if (token.equals("protected") && portion.contains(EntityPortion.METHOD)) { + if (token.equals("protected") && (portion == EntityPortion.MEMBER || portion == EntityPortion.METHOD)) { result.add(VisibilityModifier.PROTECTED_METHOD); } - if (token.equals("package") && portion.contains(EntityPortion.FIELD)) { + if (token.equals("package") && (portion == EntityPortion.MEMBER || portion == EntityPortion.FIELD)) { result.add(VisibilityModifier.PACKAGE_PRIVATE_FIELD); } - if (token.equals("package") && portion.contains(EntityPortion.METHOD)) { + if (token.equals("package") && (portion == EntityPortion.MEMBER || portion == EntityPortion.METHOD)) { result.add(VisibilityModifier.PACKAGE_PRIVATE_METHOD); } } - private Set getEntityPortion(String s) { + private EntityPortion getEntityPortion(String s) { final String sub = StringUtils.goLowerCase(s.substring(0, 3)); if (sub.equals("met")) { - return PORTION_METHOD; + return EntityPortion.METHOD; } if (sub.equals("mem")) { - return PORTION_MEMBER; + return EntityPortion.MEMBER; } if (sub.equals("att") || sub.equals("fie")) { - return PORTION_FIELD; + return EntityPortion.FIELD; } throw new IllegalArgumentException(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowSpecificClass.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowSpecificClass.java index d986f8237..bc857d8a9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowSpecificClass.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowSpecificClass.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -61,7 +61,7 @@ protected CommandExecutionResult executeArg(CucaDiagram diagram, LineLocation lo // } else if (codeString.equals("interface")) { // diagram.hideOrShow(LeafType.INTERFACE, arg.get("COMMAND", 0).equalsIgnoreCase("show")); // } else { - // final Code code = Code.of(codeString); + // final Code code = diagram.buildCode(codeString); // IEntity hidden = diagram.getEntityFactory().getLeafsget(code); // if (hidden == null) { // hidden = diagram.getEntityFactory().getGroupsget(code); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandImport.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandImport.java deleted file mode 100644 index cb86cb130..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandImport.java +++ /dev/null @@ -1,122 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.classdiagram.command; - -import java.io.File; -import java.io.IOException; - -import net.sourceforge.plantuml.FileSystem; -import net.sourceforge.plantuml.LineLocation; -import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.classdiagram.ClassDiagram; -import net.sourceforge.plantuml.command.CommandExecutionResult; -import net.sourceforge.plantuml.command.SingleLineCommand2; -import net.sourceforge.plantuml.command.regex.IRegex; -import net.sourceforge.plantuml.command.regex.RegexConcat; -import net.sourceforge.plantuml.command.regex.RegexLeaf; -import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.cucadiagram.Code; -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.cucadiagram.IEntity; -import net.sourceforge.plantuml.cucadiagram.Link; -import net.sourceforge.plantuml.cucadiagram.LinkDecor; -import net.sourceforge.plantuml.cucadiagram.LinkType; - -public class CommandImport extends SingleLineCommand2 { - - public CommandImport() { - super(getRegexConcat()); - } - - static IRegex getRegexConcat() { - return RegexConcat.build(CommandImport.class.getName(), // - RegexLeaf.start(), // - new RegexLeaf("import"), // - RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("[%g]?"), // - new RegexLeaf("NAME", "([^%g]+)"), // - new RegexLeaf("[%g]?"), RegexLeaf.end()); // - } - - @Override - protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { - final String arg0 = arg.get("NAME", 0); - try { - final File f = FileSystem.getInstance().getFile(arg0); - - if (f.isFile()) { - includeSimpleFile(diagram, f); - } else if (f.isDirectory()) { - includeDirectory(diagram, f); - } - } catch (IOException e) { - e.printStackTrace(); - return CommandExecutionResult.error("IO error " + e); - } - return CommandExecutionResult.ok(); - } - - private void includeDirectory(ClassDiagram classDiagram, File dir) throws IOException { - for (File f : dir.listFiles()) { - includeSimpleFile(classDiagram, f); - } - - } - - private void includeSimpleFile(ClassDiagram classDiagram, File f) throws IOException { - if (StringUtils.goLowerCase(f.getName()).endsWith(".java")) { - includeFileJava(classDiagram, f); - } - // if (f.getName().goLowerCase().endsWith(".sql")) { - // includeFileSql(f); - // } - } - - private void includeFileJava(ClassDiagram diagram, final File f) throws IOException { - final JavaFile javaFile = new JavaFile(f); - for (JavaClass cl : javaFile.getJavaClasses()) { - final Code name = Code.of(cl.getName()); - final IEntity ent1 = diagram.getOrCreateLeaf(name, cl.getType(), null); - - for (String p : cl.getParents()) { - final IEntity ent2 = diagram.getOrCreateLeaf(Code.of(p), cl.getParentType(), null); - final Link link = new Link(ent2, ent1, new LinkType(LinkDecor.NONE, LinkDecor.EXTENDS), Display.NULL, - 2, diagram.getSkinParam().getCurrentStyleBuilder()); - diagram.addLink(link); - } - } - } - - // private void includeFileSql(final File f) throws IOException { - // new SqlImporter(getSystem(), f).process(); - // } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandLayoutNewLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandLayoutNewLine.java index d2f4ae668..1f8888bce 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandLayoutNewLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandLayoutNewLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java index c5c090980..abd56282f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -27,6 +27,7 @@ * * * Original Author: Arnaud Roques + * Contribution : Hisashi Miyashita */ package net.sourceforge.plantuml.classdiagram.command; @@ -39,9 +40,6 @@ import net.sourceforge.plantuml.UrlBuilder.ModeUrl; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; -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.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; @@ -50,11 +48,12 @@ import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.Link; -import net.sourceforge.plantuml.cucadiagram.LinkArrow; import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; +import net.sourceforge.plantuml.descdiagram.command.Labels; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram; @@ -75,23 +74,25 @@ static private RegexConcat getRegexConcat(UmlDiagramType umlDiagramType) { new RegexLeaf("HEADER", "@([\\d.]+)"), // RegexLeaf.spaceOneOrMore() // )), new RegexOr( // - new RegexLeaf("ENT1", getClassIdentifier()),// - new RegexLeaf("COUPLE1", COUPLE)), // + new RegexLeaf("ENT1", getClassIdentifier()), // + new RegexLeaf("COUPLE1", COUPLE)), // RegexLeaf.spaceZeroOrMore(), // new RegexOptional(new RegexLeaf("FIRST_LABEL", "[%g]([^%g]+)[%g]")), // RegexLeaf.spaceZeroOrMore(), // new RegexConcat( - // - new RegexLeaf("ARROW_HEAD1", "([%s]+[ox]|[)#\\[<*+^}]|[<\\[]\\||\\}o|\\}\\||\\|o|\\|\\|)?"), // + // + new RegexLeaf("ARROW_HEAD1", + "([%s]+[ox]|[)#\\[<*+^}]|\\<\\|[\\:\\|]|[<\\[]\\||\\}o|\\}\\||\\|o|\\|\\|)?"), // new RegexLeaf("ARROW_BODY1", "([-=.]+)"), // new RegexLeaf("ARROW_STYLE1", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), // new RegexLeaf("ARROW_DIRECTION", "(left|right|up|down|le?|ri?|up?|do?)?"), // new RegexOptional(new RegexLeaf("INSIDE", "(0|\\(0\\)|\\(0|0\\))(?=[-=.~])")), // new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), // new RegexLeaf("ARROW_BODY2", "([-=.]*)"), // - new RegexLeaf("ARROW_HEAD2", "([ox][%s]+|[(#\\]>*+^\\{]|\\|[>\\]]|o\\{|\\|\\{|o\\||\\|\\|)?")), // + new RegexLeaf("ARROW_HEAD2", + "([ox][%s]+|:\\>\\>?|[(#\\]>*+^\\{]|[\\|\\:]\\|\\>|\\|[>\\]]|o\\{|\\|\\{|o\\||\\|\\|)?")), // RegexLeaf.spaceZeroOrMore(), new RegexOptional(new RegexLeaf("SECOND_LABEL", "[%g]([^%g]+)[%g]")), // RegexLeaf.spaceZeroOrMore(), // new RegexOr( // @@ -122,66 +123,63 @@ public static String getSeparator() { return "(?:\\.|::|\\\\|\\\\\\\\)"; } - // private static String optionalKeywords(UmlDiagramType type) { - // if (type == UmlDiagramType.CLASS) { - // return "(interface|enum|annotation|abstract[%s]+class|abstract|class|object|entity)"; - // } - // if (type == UmlDiagramType.OBJECT) { - // return "(object)"; - // } - // throw new IllegalArgumentException(); - // } - // - // private LeafType getTypeIfObject(String type) { - // if ("object".equalsIgnoreCase(type)) { - // return LeafType.OBJECT; - // } - // return null; - // } - @Override protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location, RegexResult arg) { - Code ent1 = Code.of(arg.get("ENT1", 0)); - Code ent2 = Code.of(arg.get("ENT2", 0)); - if (ent1 == null && ent2 == null) { + final String ent1String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\""); + final String ent2String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\""); + if (ent1String == null && ent2String == null) { return executeArgSpecial3(diagram, arg); } - if (ent1 == null) { + if (ent1String == null) { return executeArgSpecial1(diagram, arg); } - if (ent2 == null) { + if (ent2String == null) { return executeArgSpecial2(diagram, arg); } - ent1 = ent1.eventuallyRemoveStartingAndEndingDoubleQuote("\""); - ent2 = ent2.eventuallyRemoveStartingAndEndingDoubleQuote("\""); - if (isGroupButNotTheCurrentGroup(diagram, ent1) && isGroupButNotTheCurrentGroup(diagram, ent2)) { + + Ident ident1 = diagram.buildLeafIdentSpecial(ent1String); + Ident ident2 = diagram.buildLeafIdentSpecial(ent2String); + Ident ident1pure = Ident.empty().add(ent1String, diagram.getNamespaceSeparator()); + Ident ident2pure = Ident.empty().add(ent2String, diagram.getNamespaceSeparator()); + Code code1 = diagram.V1972() ? ident1 : diagram.buildCode(ent1String); + Code code2 = diagram.V1972() ? ident2 : diagram.buildCode(ent2String); + if (isGroupButNotTheCurrentGroup(diagram, code1, ident1) + && isGroupButNotTheCurrentGroup(diagram, code2, ident2)) { return executePackageLink(diagram, arg); } String port1 = null; String port2 = null; - if (removeMemberPart(diagram, ent1) != null) { - port1 = ent1.getPortMember(); - ent1 = removeMemberPart(diagram, ent1); - } - if (removeMemberPart(diagram, ent2) != null) { - port2 = ent2.getPortMember(); - ent2 = removeMemberPart(diagram, ent2); + if (diagram.V1972()) { + if (removeMemberPartIdent(diagram, ident1) != null) { + port1 = ident1.getPortMember(); + ident1 = removeMemberPartIdent(diagram, ident1); + code1 = ident1; + } + if (removeMemberPartIdent(diagram, ident2) != null) { + port2 = ident2.getPortMember(); + ident2 = removeMemberPartIdent(diagram, ident2); + code2 = ident2; + } + } else { + if (removeMemberPartLegacy1972(diagram, ident1) != null) { + port1 = ident1.getPortMember(); + code1 = removeMemberPartLegacy1972(diagram, ident1); + ident1 = ident1.removeMemberPart(); + } + if (removeMemberPartLegacy1972(diagram, ident2) != null) { + port2 = ident2.getPortMember(); + code2 = removeMemberPartLegacy1972(diagram, ident2); + ident2 = ident2.removeMemberPart(); + } } - final IEntity cl1 = isGroupButNotTheCurrentGroup(diagram, ent1) ? diagram.getGroup(Code.of(StringUtils - .eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\""))) : diagram.getOrCreateLeaf( - ent1, null, null); - - final IEntity cl2 = isGroupButNotTheCurrentGroup(diagram, ent2) ? diagram.getGroup(Code.of(StringUtils - .eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\""))) : diagram.getOrCreateLeaf( - ent2, null, null); - - // Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); + final IEntity cl1 = getFoo1(diagram, code1, ident1, ident1pure); + final IEntity cl2 = getFoo1(diagram, code2, ident2, ident2pure); final LinkType linkType = getLinkType(arg); final Direction dir = getDirection(arg); @@ -192,67 +190,11 @@ protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram queue = getQueueLength(arg); } - String firstLabel = arg.get("FIRST_LABEL", 0); - String secondLabel = arg.get("SECOND_LABEL", 0); - - String labelLink = null; - - if (arg.get("LABEL_LINK", 0) != null) { - labelLink = arg.get("LABEL_LINK", 0); - if (firstLabel == null && secondLabel == null) { - final Pattern2 p1 = MyPattern.cmpile("^[%g]([^%g]+)[%g]([^%g]+)[%g]([^%g]+)[%g]$"); - final Matcher2 m1 = p1.matcher(labelLink); - if (m1.matches()) { - firstLabel = m1.group(1); - labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote( - StringUtils.trin(m1.group(2)), "\"")); - secondLabel = m1.group(3); - } else { - final Pattern2 p2 = MyPattern.cmpile("^[%g]([^%g]+)[%g]([^%g]+)$"); - final Matcher2 m2 = p2.matcher(labelLink); - if (m2.matches()) { - firstLabel = m2.group(1); - labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote( - StringUtils.trin(m2.group(2)), "\"")); - secondLabel = null; - } else { - final Pattern2 p3 = MyPattern.cmpile("^([^%g]+)[%g]([^%g]+)[%g]$"); - final Matcher2 m3 = p3.matcher(labelLink); - if (m3.matches()) { - firstLabel = null; - labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote( - StringUtils.trin(m3.group(1)), "\"")); - secondLabel = m3.group(2); - } - } - } - } - labelLink = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(labelLink, "\""); - } - - LinkArrow linkArrow = LinkArrow.NONE; - if ("<".equals(labelLink)) { - linkArrow = LinkArrow.BACKWARD; - labelLink = null; - } else if (">".equals(labelLink)) { - linkArrow = LinkArrow.DIRECT_NORMAL; - labelLink = null; - } else if (labelLink != null && labelLink.startsWith("< ")) { - linkArrow = LinkArrow.BACKWARD; - labelLink = StringUtils.trin(labelLink.substring(2)); - } else if (labelLink != null && labelLink.startsWith("> ")) { - linkArrow = LinkArrow.DIRECT_NORMAL; - labelLink = StringUtils.trin(labelLink.substring(2)); - } else if (labelLink != null && labelLink.endsWith(" >")) { - linkArrow = LinkArrow.DIRECT_NORMAL; - labelLink = StringUtils.trin(labelLink.substring(0, labelLink.length() - 2)); - } else if (labelLink != null && labelLink.endsWith(" <")) { - linkArrow = LinkArrow.BACKWARD; - labelLink = StringUtils.trin(labelLink.substring(0, labelLink.length() - 2)); - } - - Link link = new Link(cl1, cl2, linkType, Display.getWithNewlines(labelLink), queue, firstLabel, secondLabel, - diagram.getLabeldistance(), diagram.getLabelangle(), diagram.getSkinParam().getCurrentStyleBuilder()); + final Labels labels = new Labels(arg); + + Link link = new Link(cl1, cl2, linkType, labels.getDisplay(), queue, labels.getFirstLabel(), + labels.getSecondLabel(), diagram.getLabeldistance(), diagram.getLabelangle(), + diagram.getSkinParam().getCurrentStyleBuilder()); if (arg.get("URL", 0) != null) { final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); final Url url = urlBuilder.getUrl(arg.get("URL", 0)); @@ -263,7 +205,7 @@ protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram if (dir == Direction.LEFT || dir == Direction.UP) { link = link.getInv(); } - link.setLinkArrow(linkArrow); + link.setLinkArrow(labels.getLinkArrow()); link.setColors(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet())); link.applyStyle(arg.getLazzy("ARROW_STYLE", 0)); @@ -272,32 +214,65 @@ protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram return CommandExecutionResult.ok(); } - private boolean isGroupButNotTheCurrentGroup(AbstractClassOrObjectDiagram diagram, Code code) { - if (diagram.getCurrentGroup().getCode().equals(code)) { - return false; + private IEntity getFoo1(AbstractClassOrObjectDiagram diagram, Code code, Ident ident, Ident pure) { + if (isGroupButNotTheCurrentGroup(diagram, code, ident)) { + if (diagram.V1972()) { + return diagram.getGroupVerySmart(ident); + } +// final Code tap = ident.toCode(diagram); + return diagram.getGroup(code); + } + if (diagram.V1972()) { + final IEntity result = pure.size() == 1 ? diagram.getLeafVerySmart(ident) : diagram.getLeafStrict(ident); + if (result != null) { + return result; + } + } + return diagram.getOrCreateLeaf(ident, code, null, null); + } + + private boolean isGroupButNotTheCurrentGroup(AbstractClassOrObjectDiagram diagram, Code code, Ident ident) { + if (diagram.V1972()) { + if (diagram.getCurrentGroup().getCodeGetName().equals(code.getName())) { + return false; + } + return diagram.isGroupVerySmart(ident); + } else { + if (diagram.getCurrentGroup().getCodeGetName().equals(code.getName())) { + return false; + } + return diagram.isGroup(code); } - return diagram.isGroup(code); } - private Code removeMemberPart(AbstractClassOrObjectDiagram diagram, Code code) { - if (diagram.leafExist(code)) { + private Ident removeMemberPartIdent(AbstractClassOrObjectDiagram diagram, Ident ident) { + if (diagram.leafExistSmart(ident)) { return null; } - final Code before = code.removeMemberPart(); + final Ident before = ident.removeMemberPart(); if (before == null) { return null; } - if (diagram.leafExist(before) == false) { + if (diagram.leafExistSmart(before) == false) { return null; } return before; } - // private CommandExecutionResult executeLinkFields(AbstractClassOrObjectDiagram diagram, RegexResult arg) { - // System.err.println("field1=" + arg.get("ENT1", 1)); - // System.err.println("field2=" + arg.get("ENT2", 1)); - // return CommandExecutionResult.error("not working yet"); - // } + private Code removeMemberPartLegacy1972(AbstractClassOrObjectDiagram diagram, Ident ident) { + if (diagram.leafExist(ident)) { + return null; + } + final Ident before = ident.removeMemberPart(); + if (before == null) { + return null; + } + final Code code = before.toCode(diagram); + if (diagram.leafExist(code) == false) { + return null; + } + return code; + } private void addLink(AbstractClassOrObjectDiagram diagram, Link link, String weight) { diagram.addLink(link); @@ -322,10 +297,12 @@ private void addLink(AbstractClassOrObjectDiagram diagram, Link link, String wei } private CommandExecutionResult executePackageLink(AbstractClassOrObjectDiagram diagram, RegexResult arg) { - final IEntity cl1 = diagram.getGroup(Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote( - arg.get("ENT1", 0), "\""))); - final IEntity cl2 = diagram.getGroup(Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote( - arg.get("ENT2", 0), "\""))); + final String ent1String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\""); + final String ent2String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\""); + final IEntity cl1 = diagram.V1972() ? diagram.getGroupVerySmart(diagram.buildLeafIdent(ent1String)) + : diagram.getGroup(diagram.buildCode(ent1String)); + final IEntity cl2 = diagram.V1972() ? diagram.getGroupVerySmart(diagram.buildLeafIdent(ent2String)) + : diagram.getGroup(diagram.buildCode(ent2String)); final LinkType linkType = getLinkType(arg); final Direction dir = getDirection(arg); @@ -352,8 +329,12 @@ private CommandExecutionResult executePackageLink(AbstractClassOrObjectDiagram d } private CommandExecutionResult executeArgSpecial1(AbstractClassOrObjectDiagram diagram, RegexResult arg) { - final Code clName1A = Code.of(arg.get("COUPLE1", 0)); - final Code clName1B = Code.of(arg.get("COUPLE1", 1)); + if (diagram.V1972()) + return executeArgSpecial1972Ident1(diagram, arg); + final String name1A = arg.get("COUPLE1", 0); + final String name1B = arg.get("COUPLE1", 1); + final Code clName1A = diagram.buildCode(name1A); + final Code clName1B = diagram.buildCode(name1B); if (diagram.leafExist(clName1A) == false) { return CommandExecutionResult.error("No class " + clName1A); } @@ -361,13 +342,68 @@ private CommandExecutionResult executeArgSpecial1(AbstractClassOrObjectDiagram d return CommandExecutionResult.error("No class " + clName1B); } - final Code ent2 = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"")); - final IEntity cl2 = diagram.getOrCreateLeaf(ent2, null, null); + final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\""); + final Code ent2 = diagram.buildCode(idShort); + final IEntity cl2 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), ent2, null, null); + + final LinkType linkType = getLinkType(arg); + final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0)); + + final boolean result = diagram.associationClass(1, name1A, name1B, cl2, linkType, label); + if (result == false) { + return CommandExecutionResult.error("Cannot have more than 2 assocications"); + } + + return CommandExecutionResult.ok(); + } + + private CommandExecutionResult executeArgSpecial1972Ident1(AbstractClassOrObjectDiagram diagram, RegexResult arg) { + final String name1A = arg.get("COUPLE1", 0); + final String name1B = arg.get("COUPLE1", 1); + final Ident ident1A = diagram.buildLeafIdent(name1A); + final Ident ident1B = diagram.buildLeafIdent(name1B); + if (diagram.leafExistSmart(ident1A) == false) { + return CommandExecutionResult.error("No class " + ident1A.getName()); + } + if (diagram.leafExistSmart(ident1B) == false) { + return CommandExecutionResult.error("No class " + ident1B.getName()); + } + + final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\""); + final Ident ident2 = diagram.buildLeafIdent(idShort); + final IEntity cl2 = diagram.getOrCreateLeaf(ident2, ident2, null, null); + + final LinkType linkType = getLinkType(arg); + final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0)); + + final boolean result = diagram.associationClass(1, name1A, name1B, cl2, linkType, label); + if (result == false) { + return CommandExecutionResult.error("Cannot have more than 2 assocications"); + } + + return CommandExecutionResult.ok(); + } + + private CommandExecutionResult executeArgSpecial1972Ident2(AbstractClassOrObjectDiagram diagram, RegexResult arg) { + final String name2A = arg.get("COUPLE2", 0); + final String name2B = arg.get("COUPLE2", 1); + final Ident ident2A = diagram.buildLeafIdent(name2A); + final Ident ident2B = diagram.buildLeafIdent(name2B); + if (diagram.leafExistSmart(ident2A) == false) { + return CommandExecutionResult.error("No class " + ident2A.getName()); + } + if (diagram.leafExistSmart(ident2B) == false) { + return CommandExecutionResult.error("No class " + ident2B.getName()); + } + + final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\""); + final Ident ident1 = diagram.buildLeafIdent(idShort); + final IEntity cl1 = diagram.getOrCreateLeaf(ident1, ident1, null, null); final LinkType linkType = getLinkType(arg); final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0)); - final boolean result = diagram.associationClass(1, clName1A, clName1B, cl2, linkType, label); + final boolean result = diagram.associationClass(2, name2A, name2B, cl1, linkType, label); if (result == false) { return CommandExecutionResult.error("Cannot have more than 2 assocications"); } @@ -375,11 +411,45 @@ private CommandExecutionResult executeArgSpecial1(AbstractClassOrObjectDiagram d return CommandExecutionResult.ok(); } + private CommandExecutionResult executeArgSpecial1972Ident3(AbstractClassOrObjectDiagram diagram, RegexResult arg) { + final String name1A = arg.get("COUPLE1", 0); + final String name1B = arg.get("COUPLE1", 1); + final String name2A = arg.get("COUPLE2", 0); + final String name2B = arg.get("COUPLE2", 1); + final Ident ident1A = diagram.buildLeafIdent(name1A); + final Ident ident1B = diagram.buildLeafIdent(name1B); + final Ident ident2A = diagram.buildLeafIdent(name2A); + final Ident ident2B = diagram.buildLeafIdent(name2B); + if (diagram.leafExistSmart(ident1A) == false) { + return CommandExecutionResult.error("No class " + ident1A.getName()); + } + if (diagram.leafExistSmart(ident1B) == false) { + return CommandExecutionResult.error("No class " + ident1B.getName()); + } + if (diagram.leafExistSmart(ident2A) == false) { + return CommandExecutionResult.error("No class " + ident2A.getName()); + } + if (diagram.leafExistSmart(ident2B) == false) { + return CommandExecutionResult.error("No class " + ident2B.getName()); + } + + final LinkType linkType = getLinkType(arg); + final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0)); + + return diagram.associationClass(name1A, name1B, name2A, name2B, linkType, label); + } + private CommandExecutionResult executeArgSpecial3(AbstractClassOrObjectDiagram diagram, RegexResult arg) { - final Code clName1A = Code.of(arg.get("COUPLE1", 0)); - final Code clName1B = Code.of(arg.get("COUPLE1", 1)); - final Code clName2A = Code.of(arg.get("COUPLE2", 0)); - final Code clName2B = Code.of(arg.get("COUPLE2", 1)); + if (diagram.V1972()) + return executeArgSpecial1972Ident3(diagram, arg); + final String name1A = arg.get("COUPLE1", 0); + final String name1B = arg.get("COUPLE1", 1); + final String name2A = arg.get("COUPLE2", 0); + final String name2B = arg.get("COUPLE2", 1); + final Code clName1A = diagram.buildCode(name1A); + final Code clName1B = diagram.buildCode(name1B); + final Code clName2A = diagram.buildCode(name2A); + final Code clName2B = diagram.buildCode(name2B); if (diagram.leafExist(clName1A) == false) { return CommandExecutionResult.error("No class " + clName1A); } @@ -396,12 +466,16 @@ private CommandExecutionResult executeArgSpecial3(AbstractClassOrObjectDiagram d final LinkType linkType = getLinkType(arg); final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0)); - return diagram.associationClass(clName1A, clName1B, clName2A, clName2B, linkType, label); + return diagram.associationClass(name1A, name1B, name2A, name2B, linkType, label); } private CommandExecutionResult executeArgSpecial2(AbstractClassOrObjectDiagram diagram, RegexResult arg) { - final Code clName2A = Code.of(arg.get("COUPLE2", 0)); - final Code clName2B = Code.of(arg.get("COUPLE2", 1)); + if (diagram.V1972()) + return executeArgSpecial1972Ident2(diagram, arg); + final String name2A = arg.get("COUPLE2", 0); + final String name2B = arg.get("COUPLE2", 1); + final Code clName2A = diagram.buildCode(name2A); + final Code clName2B = diagram.buildCode(name2B); if (diagram.leafExist(clName2A) == false) { return CommandExecutionResult.error("No class " + clName2A); } @@ -409,13 +483,14 @@ private CommandExecutionResult executeArgSpecial2(AbstractClassOrObjectDiagram d return CommandExecutionResult.error("No class " + clName2B); } - final Code ent1 = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"")); - final IEntity cl1 = diagram.getOrCreateLeaf(ent1, null, null); + final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\""); + final Code ent1 = diagram.buildCode(idShort); + final IEntity cl1 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), ent1, null, null); final LinkType linkType = getLinkType(arg); final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0)); - final boolean result = diagram.associationClass(2, clName2A, clName2B, cl1, linkType, label); + final boolean result = diagram.associationClass(2, name2A, name2B, cl1, linkType, label); if (result == false) { return CommandExecutionResult.error("Cannot have more than 2 assocications"); } @@ -431,6 +506,12 @@ private LinkDecor getDecors1(String s) { if ("<|".equals(s)) { return LinkDecor.EXTENDS; } + if ("<|:".equals(s)) { + return LinkDecor.DEFINEDBY; + } + if ("<||".equals(s)) { + return LinkDecor.REDEFINES; + } if ("}".equals(s)) { return LinkDecor.CROWFOOT; } @@ -481,6 +562,12 @@ private LinkDecor getDecors2(String s) { if ("|>".equals(s)) { return LinkDecor.EXTENDS; } + if (":|>".equals(s)) { + return LinkDecor.DEFINEDBY; + } + if ("||>".equals(s)) { + return LinkDecor.REDEFINES; + } if (">".equals(s)) { return LinkDecor.ARROW; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkLollipop.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkLollipop.java index b3059ff95..b415b2baf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkLollipop.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkLollipop.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -46,6 +46,7 @@ import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; @@ -108,8 +109,8 @@ private LeafType getType(String desc) { protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location, RegexResult arg) { - final Code ent1 = Code.of(arg.get("ENT1", 1)); - final Code ent2 = Code.of(arg.get("ENT2", 1)); + final String ent1 = arg.get("ENT1", 1); + final String ent2 = arg.get("ENT2", 1); final IEntity cl1; final IEntity cl2; @@ -118,13 +119,19 @@ protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram final String suffix = "lol" + UniqueSequence.getValue(); if (arg.get("LOL_THEN_ENT", 1) == null) { assert arg.get("ENT_THEN_LOL", 0) != null; - cl1 = diagram.getOrCreateLeaf(ent1, null, null); - cl2 = diagram.createLeaf(cl1.getCode().addSuffix(suffix), Display.getWithNewlines(ent2), + final Ident ident1 = diagram.buildLeafIdent(ent1); + final Code ent1code = diagram.V1972() ? ident1 : diagram.buildCode(ent1); + cl1 = getFoo1(diagram, ent1code, ident1); + final Ident idNewLong = diagram.buildLeafIdent(ent1 + suffix); + cl2 = diagram.createLeaf(idNewLong, idNewLong.toCode(diagram), Display.getWithNewlines(ent2), getType(arg.get("ENT_THEN_LOL", 1)), null); normalEntity = cl1; } else { - cl2 = diagram.getOrCreateLeaf(ent2, null, null); - cl1 = diagram.createLeaf(cl2.getCode().addSuffix(suffix), Display.getWithNewlines(ent1), + final Ident ident2 = diagram.buildLeafIdent(ent2); + final Code ent2code = diagram.V1972() ? ident2 : diagram.buildCode(ent2); + cl2 = getFoo1(diagram, ent2code, ident2); + final Ident idNewLong = diagram.buildLeafIdent(ent2 + suffix); + cl1 = diagram.createLeaf(idNewLong, idNewLong.toCode(diagram), Display.getWithNewlines(ent1), getType(arg.get("LOL_THEN_ENT", 0)), null); normalEntity = cl2; } @@ -189,6 +196,16 @@ protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram return CommandExecutionResult.ok(); } + private IEntity getFoo1(AbstractClassOrObjectDiagram diagram, final Code code, final Ident ident) { + if (diagram.V1972()) { + final IEntity result = ident.size() == 1 ? diagram.getLeafVerySmart(ident) : diagram.getLeafStrict(ident); + if (result != null) { + return result; + } + } + return diagram.getOrCreateLeaf(ident, code, null, null); + } + // private String merge(String a, String b) { // if (a == null && b == null) { // return null; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandNamespaceSeparator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandNamespaceSeparator.java index 1d7e66505..9c890c782 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandNamespaceSeparator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandNamespaceSeparator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,6 +36,7 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; @@ -50,7 +51,9 @@ static IRegex getRegexConcat() { RegexLeaf.start(), // new RegexLeaf("set"), // RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("namespaceseparator"), // + new RegexOr( // + new RegexLeaf("separator"), // + new RegexLeaf("namespaceseparator")), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("SEPARATOR", "(\\S+)"), RegexLeaf.end()); // } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandRemoveRestore.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandRemoveRestore.java index 65fb1b9dd..37e42bba3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandRemoveRestore.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandRemoveRestore.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandStereotype.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandStereotype.java index e8e5aec67..d015b6216 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandStereotype.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandStereotype.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,6 +41,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.Stereotype; public class CommandStereotype extends SingleLineCommand2 { @@ -59,9 +60,11 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { - final Code code = Code.of(arg.get("NAME", 0)); + final String name = arg.get("NAME", 0); + final Ident ident = diagram.buildLeafIdent(name); + final Code code = diagram.V1972() ? ident : diagram.buildCode(name); final String stereotype = arg.get("STEREO", 0); - final IEntity entity = diagram.getOrCreateLeaf(code, null, null); + final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null); entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram .getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam() .getIHtmlColorSet())); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandUrl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandUrl.java index 7671d3c73..2d1ea27ee 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandUrl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/CommandUrl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; public class CommandUrl extends SingleLineCommand2 { @@ -67,13 +68,16 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) { - final Code code = Code.of(arg.get("CODE", 0)); + final String idShort = arg.get("CODE", 0); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); final String urlString = arg.get("URL", 0); final IEntity entity; - if (diagram.leafExist(code)) { - entity = diagram.getOrCreateLeaf(code, null, null); - } else if (diagram.isGroup(code)) { - entity = diagram.getGroup(code); + final boolean leafExist = diagram.V1972() ? diagram.leafExistSmart(ident) : diagram.leafExist(code); + if (leafExist) { + entity = diagram.getOrCreateLeaf(ident, code, null, null); + } else if (diagram.V1972() ? diagram.isGroupStrict(ident) : diagram.isGroup(code)) { + entity = diagram.V1972() ? diagram.getGroupStrict(ident) : diagram.getGroup(code); } else { return CommandExecutionResult.error(code + " does not exist"); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/GenericRegexProducer.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/GenericRegexProducer.java index 6daa99895..5a3686408 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/GenericRegexProducer.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/GenericRegexProducer.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/JavaClass.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/JavaClass.java deleted file mode 100644 index ffc347805..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/JavaClass.java +++ /dev/null @@ -1,83 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.classdiagram.command; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.StringTokenizer; - -import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.cucadiagram.LeafType; - -class JavaClass { - - private final String name; - private final String javaPackage; - private final List parents = new ArrayList(); - private final LeafType type; - private final LeafType parentType; - - public JavaClass(String javaPackage, String name, String p, LeafType type, LeafType parentType) { - this.name = name; - this.javaPackage = javaPackage; - if (p == null) { - p = ""; - } - final StringTokenizer st = new StringTokenizer(StringUtils.trin(p), ","); - while (st.hasMoreTokens()) { - this.parents.add(StringUtils.trin(st.nextToken()).replaceAll("\\<.*", "")); - } - this.type = type; - this.parentType = parentType; - } - - public final String getName() { - return name; - } - - public final LeafType getType() { - return type; - } - - public final List getParents() { - return Collections.unmodifiableList(parents); - } - - public final LeafType getParentType() { - return parentType; - } - - public final String getJavaPackage() { - return javaPackage; - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/JavaFile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/JavaFile.java deleted file mode 100644 index 539897ecc..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/classdiagram/command/JavaFile.java +++ /dev/null @@ -1,107 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.classdiagram.command; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import net.sourceforge.plantuml.StringUtils; -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.cucadiagram.LeafType; - -class JavaFile { - - private static final Pattern2 classDefinition = MyPattern - .cmpile("^(?:public[%s]+|abstract[%s]+|final[%s]+)*(class|interface|enum|annotation)[%s]+(\\w+)(?:.*\\b(extends|implements)[%s]+([\\w%s,]+))?"); - - private static final Pattern2 packageDefinition = MyPattern.cmpile("^package[%s]+([\\w+.]+)[%s]*;"); - - private final List all = new ArrayList(); - - public JavaFile(File f) throws IOException { - BufferedReader br = null; - try { - br = new BufferedReader(new FileReader(f)); - initFromReader(br); - } finally { - if (br != null) { - br.close(); - } - } - } - - private void initFromReader(BufferedReader br) throws IOException { - String javaPackage = null; - String s; - while ((s = br.readLine()) != null) { - s = StringUtils.trin(s); - final Matcher2 matchPackage = packageDefinition.matcher(s); - if (matchPackage.find()) { - javaPackage = matchPackage.group(1); - } else { - final Matcher2 matchClassDefinition = classDefinition.matcher(s); - if (matchClassDefinition.find()) { - final String n = matchClassDefinition.group(2); - final String p = matchClassDefinition.group(4); - final LeafType type = LeafType.valueOf(StringUtils.goUpperCase(matchClassDefinition.group(1))); - final LeafType parentType = getParentType(type, matchClassDefinition.group(3)); - all.add(new JavaClass(javaPackage, n, p, type, parentType)); - } - } - } - } - - static LeafType getParentType(LeafType type, String extendsOrImplements) { - if (extendsOrImplements == null) { - return null; - } - if (type == LeafType.CLASS) { - if (extendsOrImplements.equals("extends")) { - return LeafType.CLASS; - } - return LeafType.INTERFACE; - } - return LeafType.INTERFACE; - } - - public List getJavaClasses() { - return Collections.unmodifiableList(all); - - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/ArobaseStringCompressor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/ArobaseStringCompressor.java index 384108ada..be4108f93 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/ArobaseStringCompressor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/ArobaseStringCompressor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -83,7 +83,7 @@ private String compressOld(String s) throws IOException { return ""; } - public String decompress(String s) throws IOException { + public String decompress(String s) { String result = clean(s); if (result.startsWith("@start")) { return result; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/ArobaseStringCompressor2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/ArobaseStringCompressor2.java index 7968b064f..67a6e73f6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/ArobaseStringCompressor2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/ArobaseStringCompressor2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,17 +30,15 @@ */ package net.sourceforge.plantuml.code; -import java.io.IOException; - import net.sourceforge.plantuml.StringUtils; public class ArobaseStringCompressor2 implements StringCompressor { - public String compress(String data) throws IOException { + public String compress(String data) { return clean2(data); } - public String decompress(String s) throws IOException { + public String decompress(String s) { return clean2(s); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/AsciiEncoder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/AsciiEncoder.java index 30b850df0..354cb6d4f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/AsciiEncoder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/AsciiEncoder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/AsciiEncoderBase64.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/AsciiEncoderBase64.java index bc3719412..8bf47ff04 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/AsciiEncoderBase64.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/AsciiEncoderBase64.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/AsciiEncoderFinalZeros.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/AsciiEncoderFinalZeros.java index 23378e15b..fc9bee493 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/AsciiEncoderFinalZeros.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/AsciiEncoderFinalZeros.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/AsciiEncoderHex.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/AsciiEncoderHex.java index 07ef851a7..18de6256d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/AsciiEncoderHex.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/AsciiEncoderHex.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/Base64Coder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/Base64Coder.java index c1eda0f7a..0d45bfe44 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/Base64Coder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/Base64Coder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/IfManagerFilter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/ByteArray.java similarity index 56% rename from src/plantuml-asl/src/net/sourceforge/plantuml/preproc/IfManagerFilter.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/code/ByteArray.java index 51be5f6b7..63fccb777 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/IfManagerFilter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/ByteArray.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,34 +28,39 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.preproc; +package net.sourceforge.plantuml.code; import java.io.IOException; +import java.io.UnsupportedEncodingException; -import net.sourceforge.plantuml.StringLocated; -import net.sourceforge.plantuml.preproc2.ReadFilter; +public class ByteArray { -public class IfManagerFilter implements ReadFilter { + private final byte data[]; + private final int length; - private final DefinesGet defines; + private ByteArray(byte data[], int length) { + this.data = data; + this.length = length; + } - public IfManagerFilter(DefinesGet defines) { - this.defines = defines; + public static ByteArray from(byte[] input) { + return new ByteArray(input, input.length); } - public ReadLine applyFilter(final ReadLine source) { - return new ReadLine() { + public String toUFT8String() throws UnsupportedEncodingException { + return new String(data, 0, length, "UTF-8"); + } - final IfManager ifManager = new IfManager(source, defines); + public String toUPF9String() throws IOException { + return Upf9Decoder.decodeString(data, length); + } - public void close() throws IOException { - source.close(); - } + public int getByteAt(int i) { + return data[i]; + } - public StringLocated readLine() throws IOException { - return ifManager.readLine(); - } - }; + public int length() { + return length; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/Compression.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/Compression.java index b42a17f1b..20ae67ab0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/Compression.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/Compression.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,8 +30,6 @@ */ package net.sourceforge.plantuml.code; -import java.io.IOException; - public interface Compression { /** @@ -42,11 +40,11 @@ public interface Compression { byte[] compress(final byte[] in); /** - * Grows the given in array with length len - * compressed with the shrink method. + * Grows the given in array with length len compressed + * with the shrink method. * * @return a newly created array with the expanded data. */ - byte[] decompress(byte[] in) throws IOException; + ByteArray decompress(byte[] in) throws NoPlantumlCompressionException; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionBrotli.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionBrotli.java index 97446af90..840e74955 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionBrotli.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionBrotli.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,13 +43,18 @@ public byte[] compress(byte[] in) { throw new UnsupportedOperationException(); } - public byte[] decompress(byte[] in) throws IOException { - final BrotliInputStream brotli = new BrotliInputStream(new ByteArrayInputStream(in)); - final ByteArrayOutputStream result = new ByteArrayOutputStream(); - FileUtils.copyToStream(brotli, result); - brotli.close(); - result.close(); - return result.toByteArray(); + public ByteArray decompress(byte[] in) throws NoPlantumlCompressionException { + try { + final BrotliInputStream brotli = new BrotliInputStream(new ByteArrayInputStream(in)); + final ByteArrayOutputStream result = new ByteArrayOutputStream(); + FileUtils.copyToStream(brotli, result); + brotli.close(); + result.close(); + return ByteArray.from(result.toByteArray()); + } catch (IOException e) { + e.printStackTrace(); + throw new NoPlantumlCompressionException(e); + } } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionHuffman.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionHuffman.java index f5aafd3b7..7c55330ed 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionHuffman.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionHuffman.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -54,19 +54,24 @@ public byte[] compress(byte[] in) { } } - public byte[] decompress(byte[] in) throws IOException { - final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + public ByteArray decompress(byte[] in) throws NoPlantumlCompressionException { + try { + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); - final ByteArrayInputStream bais = new ByteArrayInputStream(in); - final InflaterInputStream gz = new InflaterInputStream(bais); - int read; - while ((read = gz.read()) != -1) { - baos.write(read); + final ByteArrayInputStream bais = new ByteArrayInputStream(in); + final InflaterInputStream gz = new InflaterInputStream(bais); + int read; + while ((read = gz.read()) != -1) { + baos.write(read); + } + gz.close(); + bais.close(); + baos.close(); + return ByteArray.from(baos.toByteArray()); + } catch (IOException e) { + // System.err.println("Not Huffman"); + throw new NoPlantumlCompressionException(e); } - gz.close(); - bais.close(); - baos.close(); - return baos.toByteArray(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionNone.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionNone.java index 8ae9d9994..312afaecf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionNone.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionNone.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,8 +36,8 @@ public byte[] compress(byte[] in) { return in; } - public byte[] decompress(byte[] in) { - return in; + public ByteArray decompress(byte[] in) { + return ByteArray.from(in); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionZlib.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionZlib.java index 3d3b25faf..c1137b782 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionZlib.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionZlib.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -48,14 +48,14 @@ public byte[] compress(byte[] in) { return null; } int len = in.length * 2; - if (len < 100) { - len = 100; + if (len < 1000) { + len = 1000; } byte[] result = null; - while (result == null) { - result = tryCompress(in, len); - len *= 2; - } +// while (result == null) { + result = tryCompress(in, len); +// len *= 2; +// } return result; } @@ -70,24 +70,36 @@ private byte[] tryCompress(byte[] in, final int len) { if (compresser.finished() == false) { return null; } - final byte[] result = copyArray(output, compressedDataLength); - return result; + return copyArray(output, compressedDataLength); } - public byte[] decompress(byte[] in) throws IOException { - - final byte in2[] = new byte[in.length + 256]; - for (int i = 0; i < in.length; i++) { - in2[i] = in[i]; - } + public ByteArray decompress(byte[] in) throws NoPlantumlCompressionException { + try { + final byte in2[] = new byte[in.length + 256]; + System.arraycopy(in, 0, in2, 0, in.length); +// for (int i = 0; i < in.length; i++) { +// in2[i] = in[i]; +// } - int len = in.length * 5; - byte[] result = null; - while (result == null) { + int len = 100000; + byte[] result = null; result = tryDecompress(in2, len); - len *= 2; + if (result == null) { + throw new NoPlantumlCompressionException("Too big?"); + + } +// int len = in.length * 5; +// byte[] result = null; +// while (result == null) { +// result = tryDecompress(in2, len); +// len *= 2; +// } + return ByteArray.from(result); + } catch (IOException e) { + // e.printStackTrace(); + throw new NoPlantumlCompressionException(e); } - return result; + } private byte[] tryDecompress(byte[] in, final int len) throws IOException { @@ -115,9 +127,10 @@ private byte[] tryDecompress(byte[] in, final int len) throws IOException { private byte[] copyArray(final byte[] data, final int len) { final byte[] result = new byte[len]; - for (int i = 0; i < result.length; i++) { - result[i] = data[i]; - } + System.arraycopy(data, 0, result, 0, len); +// for (int i = 0; i < result.length; i++) { +// result[i] = data[i]; +// } return result; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionZlibPure.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionZlibPure.java new file mode 100644 index 000000000..21adfb16a --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionZlibPure.java @@ -0,0 +1,83 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.code; + +import java.io.ByteArrayInputStream; +import java.util.zip.Deflater; + +import net.sourceforge.plantuml.code.deflate.ByteBitInputStream; +import net.sourceforge.plantuml.code.deflate.Decompressor; + +public class CompressionZlibPure implements Compression { + + private static boolean USE_ZOPFLI = false; + private static final int COMPRESSION_LEVEL = 9; + + public byte[] compress(byte[] in) { + if (USE_ZOPFLI) { + return new CompressionZopfliZlib().compress(in); + } + if (in.length == 0) { + return null; + } + int len = in.length * 2; + if (len < 1000) { + len = 1000; + } + // Compress the bytes + final Deflater compresser = new Deflater(COMPRESSION_LEVEL, true); + compresser.setInput(in); + compresser.finish(); + + final byte[] output = new byte[len]; + final int compressedDataLength = compresser.deflate(output); + if (compresser.finished() == false) { + return null; + } + return copyArray(output, compressedDataLength); + } + + public ByteArray decompress(byte[] in) throws NoPlantumlCompressionException { + final ByteBitInputStream in2 = new ByteBitInputStream(new ByteArrayInputStream(in)); + try { + return ByteArray.from(Decompressor.decompress(in2)); + } catch (Exception e) { + throw new NoPlantumlCompressionException(e); + } + } + + private byte[] copyArray(final byte[] data, final int len) { + final byte[] result = new byte[len]; + System.arraycopy(data, 0, result, 0, len); + return result; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionZopfliZlib.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionZopfliZlib.java index 8f8432c2c..fb0434e57 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionZopfliZlib.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/CompressionZopfliZlib.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,8 +30,6 @@ */ package net.sourceforge.plantuml.code; -import java.io.IOException; - import net.sourceforge.plantuml.zopfli.Options; import net.sourceforge.plantuml.zopfli.Options.BlockSplitting; import net.sourceforge.plantuml.zopfli.Options.OutputFormat; @@ -53,7 +51,7 @@ public byte[] compress(byte[] in) { return compressor.compress(options, in).getResult(); } - public byte[] decompress(byte[] in) throws IOException { + public ByteArray decompress(byte[] in) throws NoPlantumlCompressionException { return new CompressionZlib().decompress(in); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/NoPlantumlCompressionException.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/NoPlantumlCompressionException.java new file mode 100644 index 000000000..0fa61b422 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/NoPlantumlCompressionException.java @@ -0,0 +1,45 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.code; + +import java.io.IOException; + +public class NoPlantumlCompressionException extends IOException { + + public NoPlantumlCompressionException(Exception cause) { + super(cause); + } + + public NoPlantumlCompressionException(String description) { + super(description); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/PairInt.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/PairInt.java index 96020248a..ce32e1010 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/PairInt.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/PairInt.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/Spiral.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/Spiral.java index 110a969b3..1fc8e0a09 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/Spiral.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/Spiral.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/SpiralOnRectangle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/SpiralOnRectangle.java index a353d95c4..ffa98ebd7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/SpiralOnRectangle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/SpiralOnRectangle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/StringCompressor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/StringCompressor.java index cd988299f..dcd73d964 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/StringCompressor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/StringCompressor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,6 +36,6 @@ public interface StringCompressor { String compress(String s) throws IOException; - String decompress(String compressed) throws IOException; + String decompress(String compressed) throws NoPlantumlCompressionException; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/StringCompressorNone.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/StringCompressorNone.java index 3cb1c1a43..64f413aad 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/StringCompressorNone.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/StringCompressorNone.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,7 +38,7 @@ public String compress(String s) throws IOException { return s; } - public String decompress(String stringAnnoted) throws IOException { + public String decompress(String stringAnnoted) { return stringAnnoted; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/Tokens.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/Tokens.java new file mode 100644 index 000000000..26ab41fd6 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/Tokens.java @@ -0,0 +1,212 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.code; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +public class Tokens { + + private final List keywords = new ArrayList(); + + public static void main(String[] args) { + System.err.println("keywords=" + new Tokens().keywords.size()); + final Set sorted = new TreeSet(new Tokens().keywords); + for (String s : sorted) { + System.err.println(s); + } + } + + public String compressUnicodeE000(String s) { + for (int i = 0; i < keywords.size(); i++) { + final char c = (char) ('\uE000' + i); + s = s.replace(keywords.get(i), "" + c); + } + return s; + } + + public String compressAscii128(String s) { + for (int i = 0; i < keywords.size(); i++) { + final char c = (char) (128 + i); + s = s.replace(keywords.get(i), "" + c); + } + return s; + } + + public Tokens() { + add("actor"); + add("participant"); + add("usecase"); + add("class"); + add("interface"); + add("abstract"); + add("enum"); + add("component"); + add("state"); + add("object"); + add("artifact"); + add("folder"); + add("rectangle"); + add("node"); + add("frame"); + add("cloud"); + add("database"); + add("storage"); + add("agent"); + add("stack"); + add("boundary"); + add("control"); + add("entity"); + add("card"); + add("file"); + add("package"); + add("queue"); + add("archimate"); + add("diamond"); + add("detach"); + + add("@start"); + add("@end"); + add("also"); + add("autonumber"); + add("caption"); + add("title"); + add("newpage"); + add("loop"); + add("break"); + add("critical"); + add("note"); + add("legend"); + add("group"); + add("left"); + add("right"); + add("link"); + add("over"); + add("activate"); + add("deactivate"); + add("destroy"); + add("create"); + add("footbox"); + add("hide"); + add("show"); + add("skinparam"); + add("skin"); + add("bottom"); + add("namespace"); + add("page"); + add("down"); + add("else"); + add("endif"); + add("partition"); + add("footer"); + add("header"); + add("center"); + add("rotate"); + add("return"); + add("repeat"); + add("start"); + add("stop"); + add("while"); + add("endwhile"); + add("fork"); + add("again"); + add("kill"); + add("order"); + add("mainframe"); + add("across"); + add("stereotype"); + add("split"); + add("style"); + add("sprite"); + + add("exit"); + add("include"); + add("pragma"); + add("undef"); + add("ifdef"); + // add("endif"); + add("ifndef"); + // add("else"); + add("function"); + add("procedure"); + add("endfunction"); + add("endprocedure"); + add("unquoted"); + // add("return"); + add("startsub"); + add("endsub"); + add("assert"); + add("local"); + + add("!definelong"); + add("!enddefinelong"); + add("!define"); + + add("define"); + add("alias"); + add("shape"); + add("label"); + add("BackgroundColor"); + add("Color"); + add("color"); + add("Entity"); + add("ENTITY"); + add("COLOR"); + add("LARGE"); + add("stereo"); + add("AZURE"); + add("Azure"); + + } + + private void add(String string) { + if (keywords.contains(string)) { + System.err.println(string); + throw new IllegalArgumentException(string); + } + if (string.length() <= 3) { + System.err.println(string); + throw new IllegalArgumentException(string); + } + if (string.matches("[!@]?[A-Za-z]+") == false) { + System.err.println(string); + throw new IllegalArgumentException(string); + } + keywords.add(string); + if (keywords.size() > 127) { + System.err.println(string); + throw new IllegalArgumentException(); + } + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/Transcoder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/Transcoder.java index ba02e3c85..77a26029e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/Transcoder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/Transcoder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,5 +36,5 @@ public interface Transcoder { public String encode(String text) throws IOException; - public String decode(String code) throws IOException; + public String decode(String code) throws NoPlantumlCompressionException; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderImpl.java index 25970884a..0f99e758c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,43 +34,54 @@ public class TranscoderImpl implements Transcoder { + static enum Format { + UTF8, UPF9; + } + private final Compression compression; private final URLEncoder urlEncoder; private final StringCompressor stringCompressor; + private final Format format; -// private TranscoderImpl() { -// this(new AsciiEncoder(), new StringCompressorNone(), new CompressionHuffman()); -// } -// -// private TranscoderImpl(Compression compression) { -// this(new AsciiEncoder(), new StringCompressorNone(), compression); -// } -// -// private TranscoderImpl(URLEncoder urlEncoder, Compression compression) { -// this(urlEncoder, new ArobaseStringCompressor(), compression); -// } - - public TranscoderImpl(URLEncoder urlEncoder, StringCompressor stringCompressor, Compression compression) { + private TranscoderImpl(URLEncoder urlEncoder, StringCompressor stringCompressor, Compression compression, + Format format) { this.compression = compression; this.urlEncoder = urlEncoder; this.stringCompressor = stringCompressor; + this.format = format; } - public String encode(String text) throws IOException { + public static Transcoder utf8(URLEncoder urlEncoder, StringCompressor stringCompressor, Compression compression) { + return new TranscoderImpl(urlEncoder, stringCompressor, compression, Format.UTF8); + } + public static Transcoder upf9(URLEncoder urlEncoder, StringCompressor stringCompressor, Compression compression) { + return new TranscoderImpl(urlEncoder, stringCompressor, compression, Format.UPF9); + } + + public String encode(String text) throws IOException { final String stringAnnoted = stringCompressor.compress(text); + final byte[] data; + if (format == Format.UTF8) + data = stringAnnoted.getBytes("UTF-8"); + else + data = Upf9Encoder.getBytes(stringAnnoted); - final byte[] data = stringAnnoted.getBytes("UTF-8"); final byte[] compressedData = compression.compress(data); return urlEncoder.encode(compressedData); } - public String decode(String code) throws IOException { - final byte compressedData[] = urlEncoder.decode(code); - final byte data[] = compression.decompress(compressedData); - - return stringCompressor.decompress(new String(data, "UTF-8")); + public String decode(String code) throws NoPlantumlCompressionException { + try { + final byte compressedData[] = urlEncoder.decode(code); + final ByteArray data = compression.decompress(compressedData); + final String string = format == Format.UTF8 ? data.toUFT8String() : data.toUPF9String(); + return stringCompressor.decompress(string); + } catch (Exception e) { + // System.err.println("Cannot decode string"); + throw new NoPlantumlCompressionException(e); + } } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmart.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmart.java index 00ae5f24c..0eeedaa19 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmart.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmart.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,59 +35,22 @@ public class TranscoderSmart implements Transcoder { // Legacy encoder - private final Transcoder oldOne = new TranscoderImpl(new AsciiEncoder(), new ArobaseStringCompressor(), + private final Transcoder oldOne = TranscoderImpl.utf8(new AsciiEncoder(), new ArobaseStringCompressor(), new CompressionHuffman()); - private final Transcoder zlib = new TranscoderImpl(new AsciiEncoder(), new ArobaseStringCompressor(), + private final Transcoder zlib = TranscoderImpl.utf8(new AsciiEncoder(), new ArobaseStringCompressor(), new CompressionZlib()); - private final Transcoder brotli = new TranscoderImpl(new AsciiEncoder(), new ArobaseStringCompressor(), - new CompressionBrotli()); - - - private final Transcoder zlibBase64 = new TranscoderImpl(new AsciiEncoderBase64(), new ArobaseStringCompressor(), - new CompressionZlib()); - private final Transcoder brotliBase64 = new TranscoderImpl(new AsciiEncoderBase64(), new ArobaseStringCompressor(), - new CompressionBrotli()); - private final Transcoder base64only = new TranscoderImpl(new AsciiEncoderBase64(), new ArobaseStringCompressor(), - new CompressionNone()); - private final Transcoder hexOnly = new TranscoderImpl(new AsciiEncoderHex(), new ArobaseStringCompressor(), - new CompressionNone()); - public String decode(String code) throws IOException { + public String decode(String code) throws NoPlantumlCompressionException { // Work in progress // See https://github.com/plantuml/plantuml/issues/117 - // Two char headers - if (code.startsWith("0A")) { - return zlibBase64.decode(code.substring(2)); - } - if (code.startsWith("0B")) { - return brotliBase64.decode(code.substring(2)); - } - if (code.startsWith("0C")) { - return base64only.decode(code.substring(2)); - } - if (code.startsWith("0D")) { - return hexOnly.decode(code.substring(2)); + if (code.startsWith("~0")) { + return zlib.decode(code.substring(2)); } - // Text prefix - // Just a wild try: use them only for testing - if (code.startsWith("-deflate-")) { - return zlibBase64.decode(code.substring("-deflate-".length())); - } - if (code.startsWith("-brotli-")) { - return brotliBase64.decode(code.substring("-brotli-".length())); - } - if (code.startsWith("-base64-")) { - return base64only.decode(code.substring("-base64-".length())); - } - if (code.startsWith("-hex-")) { - return hexOnly.decode(code.substring("-hex-".length())); + if (code.startsWith("~1")) { + return oldOne.decode(code.substring(2)); } - // Legacy decoding : you should not use it any more. - if (code.startsWith("0")) { - return brotli.decode(code.substring(1)); - } try { return zlib.decode(code); } catch (Exception ex) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmart2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmart2.java index 40db05155..5d6819b49 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmart2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmart2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,24 +35,23 @@ public class TranscoderSmart2 implements Transcoder { // Legacy encoder - private final Transcoder oldOne = new TranscoderImpl(new AsciiEncoder(), new ArobaseStringCompressor2(), + private final Transcoder oldOne = TranscoderImpl.utf8(new AsciiEncoder(), new ArobaseStringCompressor2(), new CompressionHuffman()); - private final Transcoder zlib = new TranscoderImpl(new AsciiEncoder(), new ArobaseStringCompressor2(), + private final Transcoder zlib = TranscoderImpl.utf8(new AsciiEncoder(), new ArobaseStringCompressor2(), new CompressionZlib()); - private final Transcoder brotli = new TranscoderImpl(new AsciiEncoder(), new ArobaseStringCompressor2(), + private final Transcoder brotli = TranscoderImpl.utf8(new AsciiEncoder(), new ArobaseStringCompressor2(), new CompressionBrotli()); - - - private final Transcoder zlibBase64 = new TranscoderImpl(new AsciiEncoderBase64(), new ArobaseStringCompressor2(), + + private final Transcoder zlibBase64 = TranscoderImpl.utf8(new AsciiEncoderBase64(), new ArobaseStringCompressor2(), new CompressionZlib()); - private final Transcoder brotliBase64 = new TranscoderImpl(new AsciiEncoderBase64(), new ArobaseStringCompressor2(), - new CompressionBrotli()); - private final Transcoder base64only = new TranscoderImpl(new AsciiEncoderBase64(), new ArobaseStringCompressor2(), + private final Transcoder brotliBase64 = TranscoderImpl.utf8(new AsciiEncoderBase64(), + new ArobaseStringCompressor2(), new CompressionBrotli()); + private final Transcoder base64only = TranscoderImpl.utf8(new AsciiEncoderBase64(), new ArobaseStringCompressor2(), new CompressionNone()); - private final Transcoder hexOnly = new TranscoderImpl(new AsciiEncoderHex(), new ArobaseStringCompressor2(), + private final Transcoder hexOnly = TranscoderImpl.utf8(new AsciiEncoderHex(), new ArobaseStringCompressor2(), new CompressionNone()); - public String decode(String code) throws IOException { + public String decode(String code) throws NoPlantumlCompressionException { // Work in progress // See https://github.com/plantuml/plantuml/issues/117 diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmartAttic.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmartAttic.java new file mode 100644 index 000000000..64c70a541 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmartAttic.java @@ -0,0 +1,103 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.code; + +import java.io.IOException; + +public class TranscoderSmartAttic implements Transcoder { + + // Legacy encoder + private final Transcoder oldOne = TranscoderImpl.utf8(new AsciiEncoder(), new ArobaseStringCompressor(), + new CompressionHuffman()); + private final Transcoder zlib = TranscoderImpl.utf8(new AsciiEncoder(), new ArobaseStringCompressor(), + new CompressionZlib()); + private final Transcoder brotli = TranscoderImpl.utf8(new AsciiEncoder(), new ArobaseStringCompressor(), + new CompressionBrotli()); + + private final Transcoder zlibBase64 = TranscoderImpl.utf8(new AsciiEncoderBase64(), new ArobaseStringCompressor(), + new CompressionZlib()); + private final Transcoder brotliBase64 = TranscoderImpl.utf8(new AsciiEncoderBase64(), new ArobaseStringCompressor(), + new CompressionBrotli()); + private final Transcoder base64only = TranscoderImpl.utf8(new AsciiEncoderBase64(), new ArobaseStringCompressor(), + new CompressionNone()); + private final Transcoder hexOnly = TranscoderImpl.utf8(new AsciiEncoderHex(), new ArobaseStringCompressor(), + new CompressionNone()); + + public String decode(String code) throws NoPlantumlCompressionException { + // Work in progress + // See https://github.com/plantuml/plantuml/issues/117 + + // Two char headers + if (code.startsWith("0A")) { + return zlibBase64.decode(code.substring(2)); + } + if (code.startsWith("0B")) { + return brotliBase64.decode(code.substring(2)); + } + if (code.startsWith("0C")) { + return base64only.decode(code.substring(2)); + } + if (code.startsWith("0D")) { + return hexOnly.decode(code.substring(2)); + } + // Text prefix + // Just a wild try: use them only for testing + if (code.startsWith("-deflate-")) { + return zlibBase64.decode(code.substring("-deflate-".length())); + } + if (code.startsWith("-brotli-")) { + return brotliBase64.decode(code.substring("-brotli-".length())); + } + if (code.startsWith("-base64-")) { + return base64only.decode(code.substring("-base64-".length())); + } + if (code.startsWith("-hex-")) { + return hexOnly.decode(code.substring("-hex-".length())); + } + + // Legacy decoding : you should not use it any more. + if (code.startsWith("0")) { + return brotli.decode(code.substring(1)); + } + try { + return zlib.decode(code); + } catch (Exception ex) { + return oldOne.decode(code); + } + // return zlib.decode(code); + } + + public String encode(String text) throws IOException { + // Right now, we still use the legacy encoding. + // This will be changed in the incoming months + return zlib.encode(text); + } +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmartProtected.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmartProtected.java new file mode 100644 index 000000000..fcc23e4af --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmartProtected.java @@ -0,0 +1,176 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.code; + +import java.io.IOException; + +public class TranscoderSmartProtected implements Transcoder { + + // Legacy encoder + private final Transcoder oldOne = TranscoderImpl.utf8(new AsciiEncoder(), new ArobaseStringCompressor(), + new CompressionHuffman()); + private final Transcoder zlib = TranscoderImpl.utf8(new AsciiEncoder(), new ArobaseStringCompressor(), + new CompressionZlib()); + private final Transcoder hexOnly = TranscoderImpl.utf8(new AsciiEncoderHex(), new ArobaseStringCompressor(), + new CompressionNone()); + + public String decode(String code) throws NoPlantumlCompressionException { + // Work in progress + // See https://github.com/plantuml/plantuml/issues/117 + + if (code.startsWith("~0")) { + return decodeZlib(code.substring(2)); + } + if (code.startsWith("~1")) { + return decodeHuffman(code.substring(2)); + } + if (code.startsWith("~h")) { + return hexOnly.decode(code.substring(2)); + } + + return decodeZlib(code); + } + + private String decodeZlib(String code) { + try { + return zlib.decode(code); + } catch (Exception ex) { + try { + oldOne.decode(code); + return textProtectedDeflate2(code); + } catch (Exception ex2) { + return textProtectedDeflate(code); + } + } + } + + private String decodeHuffman(String code) { + try { + return oldOne.decode(code); + } catch (Exception ex) { + return textProtectedHuffman(code); + } + } + + private String textProtectedHuffman(String code) { + final StringBuilder result = new StringBuilder(); + appendLine(result, "@startuml"); + appendLine(result, "legend"); + appendLine(result, "The plugin you are using seems to generated a bad URL."); + appendLine(result, "This URL does not look like HUFFMAN data."); + appendLine(result, ""); + appendLine(result, "See https://plantuml.com/pte"); + appendLine(result, ""); + appendLine(result, "You may contact the PlantUML team at plantuml@gmail.com"); + appendLine(result, + "But you should also probably contact the plugin authors you are currently using and send them this image"); + appendLine(result, ""); + appendLine(result, "For the record, here is your data:"); + appendLine(result, ""); + appendURL(result, code); + appendLine(result, "endlegend"); + appendLine(result, "@enduml"); + + return result.toString(); + } + + private String textProtectedDeflate2(String code) { + final StringBuilder result = new StringBuilder(); + final String codeshort = code.length() > 30 ? code.substring(0, 30) + "..." : code; + appendLine(result, "@startuml"); + appendLine(result, "legend"); + appendLine(result, "The plugin you are using seems to generated a bad URL."); + appendLine(result, "This URL does not look like DEFLATE data."); + appendLine(result, "It looks like your plugin is using HUFFMAN encoding."); + appendLine(result, ""); + appendLine(result, + "This means you have now to add an header ~1 to your data. For example, you have to change:"); + appendLine(result, "http://www.plantuml.com/plantuml/png/" + codeshort); + appendLine(result, "to"); + appendLine(result, "http://www.plantuml.com/plantuml/png/~1" + codeshort); + appendLine(result, ""); + appendLine(result, "It will work this way"); + appendLine(result, "You may contact the PlantUML team at plantuml@gmail.com"); + appendLine(result, + "But you should also probably contact the plugin authors you are currently using and send them this image"); + appendLine(result, ""); + appendLine(result, "For the record, here is your data:"); + appendLine(result, ""); + appendURL(result, code); + appendLine(result, "endlegend"); + appendLine(result, "@enduml"); + + return result.toString(); + } + + private String textProtectedDeflate(String code) { + final StringBuilder result = new StringBuilder(); + appendLine(result, "@startuml"); + appendLine(result, "legend"); + appendLine(result, "The plugin you are using seems to generated a bad URL."); + appendLine(result, "This URL does not look like DEFLATE data."); + appendLine(result, ""); + appendLine(result, "See https://plantuml.com/pte"); + appendLine(result, ""); + appendLine(result, "You may contact the PlantUML team at plantuml@gmail.com"); + appendLine(result, + "But you should also probably contact the plugin authors you are currently using and send them this image"); + appendLine(result, ""); + appendLine(result, "For the record, here is your data:"); + appendLine(result, ""); + appendURL(result, code); + appendLine(result, "endlegend"); + appendLine(result, "@enduml"); + + return result.toString(); + } + + private void appendURL(StringBuilder result, String url) { + while (url.length() > 80) { + appendLine(result, url.substring(0, 80)); + url = url.substring(80); + } + if (url.length() > 0) { + appendLine(result, url); + } + } + + private void appendLine(StringBuilder sb, String s) { + sb.append(s); + sb.append("\n"); + } + + public String encode(String text) throws IOException { + // Right now, we still use the legacy encoding. + // This will be changed in the incoming months + return zlib.encode(text); + } +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmartProtectedPure.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmartProtectedPure.java new file mode 100644 index 000000000..8e65f2b71 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderSmartProtectedPure.java @@ -0,0 +1,176 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.code; + +import java.io.IOException; + +public class TranscoderSmartProtectedPure implements Transcoder { + + // Legacy encoder + private final Transcoder oldOne = TranscoderImpl.utf8(new AsciiEncoder(), new ArobaseStringCompressor(), + new CompressionHuffman()); + private final Transcoder zlib = TranscoderImpl.utf8(new AsciiEncoder(), new ArobaseStringCompressor(), + new CompressionZlibPure()); + private final Transcoder hexOnly = TranscoderImpl.utf8(new AsciiEncoderHex(), new ArobaseStringCompressor(), + new CompressionNone()); + + public String decode(String code) throws NoPlantumlCompressionException { + // Work in progress + // See https://github.com/plantuml/plantuml/issues/117 + + if (code.startsWith("~0")) { + return decodeZlib(code.substring(2)); + } + if (code.startsWith("~1")) { + return decodeHuffman(code.substring(2)); + } + if (code.startsWith("~h")) { + return hexOnly.decode(code.substring(2)); + } + + return decodeZlib(code); + } + + private String decodeZlib(String code) { + try { + return zlib.decode(code); + } catch (Exception ex) { + try { + oldOne.decode(code); + return textProtectedDeflate2(code); + } catch (Exception ex2) { + return textProtectedDeflate(code); + } + } + } + + private String decodeHuffman(String code) { + try { + return oldOne.decode(code); + } catch (Exception ex) { + return textProtectedHuffman(code); + } + } + + private String textProtectedHuffman(String code) { + final StringBuilder result = new StringBuilder(); + appendLine(result, "@startuml"); + appendLine(result, "legend"); + appendLine(result, "The plugin you are using seems to generated a bad URL."); + appendLine(result, "This URL does not look like HUFFMAN data."); + appendLine(result, ""); + appendLine(result, "See https://plantuml.com/pte"); + appendLine(result, ""); + appendLine(result, "You may contact the PlantUML team at plantuml@gmail.com"); + appendLine(result, + "But you should also probably contact the plugin authors you are currently using and send them this image"); + appendLine(result, ""); + appendLine(result, "For the record, here is your data:"); + appendLine(result, ""); + appendURL(result, code); + appendLine(result, "endlegend"); + appendLine(result, "@enduml"); + + return result.toString(); + } + + private String textProtectedDeflate2(String code) { + final StringBuilder result = new StringBuilder(); + final String codeshort = code.length() > 30 ? code.substring(0, 30) + "..." : code; + appendLine(result, "@startuml"); + appendLine(result, "legend"); + appendLine(result, "The plugin you are using seems to generated a bad URL."); + appendLine(result, "This URL does not look like DEFLATE data."); + appendLine(result, "It looks like your plugin is using HUFFMAN encoding."); + appendLine(result, ""); + appendLine(result, + "This means you have now to add an header ~1 to your data. For example, you have to change:"); + appendLine(result, "http://www.plantuml.com/plantuml/png/" + codeshort); + appendLine(result, "to"); + appendLine(result, "http://www.plantuml.com/plantuml/png/~1" + codeshort); + appendLine(result, ""); + appendLine(result, "It will work this way"); + appendLine(result, "You may contact the PlantUML team at plantuml@gmail.com"); + appendLine(result, + "But you should also probably contact the plugin authors you are currently using and send them this image"); + appendLine(result, ""); + appendLine(result, "For the record, here is your data:"); + appendLine(result, ""); + appendURL(result, code); + appendLine(result, "endlegend"); + appendLine(result, "@enduml"); + + return result.toString(); + } + + private String textProtectedDeflate(String code) { + final StringBuilder result = new StringBuilder(); + appendLine(result, "@startuml"); + appendLine(result, "legend"); + appendLine(result, "The plugin you are using seems to generated a bad URL."); + appendLine(result, "This URL does not look like DEFLATE data."); + appendLine(result, ""); + appendLine(result, "See https://plantuml.com/pte"); + appendLine(result, ""); + appendLine(result, "You may contact the PlantUML team at plantuml@gmail.com"); + appendLine(result, + "But you should also probably contact the plugin authors you are currently using and send them this image"); + appendLine(result, ""); + appendLine(result, "For the record, here is your data:"); + appendLine(result, ""); + appendURL(result, code); + appendLine(result, "endlegend"); + appendLine(result, "@enduml"); + + return result.toString(); + } + + private void appendURL(StringBuilder result, String url) { + while (url.length() > 80) { + appendLine(result, url.substring(0, 80)); + url = url.substring(80); + } + if (url.length() > 0) { + appendLine(result, url); + } + } + + private void appendLine(StringBuilder sb, String s) { + sb.append(s); + sb.append("\n"); + } + + public String encode(String text) throws IOException { + // Right now, we still use the legacy encoding. + // This will be changed in the incoming months + return zlib.encode(text); + } +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderUtil.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderUtil.java index f05de2217..54ec77e24 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderUtil.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/TranscoderUtil.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,8 +36,12 @@ public static Transcoder getDefaultTranscoder() { return new TranscoderSmart(); } - public static Transcoder getDefaultTranscoder2() { - return new TranscoderSmart2(); + public static Transcoder getDefaultTranscoderProtected() { + return new TranscoderSmartProtected(); + } + + public static Transcoder getDefaultTranscoderProtectedPure() { + return new TranscoderSmartProtectedPure(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/URLEncoder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/URLEncoder.java index 49d27d50d..f76557c1f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/code/URLEncoder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/URLEncoder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/Upf9Decoder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/Upf9Decoder.java new file mode 100644 index 000000000..cf4924dfc --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/Upf9Decoder.java @@ -0,0 +1,80 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.code; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; + +public class Upf9Decoder { + + private Upf9Decoder() { + } + + static int decodeChar(InputStream is) throws IOException { + final int read0 = is.read(); + if (read0 == -1) { + return -1; + } + if (read0 == 0x0B) { + final int read1 = is.read(); + if (read1 >= 0x80) + return (char) read1; + return (char) ((0xE0 << 8) + read1); + } + if (read0 == 0x0C) { + final int read1 = is.read(); + final int read2 = is.read(); + return (char) ((read1 << 8) + read2); + } + if (read0 >= 0x01 && read0 <= 0x08) { + final int read1 = is.read(); + return (char) ((read0 << 8) + read1); + } + if (read0 >= 0x80 && read0 <= 0xFF) { + final int read1 = is.read(); + return (char) (((read0 - 0x60) << 8) + read1); + } + return (char) read0; + } + + public static String decodeString(byte[] data, int length) throws IOException { + final ByteArrayInputStream bais = new ByteArrayInputStream(data, 0, length); + final StringBuilder result = new StringBuilder(); + int read; + while ((read = decodeChar(bais)) != -1) { + result.append((char) read); + } + bais.close(); + return result.toString(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/Upf9Encoder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/Upf9Encoder.java new file mode 100644 index 000000000..daaa28af9 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/Upf9Encoder.java @@ -0,0 +1,110 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.code; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +public class Upf9Encoder { + + private Upf9Encoder() { + + } + + public static byte[] encodeChar(char c) { + final byte[] result = encodeCharInternal(c); + assert checkBack(c, result); + return result; + } + + private static boolean checkBack(char c, byte[] result) { + try { + if (c == Upf9Decoder.decodeChar(new ByteArrayInputStream(result))) + return true; + } catch (IOException e) { + e.printStackTrace(); + } + return false; + } + + private static byte[] encodeCharInternal(char c) { + if (c == '\n' || c == '\r' || c == '\t') { + // Using regular ASCII code for and + return new byte[] { (byte) c }; + } + if (c >= '\u000E' && c <= '\u0012') { + return new byte[] { (byte) c }; + } + if (c >= '\u0020' && c <= '\u007E') { + // Using regular ASCII code for ASCII printable char + return new byte[] { (byte) c }; + } + if (c >= '\u0080' && c <= '\u00FF') { + // Char from to are encoded as [0x0B 0x80] to [0x0B 0xFF] + return new byte[] { 0x0B, (byte) c }; + } + if (c >= '\u0100' && c <= '\u08FF') { + // Char from to are encoded as [0x01 0x00] to [0x08 0xFF] + return new byte[] { highByte(c), lowByte(c) }; + } + if (c >= '\u2000' && c <= '\u9FFF') { + // Char from to are encoded as [0x80 0x00] to [0xFF 0xFF] + return new byte[] { (byte) (0x60 + highByte(c)), lowByte(c) }; + } + if (c >= '\uE000' && c <= '\uE07F') { + // Char from to are encoded as [0x0B 0x00] to [0x0B 0x7F] + return new byte[] { 0x0B, lowByte(c) }; + } + // All other char are encoded on 3 bytes, starting with 0x0C + return new byte[] { 0x0C, highByte(c), lowByte(c) }; + } + + private static byte lowByte(char c) { + return (byte) (c & 0x00FF); + } + + private static byte highByte(char c) { + return (byte) ((c & 0xFF00) >> 8); + } + + public static byte[] getBytes(String s) throws IOException { + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + for (int i = 0; i < s.length(); i++) { + baos.write(encodeChar(s.charAt(i))); + } + baos.close(); + final byte[] result = baos.toByteArray(); + assert s.endsWith(Upf9Decoder.decodeString(result, result.length)); + return result; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/BitInputStream.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/BitInputStream.java new file mode 100644 index 000000000..fb7eb66a0 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/BitInputStream.java @@ -0,0 +1,92 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.code.deflate; + +/* + * Simple DEFLATE decompressor + * Copyright (c) Project Nayuki + * + * https://www.nayuki.io/page/simple-deflate-decompressor + * https://github.com/nayuki/Simple-DEFLATE-decompressor + */ + +import java.io.Closeable; +import java.io.EOFException; +import java.io.IOException; + + +/** + * A stream of bits that can be read. Bits are packed in little endian within a byte. + * For example, the byte 0x87 reads as the sequence of bits [1,1,1,0,0,0,0,1]. + */ +public interface BitInputStream extends Closeable { + + /** + * Returns the current bit position, which ascends from 0 to 7 as bits are read. + * @return the current bit position, which is between 0 and 7 + */ + public int getBitPosition(); + + + /** + * Discards the remainder of the current byte (if any) and reads the next + * whole byte from the stream. Returns -1 if the end of stream is reached. + * @return the next byte from the stream, or -1 if the end of stream is reached + */ + public int readByte() throws IOException; + + + /** + * Reads a bit from this stream. Returns 0 or 1 if a bit is available, or -1 if + * the end of stream is reached. The end of stream always occurs on a byte boundary. + * @return the next bit of 0 or 1, or -1 for the end of stream + * @throws IOException if an I/O exception occurred + */ + public int read() throws IOException; + + + /** + * Reads a bit from this stream. Returns 0 or 1 if a bit is available, or throws an {@code EOFException} + * if the end of stream is reached. The end of stream always occurs on a byte boundary. + * @return the next bit of 0 or 1 + * @throws IOException if an I/O exception occurred + * @throws EOFException if the end of stream is reached + */ + public int readNoEof() throws IOException; + + + /** + * Closes this stream and the underlying input stream. + * @throws IOException if an I/O exception occurred + */ + public void close() throws IOException; + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/ByteBitInputStream.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/ByteBitInputStream.java new file mode 100644 index 000000000..d00f70f6a --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/ByteBitInputStream.java @@ -0,0 +1,128 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.code.deflate; + +/* + * Simple DEFLATE decompressor + * Copyright (c) Project Nayuki + * + * https://www.nayuki.io/page/simple-deflate-decompressor + * https://github.com/nayuki/Simple-DEFLATE-decompressor + */ + +import java.io.EOFException; +import java.io.IOException; +import java.io.InputStream; +import java.util.Objects; + + +/** + * A stream of bits that can be read. Because they come from an underlying byte stream, + * the total number of bits is always a multiple of 8. The bits are read in little endian. + * Mutable and not thread-safe. + */ +public final class ByteBitInputStream implements BitInputStream { + + /*---- Fields ----*/ + + // The underlying byte stream to read from (not null). + private InputStream input; + + // Either in the range [0x00, 0xFF] if bits are available, or -1 if end of stream is reached. + private int currentByte; + + // Number of remaining bits in the current byte, always between 0 and 7 (inclusive). + private int numBitsRemaining; + + + + /*---- Constructor ----*/ + + /** + * Constructs a bit input stream based on the specified byte input stream. + * @param in the byte input stream (not {@code null}) + * @throws NullPointerException if the input stream is {@code null} + */ + public ByteBitInputStream(InputStream in) { + input = Objects.requireNonNull(in); + currentByte = 0; + numBitsRemaining = 0; + } + + + + /*---- Methods ----*/ + + public int getBitPosition() { + if (numBitsRemaining < 0 || numBitsRemaining > 7) + throw new IllegalStateException(); + return (8 - numBitsRemaining) % 8; + } + + + public int readByte() throws IOException { + currentByte = 0; + numBitsRemaining = 0; + return input.read(); + } + + + public int read() throws IOException { + if (currentByte == -1) + return -1; + if (numBitsRemaining == 0) { + currentByte = input.read(); + if (currentByte == -1) + return -1; + numBitsRemaining = 8; + } + if (numBitsRemaining <= 0) + throw new IllegalStateException(); + numBitsRemaining--; + return (currentByte >>> (7 - numBitsRemaining)) & 1; + } + + + public int readNoEof() throws IOException { + int result = read(); + if (result == -1) + throw new EOFException(); + return result; + } + + + public void close() throws IOException { + input.close(); + currentByte = -1; + numBitsRemaining = 0; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/ByteHistory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/ByteHistory.java new file mode 100644 index 000000000..b78b6c02f --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/ByteHistory.java @@ -0,0 +1,122 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.code.deflate; + +/* + * Simple DEFLATE decompressor + * Copyright (c) Project Nayuki + * + * https://www.nayuki.io/page/simple-deflate-decompressor + * https://github.com/nayuki/Simple-DEFLATE-decompressor + */ + +import java.io.IOException; +import java.util.Objects; + + +/** + * Stores a finite recent history of a byte stream. Useful as an implicit + * dictionary for Lempel-Ziv schemes. Mutable and not thread-safe. + */ +final class ByteHistory { + + /*---- Fields ----*/ + + // Circular buffer of byte data. + private byte[] data; + + // Index of next byte to write to, always in the range [0, data.length). + private int index; + + + + /*---- Constructor ----*/ + + /** + * Constructs a byte history of the specified size, initialized to zeros. + * @param size the size, which must be positive + * @throws IllegalArgumentException if size is zero or negative + */ + public ByteHistory(int size) { + if (size < 1) + throw new IllegalArgumentException("Size must be positive"); + data = new byte[size]; + index = 0; + } + + + + /*---- Methods ----*/ + + /** + * Appends the specified byte to this history. + * This overwrites the byte value at {@code size} positions ago. + * @param b the byte value to append + */ + public void append(int b) { + if (index < 0 || index >= data.length) + throw new IllegalStateException(); + data[index] = (byte)b; + index = (index + 1) % data.length; + } + + + /** + * Copies {@code len} bytes starting at {@code dist} bytes ago to + * the specified output stream and also back into this buffer itself. + *

Note that if the length exceeds the distance, then some of the output + * data will be a copy of data that was copied earlier in the process.

+ * @param dist the distance to go back, in the range [1, size] + * @param len the length to copy, which must be at least 0 + * @param out the output stream to write to (not {@code null}) + * @throws NullPointerException if the output stream is {@code null} + * @throws IllegalArgumentException if the length is negative, + * distance is not positive, or distance is greater than the buffer size + * @throws IOException if an I/O exception occurs + */ + public void copy(int dist, int len, OutputStreamProtected out) throws IOException { + Objects.requireNonNull(out); + if (len < 0 || dist < 1 || dist > data.length) + throw new IllegalArgumentException(); + + int readIndex = (index - dist + data.length) % data.length; + if (readIndex < 0 || readIndex >= data.length) + throw new IllegalStateException(); + + for (int i = 0; i < len; i++) { + byte b = data[readIndex]; + readIndex = (readIndex + 1) % data.length; + out.write(b); + append(b); + } + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/CanonicalCode.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/CanonicalCode.java new file mode 100644 index 000000000..dd58de07b --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/CanonicalCode.java @@ -0,0 +1,204 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.code.deflate; + +/* + * Simple DEFLATE decompressor + * Copyright (c) Project Nayuki + * + * https://www.nayuki.io/page/simple-deflate-decompressor + * https://github.com/nayuki/Simple-DEFLATE-decompressor + */ + +import java.io.IOException; +import java.util.Arrays; +import java.util.Objects; + + +/** + * A canonical Huffman code, where the code values for each symbol is derived + * from a given sequence of code lengths. This data structure is immutable. + * This could be transformed into an explicit Huffman code tree. + *

Example:

+ *
  Code lengths (canonical code):
+ *    Symbol A: 1
+ *    Symbol B: 0 (no code)
+ *    Symbol C: 3
+ *    Symbol D: 2
+ *    Symbol E: 3
+ *  
+ *  Generated Huffman codes:
+ *    Symbol A: 0
+ *    Symbol B: (Absent)
+ *    Symbol C: 110
+ *    Symbol D: 10
+ *    Symbol E: 111
+ *  
+ *  Huffman code tree:
+ *      .
+ *     / \
+ *    A   .
+ *       / \
+ *      D   .
+ *         / \
+ *        C   E
+ */ +final class CanonicalCode { + + /* + * These arrays store the Huffman codes and values necessary for decoding. + * symbolCodeBits contains Huffman codes, each padded with a 1 bit at the + * beginning to disambiguate codes of different lengths (e.g. otherwise we + * can't distinguish 0b01 from 0b0001). Each symbolCodeBits[i] decodes to its + * corresponding symbolValues[i]. Values in symbolCodeBits are strictly increasing. + * + * For the example of codeLengths=[1,0,3,2,3], we would have: + * i | symbolCodeBits[i] | symbolValues[i] + * --+-------------------+---------------- + * 0 | 0b1_0 | 0 + * 1 | 0b1_10 | 3 + * 2 | 0b1_110 | 2 + * 3 | 0b1_111 | 4 + */ + private int[] symbolCodeBits; + private int[] symbolValues; + + + + /** + * Constructs a canonical Huffman code from the specified array of symbol code lengths. + * Each code length must be non-negative. Code length 0 means no code for the symbol. + * The collection of code lengths must represent a proper full Huffman code tree. + *

Examples of code lengths that result in correct full Huffman code trees:

+ *
    + *
  • [1, 1] (result: A=0, B=1)
  • + *
  • [2, 2, 1, 0, 0, 0] (result: A=10, B=11, C=0)
  • + *
  • [3, 3, 3, 3, 3, 3, 3, 3] (result: A=000, B=001, C=010, ..., H=111)
  • + *
+ *

Examples of code lengths that result in under-full Huffman code trees:

+ *
    + *
  • [0, 2, 0] (result: B=00, unused=01, unused=1)
  • + *
  • [0, 1, 0, 2] (result: B=0, D=10, unused=11)
  • + *
+ *

Examples of code lengths that result in over-full Huffman code trees:

+ *
    + *
  • [1, 1, 1] (result: A=0, B=1, C=overflow)
  • + *
  • [1, 1, 2, 2, 3, 3, 3, 3] (result: A=0, B=1, C=overflow, ...)
  • + *
+ * @param canonicalCodeLengths array of symbol code lengths (not {@code null}) + * @throws NullPointerException if the array is {@code null} + * @throws IllegalArgumentException if any element is negative, any value exceeds MAX_CODE_LENGTH, + * or the collection of code lengths would yield an under-full or over-full Huffman code tree + */ + public CanonicalCode(int[] codeLengths) { + // Check argument values + Objects.requireNonNull(codeLengths); + for (int x : codeLengths) { + if (x < 0) + throw new IllegalArgumentException("Negative code length"); + if (x > MAX_CODE_LENGTH) + throw new IllegalArgumentException("Maximum code length exceeded"); + } + + // Allocate code values to symbols. Symbols are processed in the order + // of shortest code length first, breaking ties by lowest symbol value. + symbolCodeBits = new int[codeLengths.length]; + symbolValues = new int[codeLengths.length]; + int numSymbolsAllocated = 0; + int nextCode = 0; + for (int codeLength = 1; codeLength <= MAX_CODE_LENGTH; codeLength++) { + nextCode <<= 1; + int startBit = 1 << codeLength; + for (int symbol = 0; symbol < codeLengths.length; symbol++) { + if (codeLengths[symbol] != codeLength) + continue; + if (nextCode >= startBit) + throw new IllegalArgumentException("This canonical code produces an over-full Huffman code tree"); + + symbolCodeBits[numSymbolsAllocated] = startBit | nextCode; + symbolValues [numSymbolsAllocated] = symbol; + numSymbolsAllocated++; + nextCode++; + } + } + if (nextCode != 1 << MAX_CODE_LENGTH) + throw new IllegalArgumentException("This canonical code produces an under-full Huffman code tree"); + + // Trim unused trailing elements + symbolCodeBits = Arrays.copyOf(symbolCodeBits, numSymbolsAllocated); + symbolValues = Arrays.copyOf(symbolValues , numSymbolsAllocated); + } + + + + /** + * Decodes the next symbol from the specified bit input stream based on this + * canonical code. The returned symbol value is in the range [0, codeLengths.length). + * @param in the bit input stream to read from + * @return the next decoded symbol + * @throws IOException if an I/O exception occurred + */ + public int decodeNextSymbol(BitInputStream in) throws IOException { + Objects.requireNonNull(in); + int codeBits = 1; // The start bit + while (true) { + // Accumulate one bit at a time on the right side until a match is + // found in the symbolCodeBits array. Because the Huffman code tree is + // full, this loop must terminate after at most MAX_CODE_LENGTH iterations. + codeBits = codeBits << 1 | in.readNoEof(); + int index = Arrays.binarySearch(symbolCodeBits, codeBits); + if (index >= 0) + return symbolValues[index]; + } + } + + + /** + * Returns a string representation of this canonical code, + * useful for debugging only, and the format is subject to change. + * @return a string representation of this canonical code + */ + public String toString() { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < symbolCodeBits.length; i++) { + sb.append(String.format("Code %s: Symbol %d%n", + Integer.toBinaryString(symbolCodeBits[i]).substring(1), + symbolValues[i])); + } + return sb.toString(); + } + + + + // The maximum Huffman code length allowed in the DEFLATE standard. + private static final int MAX_CODE_LENGTH = 15; + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/Decompressor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/Decompressor.java new file mode 100644 index 000000000..16479257f --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/Decompressor.java @@ -0,0 +1,330 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.code.deflate; + +import java.io.EOFException; +import java.io.IOException; +import java.util.Arrays; +import java.util.Objects; +import java.util.zip.DataFormatException; + + +/** + * Decompresses raw DEFLATE data (without zlib or gzip container) into bytes. + */ +public final class Decompressor { + + /*---- Public functions ----*/ + + /** + * Reads from the specified input stream, decompress the data, and returns a new byte array. + * @param in the bit input stream to read from (not {@code null}) + * @throws NullPointerException if the input stream is {@code null} + * @throws DataFormatException if the DEFLATE data is malformed + */ + public static byte[] decompress(BitInputStream in) throws IOException, DataFormatException { + OutputStreamProtected out = new OutputStreamProtected(); + decompress(in, out); + return out.toByteArray(); + } + + + /** + * Reads from the specified input stream, decompress the data, and writes to the specified output stream. + * @param in the bit input stream to read from (not {@code null}) + * @param out the byte output stream to write to (not {@code null}) + * @throws NullPointerException if the input or output stream is {@code null} + * @throws DataFormatException if the DEFLATE data is malformed + */ + public static void decompress(BitInputStream in, OutputStreamProtected out) throws IOException, DataFormatException { + new Decompressor(in, out); + } + + + + /*---- Private implementation ----*/ + + private BitInputStream input; + + private OutputStreamProtected output; + + private ByteHistory dictionary; + + + + // Constructor, which immediately performs decompression + private Decompressor(BitInputStream in, OutputStreamProtected out) throws IOException, DataFormatException { + // Initialize fields + input = Objects.requireNonNull(in); + output = Objects.requireNonNull(out); + dictionary = new ByteHistory(32 * 1024); + + // Process the stream of blocks + boolean isFinal; + do { + // Read the block header + isFinal = in.readNoEof() == 1; // bfinal + int type = readInt(2); // btype + + // Decompress rest of block based on the type + if (type == 0) + decompressUncompressedBlock(); + else if (type == 1) + decompressHuffmanBlock(FIXED_LITERAL_LENGTH_CODE, FIXED_DISTANCE_CODE); + else if (type == 2) { + CanonicalCode[] litLenAndDist = decodeHuffmanCodes(); + decompressHuffmanBlock(litLenAndDist[0], litLenAndDist[1]); + } else if (type == 3) + throw new DataFormatException("Reserved block type"); + else + throw new IllegalStateException("Impossible value"); + } while (!isFinal); + } + + + /*-- The constant code trees for static Huffman codes (btype = 1) --*/ + + private static final CanonicalCode FIXED_LITERAL_LENGTH_CODE; + private static final CanonicalCode FIXED_DISTANCE_CODE; + + static { // Make temporary tables of canonical code lengths + int[] llcodelens = new int[288]; + Arrays.fill(llcodelens, 0, 144, 8); + Arrays.fill(llcodelens, 144, 256, 9); + Arrays.fill(llcodelens, 256, 280, 7); + Arrays.fill(llcodelens, 280, 288, 8); + FIXED_LITERAL_LENGTH_CODE = new CanonicalCode(llcodelens); + + int[] distcodelens = new int[32]; + Arrays.fill(distcodelens, 5); + FIXED_DISTANCE_CODE = new CanonicalCode(distcodelens); + } + + + /*-- Method for reading and decoding dynamic Huffman codes (btype = 2) --*/ + + // Reads from the bit input stream, decodes the Huffman code + // specifications into code trees, and returns the trees. + private CanonicalCode[] decodeHuffmanCodes() throws IOException, DataFormatException { + int numLitLenCodes = readInt(5) + 257; // hlit + 257 + int numDistCodes = readInt(5) + 1; // hdist + 1 + + // Read the code length code lengths + int numCodeLenCodes = readInt(4) + 4; // hclen + 4 + int[] codeLenCodeLen = new int[19]; // This array is filled in a strange order + codeLenCodeLen[16] = readInt(3); + codeLenCodeLen[17] = readInt(3); + codeLenCodeLen[18] = readInt(3); + codeLenCodeLen[ 0] = readInt(3); + for (int i = 0; i < numCodeLenCodes - 4; i++) { + int j = (i % 2 == 0) ? (8 + i / 2) : (7 - i / 2); + codeLenCodeLen[j] = readInt(3); + } + + // Create the code length code + CanonicalCode codeLenCode; + try { + codeLenCode = new CanonicalCode(codeLenCodeLen); + } catch (IllegalArgumentException e) { + throw new DataFormatException(e.getMessage()); + } + + // Read the main code lengths and handle runs + int[] codeLens = new int[numLitLenCodes + numDistCodes]; + for (int codeLensIndex = 0; codeLensIndex < codeLens.length; ) { + int sym = codeLenCode.decodeNextSymbol(input); + if (0 <= sym && sym <= 15) { + codeLens[codeLensIndex] = sym; + codeLensIndex++; + } else { + int runLen; + int runVal = 0; + if (sym == 16) { + if (codeLensIndex == 0) + throw new DataFormatException("No code length value to copy"); + runLen = readInt(2) + 3; + runVal = codeLens[codeLensIndex - 1]; + } else if (sym == 17) + runLen = readInt(3) + 3; + else if (sym == 18) + runLen = readInt(7) + 11; + else + throw new IllegalStateException("Symbol out of range"); + int end = codeLensIndex + runLen; + if (end > codeLens.length) + throw new DataFormatException("Run exceeds number of codes"); + Arrays.fill(codeLens, codeLensIndex, end, runVal); + codeLensIndex = end; + } + } + + // Create literal-length code tree + int[] litLenCodeLen = Arrays.copyOf(codeLens, numLitLenCodes); + CanonicalCode litLenCode; + try { + litLenCode = new CanonicalCode(litLenCodeLen); + } catch (IllegalArgumentException e) { + throw new DataFormatException(e.getMessage()); + } + + // Create distance code tree with some extra processing + int[] distCodeLen = Arrays.copyOfRange(codeLens, numLitLenCodes, codeLens.length); + CanonicalCode distCode; + if (distCodeLen.length == 1 && distCodeLen[0] == 0) + distCode = null; // Empty distance code; the block shall be all literal symbols + else { + // Get statistics for upcoming logic + int oneCount = 0; + int otherPositiveCount = 0; + for (int x : distCodeLen) { + if (x == 1) + oneCount++; + else if (x > 1) + otherPositiveCount++; + } + + // Handle the case where only one distance code is defined + if (oneCount == 1 && otherPositiveCount == 0) { + // Add a dummy invalid code to make the Huffman tree complete + distCodeLen = Arrays.copyOf(distCodeLen, 32); + distCodeLen[31] = 1; + } + try { + distCode = new CanonicalCode(distCodeLen); + } catch (IllegalArgumentException e) { + throw new DataFormatException(e.getMessage()); + } + } + + return new CanonicalCode[]{litLenCode, distCode}; + } + + + /*-- Block decompression methods --*/ + + // Handles and copies an uncompressed block from the bit input stream. + private void decompressUncompressedBlock() throws IOException, DataFormatException { + // Discard bits to align to byte boundary + while (input.getBitPosition() != 0) + input.readNoEof(); + + // Read length + int len = readInt(16); + int nlen = readInt(16); + if ((len ^ 0xFFFF) != nlen) + throw new DataFormatException("Invalid length in uncompressed block"); + + // Copy bytes + for (int i = 0; i < len; i++) { + int b = input.readByte(); + if (b == -1) + throw new EOFException(); + output.write(b); + dictionary.append(b); + } + } + + + // Decompresses a Huffman-coded block from the bit input stream based on the given Huffman codes. + private void decompressHuffmanBlock(CanonicalCode litLenCode, CanonicalCode distCode) + throws IOException, DataFormatException { + Objects.requireNonNull(litLenCode); + // distCode is allowed to be null + + while (true) { + int sym = litLenCode.decodeNextSymbol(input); + if (sym == 256) // End of block + break; + + if (sym < 256) { // Literal byte + output.write(sym); + dictionary.append(sym); + } else { // Length and distance for copying + int run = decodeRunLength(sym); + if (run < 3 || run > 258) + throw new IllegalStateException("Invalid run length"); + if (distCode == null) + throw new DataFormatException("Length symbol encountered with empty distance code"); + int distSym = distCode.decodeNextSymbol(input); + int dist = decodeDistance(distSym); + if (dist < 1 || dist > 32768) + throw new IllegalStateException("Invalid distance"); + dictionary.copy(dist, run, output); + } + } + } + + + /*-- Symbol decoding methods --*/ + + // Returns the run length based on the given symbol and possibly reading more bits. + private int decodeRunLength(int sym) throws IOException, DataFormatException { + if (sym < 257 || sym > 287) // Cannot occur in the bit stream; indicates the decompressor is buggy + throw new IllegalStateException("Invalid run length symbol: " + sym); + else if (sym <= 264) + return sym - 254; + else if (sym <= 284) { + int numExtraBits = (sym - 261) / 4; + return (((sym - 265) % 4 + 4) << numExtraBits) + 3 + readInt(numExtraBits); + } else if (sym == 285) + return 258; + else // sym is 286 or 287 + throw new DataFormatException("Reserved length symbol: " + sym); + } + + + // Returns the distance based on the given symbol and possibly reading more bits. + private int decodeDistance(int sym) throws IOException, DataFormatException { + if (sym < 0 || sym > 31) // Cannot occur in the bit stream; indicates the decompressor is buggy + throw new IllegalStateException("Invalid distance symbol: " + sym); + if (sym <= 3) + return sym + 1; + else if (sym <= 29) { + int numExtraBits = sym / 2 - 1; + return ((sym % 2 + 2) << numExtraBits) + 1 + readInt(numExtraBits); + } else // sym is 30 or 31 + throw new DataFormatException("Reserved distance symbol: " + sym); + } + + + /*-- Utility method --*/ + + // Reads the given number of bits from the bit input stream as a single integer, packed in little endian. + private int readInt(int numBits) throws IOException { + if (numBits < 0 || numBits > 31) + throw new IllegalArgumentException(); + int result = 0; + for (int i = 0; i < numBits; i++) + result |= input.readNoEof() << i; + return result; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/PreprocessorChangeModeReader.java b/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/OutputStreamProtected.java similarity index 53% rename from src/plantuml-asl/src/net/sourceforge/plantuml/preproc/PreprocessorChangeModeReader.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/OutputStreamProtected.java index 575b59c4a..1b2ce42b2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/PreprocessorChangeModeReader.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/code/deflate/OutputStreamProtected.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,35 +28,41 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.preproc; +package net.sourceforge.plantuml.code.deflate; -import java.io.IOException; +import java.io.ByteArrayOutputStream; + +/* + * Simple DEFLATE decompressor + * Copyright (c) Project Nayuki + * + * https://www.nayuki.io/page/simple-deflate-decompressor + * https://github.com/nayuki/Simple-DEFLATE-decompressor + */ -import net.sourceforge.plantuml.StringLocated; -import net.sourceforge.plantuml.preproc2.PreprocessorMode; -import net.sourceforge.plantuml.preproc2.PreprocessorModeSet; +import java.io.Closeable; +import java.io.IOException; -public class PreprocessorChangeModeReader implements ReadLine { +public class OutputStreamProtected implements Closeable { - private final ReadLine raw; - private final PreprocessorModeSet mode; + private final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + private int counter = 0; - public PreprocessorChangeModeReader(ReadLine source, PreprocessorModeSet mode) { - this.raw = source; - this.mode = mode; + public void close() throws IOException { + baos.close(); } - public void close() throws IOException { - raw.close(); + public byte[] toByteArray() { + return baos.toByteArray(); } - public StringLocated readLine() throws IOException { - final StringLocated line = raw.readLine(); - if (line != null && line.getTrimmed().getString().endsWith("!preprocessorV2")) { - this.mode.setPreprocessorMode(PreprocessorMode.V2_NEW_TIM); - return new StringLocated("", line.getLocation()); + public void write(int b) throws IOException { + this.counter++; + baos.write(b); + if (counter > 128000) { + throw new IOException("Too big"); } - return line; + } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/BlocLines.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/BlocLines.java index e89d26703..38199efbf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/BlocLines.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/BlocLines.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,8 +31,6 @@ package net.sourceforge.plantuml.command; import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -45,45 +43,28 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.security.SFile; public class BlocLines implements Iterable { private List lines; - private void check() { - // for (CharSequence s : lines) { - // // if (s == null) { - // // continue; - // // } - // if (s instanceof String) { - // continue; - // } - // // if (s instanceof Stereotype) { - // // continue; - // // } - // if (s instanceof CharSequence2) { - // continue; - // } - // // if (s instanceof MessageNumber) { - // // continue; - // // } - // // if (s instanceof EmbeddedDiagram) { - // // continue; - // // } - // System.err.println("PB2=" + s); - // System.err.println("PB=" + s.getClass()); - // Thread.dumpStack(); - // System.exit(0); - // } - } - @Override public String toString() { - return lines.toString(); + final StringBuilder sb = new StringBuilder(); + for (StringLocated line : lines) { + sb.append("<<<"); + sb.append(line); + sb.append(">>>"); + } + return sb.toString(); } - public static BlocLines load(File f, LineLocation location) throws IOException { - final BufferedReader br = new BufferedReader(new FileReader(f)); + public static BlocLines load(SFile f, LineLocation location) throws IOException { + final BufferedReader br = f.openBufferedReader(); + if (br == null) { + return null; + } return loadInternal(br, location); } @@ -104,14 +85,13 @@ private static BlocLines loadInternal(final BufferedReader br, LineLocation loca private BlocLines(List lines) { this.lines = Collections.unmodifiableList(lines); - this.check(); } public Display toDisplay() { return Display.createFoo(lines); } - public static BlocLines single2(StringLocated single) { + public static BlocLines single(StringLocated single) { final List result = new ArrayList(); result.add(single); return new BlocLines(result); @@ -123,6 +103,14 @@ public static BlocLines singleString(String single) { return new BlocLines(result); } + public static BlocLines fromArray(String[] array) { + final List result = new ArrayList(); + for (String single : array) { + result.add(new StringLocated(single, null)); + } + return new BlocLines(result); + } + public static BlocLines getWithNewlines(String s) { final List result = new ArrayList(); for (String cs : BackSlash.getWithNewlines(s)) { @@ -135,7 +123,7 @@ public BlocLines() { this(new ArrayList()); } - public BlocLines add2(StringLocated s) { + public BlocLines add(StringLocated s) { final List copy = new ArrayList(lines); copy.add(s); return new BlocLines(copy); @@ -147,10 +135,6 @@ public BlocLines addString(String s) { return new BlocLines(copy); } - // public List getLines() { - // return lines2; - // } - public List getLinesAsStringForSprite() { final List result = new ArrayList(); for (StringLocated s : lines) { @@ -163,43 +147,55 @@ public int size() { return lines.size(); } - public StringLocated get499(int i) { + public StringLocated getAt(int i) { return lines.get(i); } - public StringLocated getFirst499() { + public StringLocated getFirst() { if (lines.size() == 0) { return null; } return lines.get(0); } - public StringLocated getLast499() { + public StringLocated getLast() { return lines.get(lines.size() - 1); } - public BlocLines cleanList2(MultilinesStrategy strategy) { + public BlocLines cleanList(MultilinesStrategy strategy) { final List copy = new ArrayList(lines); strategy.cleanList(copy); return new BlocLines(copy); } - public BlocLines trim(boolean removeEmptyLines) { + public BlocLines trim() { final List copy = new ArrayList(lines); for (int i = 0; i < copy.size(); i++) { final StringLocated s = copy.get(i); - copy.set(i, new StringLocated(s.getTrimmed().getString(), s.getLocation())); + copy.set(i, s.getTrimmed()); } - if (removeEmptyLines) { - for (final Iterator it = copy.iterator(); it.hasNext();) { - if (it.next().getString().length() == 0) { - it.remove(); - } + return new BlocLines(copy); + } + + public BlocLines removeEmptyLines() { + final List copy = new ArrayList(lines); + for (final Iterator it = copy.iterator(); it.hasNext();) { + if (it.next().getString().length() == 0) { + it.remove(); } } return new BlocLines(copy); } +// public BlocLines trimRight() { +// final List copy = new ArrayList(lines); +// for (int i = 0; i < copy.size(); i++) { +// final StringLocated s = copy.get(i); +// copy.set(i, s.getTrimmedRight()); +// } +// return new BlocLines(copy); +// } + public BlocLines removeEmptyColumns() { if (firstColumnRemovable(lines) == false) { return this; @@ -209,7 +205,7 @@ public BlocLines removeEmptyColumns() { for (int i = 0; i < copy.size(); i++) { final StringLocated s = copy.get(i); if (s.getString().length() > 0) { - copy.set(i, s.sub(1, s.getString().length())); + copy.set(i, s.substring(1, s.getString().length())); } } } while (firstColumnRemovable(copy)); @@ -236,7 +232,7 @@ public char getLastChar() { return s.getString().charAt(s.getString().length() - 1); } - public BlocLines removeStartingAndEnding2(String data) { + public BlocLines removeStartingAndEnding(String data, int removeAtEnd) { if (lines.size() == 0) { return this; } @@ -244,7 +240,18 @@ public BlocLines removeStartingAndEnding2(String data) { copy.set(0, new StringLocated(data, null)); final int n = copy.size() - 1; final StringLocated s = copy.get(n); - copy.set(n, s.sub(0, s.getString().length() - 1)); + copy.set(n, s.substring(0, s.getString().length() - removeAtEnd)); + return new BlocLines(copy); + } + + public BlocLines overrideLastLine(String last) { + if (lines.size() == 0) { + return this; + } + final List copy = new ArrayList(lines); + final int n = copy.size() - 1; + final StringLocated currentLast = copy.get(n); + copy.set(n, new StringLocated(last, currentLast.getLocation())); return new BlocLines(copy); } @@ -293,7 +300,7 @@ private static StringLocated removeStartingSpaces(StringLocated arg, int nbStart if (i == 0) { return arg; } - return arg.sub(i, arg.getString().length()); + return arg.substring(i, arg.getString().length()); } public BlocLines subExtract(int margeStart, int margeEnd) { @@ -314,16 +321,32 @@ public BlocLines eventuallyMoveBracket() { if (size() < 2) { return this; } - final String first = getFirst499().getTrimmed().getString(); - final String second = get499(1).getTrimmed().getString(); + final String first = getFirst().getTrimmed().getString(); + final String second = getAt(1).getTrimmed().getString(); if (first.endsWith("{") == false && second.equals("{")) { - final String vline = first + " {"; + final StringLocated vline = getFirst().append(" {"); final List result = new ArrayList(); - result.add(new StringLocated(vline, null)); + result.add(vline); result.addAll(this.lines.subList(2, this.lines.size())); return new BlocLines(result); } return this; } + public BlocLines eventuallyMoveAllEmptyBracket() { + final List result = new ArrayList(); + for (StringLocated line : lines) { + if (line.getTrimmed().toString().equals("{")) { + if (result.size() > 0) { + final int pos = result.size() - 1; + StringLocated last = result.get(pos); + result.set(pos, last.append(" {")); + } + } else { + result.add(line); + } + } + return new BlocLines(result); + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/Command.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/Command.java index a93721d98..0e5294caa 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/Command.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/Command.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandAffineTransform.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandAffineTransform.java index 72fa35b6e..cb2bc5569 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandAffineTransform.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandAffineTransform.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandAffineTransformMultiline.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandAffineTransformMultiline.java index d26c3c7ce..1e2155ec7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandAffineTransformMultiline.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandAffineTransformMultiline.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandCaption.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandCaption.java index d0828888d..319f4bed3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandCaption.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandCaption.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandControl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandControl.java index 607c3ed1a..5f22b9023 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandControl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandControl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandDecoratorMultine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandDecoratorMultine.java index e2f28de7e..d6a702747 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandDecoratorMultine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandDecoratorMultine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -61,7 +61,7 @@ public CommandControl isValid(BlocLines lines) { return CommandControl.NOT_OK; } lines = lines.toSingleLineWithHiddenNewLine(); - if (cmd.isForbidden(lines.getFirst499().getString())) { + if (cmd.isForbidden(lines.getFirst().getString())) { return CommandControl.NOT_OK; } final CommandControl tmp = cmd.isValid(lines); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandEndPackage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandEndPackage.java index 14d911a09..ee8034cb9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandEndPackage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandEndPackage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandExecutionResult.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandExecutionResult.java index bd91b3a2e..12337f8fd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandExecutionResult.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandExecutionResult.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/FactorySpriteCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandFactorySprite.java similarity index 68% rename from src/plantuml-asl/src/net/sourceforge/plantuml/command/FactorySpriteCommand.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandFactorySprite.java index e937d5a5f..ca2b9ce0a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/FactorySpriteCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandFactorySprite.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,7 +30,6 @@ */ package net.sourceforge.plantuml.command; -import java.io.IOException; import java.util.Arrays; import java.util.List; @@ -43,18 +42,18 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; -import net.sourceforge.plantuml.ugraphic.sprite.SpriteColorBuilder4096; -import net.sourceforge.plantuml.ugraphic.sprite.SpriteGrayLevel; +import net.sourceforge.plantuml.sprite.Sprite; +import net.sourceforge.plantuml.sprite.SpriteColorBuilder4096; +import net.sourceforge.plantuml.sprite.SpriteGrayLevel; -public final class FactorySpriteCommand implements SingleMultiFactoryCommand { +public final class CommandFactorySprite implements SingleMultiFactoryCommand { private IRegex getRegexConcatMultiLine() { - return RegexConcat.build(FactorySpriteCommand.class.getName() + "multi", RegexLeaf.start(), // + return RegexConcat.build(CommandFactorySprite.class.getName() + "multi", RegexLeaf.start(), // new RegexLeaf("sprite"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("\\$?"), // - new RegexLeaf("NAME", "([\\p{L}0-9_]+)"), // + new RegexLeaf("NAME", "([-.\\p{L}0-9_]+)"), // RegexLeaf.spaceZeroOrMore(), // new RegexOptional(new RegexLeaf("DIM", "\\[(\\d+)x(\\d+)/(?:(\\d+)(z)?|(color))\\]")), // RegexLeaf.spaceZeroOrMore(), // @@ -62,11 +61,11 @@ private IRegex getRegexConcatMultiLine() { } private IRegex getRegexConcatSingleLine() { - return RegexConcat.build(FactorySpriteCommand.class.getName() + "single", RegexLeaf.start(), // + return RegexConcat.build(CommandFactorySprite.class.getName() + "single", RegexLeaf.start(), // new RegexLeaf("sprite"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("\\$?"), // - new RegexLeaf("NAME", "([\\p{L}0-9_]+)"), // + new RegexLeaf("NAME", "([-.\\p{L}0-9_]+)"), // RegexLeaf.spaceZeroOrMore(), // new RegexOptional(new RegexLeaf("DIM", "\\[(\\d+)x(\\d+)/(?:(\\d+)(z)|(color))\\]")), // RegexLeaf.spaceOneOrMore(), // @@ -77,7 +76,8 @@ public Command createSingleLine() { return new SingleLineCommand2(getRegexConcatSingleLine()) { @Override - protected CommandExecutionResult executeArg(final WithSprite system, LineLocation location, RegexResult arg) { + protected CommandExecutionResult executeArg(final WithSprite system, LineLocation location, + RegexResult arg) { return executeInternal(system, arg, Arrays.asList((String) arg.get("DATA", 0))); } @@ -93,8 +93,8 @@ public String getPatternEnd() { } protected CommandExecutionResult executeNow(final WithSprite system, BlocLines lines) { - lines = lines.trim(true); - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + lines = lines.trim().removeEmptyLines(); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); lines = lines.subExtract(1, 1); lines = lines.removeEmptyColumns(); @@ -108,33 +108,32 @@ protected CommandExecutionResult executeNow(final WithSprite system, BlocLines l } private CommandExecutionResult executeInternal(WithSprite system, RegexResult line0, final List strings) { - try { - final Sprite sprite; - if (line0.get("DIM", 0) == null) { - sprite = SpriteGrayLevel.GRAY_16.buildSprite(-1, -1, strings); - } else { - final int width = Integer.parseInt(line0.get("DIM", 0)); - final int height = Integer.parseInt(line0.get("DIM", 1)); - if (line0.get("DIM", 4) == null) { - final int nbLevel = Integer.parseInt(line0.get("DIM", 2)); - if (nbLevel != 4 && nbLevel != 8 && nbLevel != 16) { - return CommandExecutionResult.error("Only 4, 8 or 16 graylevel are allowed."); - } - final SpriteGrayLevel level = SpriteGrayLevel.get(nbLevel); - if (line0.get("DIM", 3) == null) { - sprite = level.buildSprite(width, height, strings); - } else { - sprite = level.buildSpriteZ(width, height, concat(strings)); - } + final Sprite sprite; + if (line0.get("DIM", 0) == null) { + sprite = SpriteGrayLevel.GRAY_16.buildSprite(-1, -1, strings); + } else { + final int width = Integer.parseInt(line0.get("DIM", 0)); + final int height = Integer.parseInt(line0.get("DIM", 1)); + if (line0.get("DIM", 4) == null) { + final int nbLevel = Integer.parseInt(line0.get("DIM", 2)); + if (nbLevel != 4 && nbLevel != 8 && nbLevel != 16) { + return CommandExecutionResult.error("Only 4, 8 or 16 graylevel are allowed."); + } + final SpriteGrayLevel level = SpriteGrayLevel.get(nbLevel); + if (line0.get("DIM", 3) == null) { + sprite = level.buildSprite(width, height, strings); } else { - sprite = SpriteColorBuilder4096.buildSprite(strings); + sprite = level.buildSpriteZ(width, height, concat(strings)); + if (sprite == null) { + return CommandExecutionResult.error("Cannot decode sprite."); + } } + } else { + sprite = SpriteColorBuilder4096.buildSprite(strings); } - system.addSprite(line0.get("NAME", 0), sprite); - return CommandExecutionResult.ok(); - } catch (IOException e) { - return CommandExecutionResult.error("Cannot decode sprite."); } + system.addSprite(line0.get("NAME", 0), sprite); + return CommandExecutionResult.ok(); } private String concat(final List strings) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandFootboxIgnored.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandFootboxIgnored.java index 56e39523f..4352bb8ae 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandFootboxIgnored.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandFootboxIgnored.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandFooter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandFooter.java index 9c083e0e1..22b95978a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandFooter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandFooter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,7 +32,6 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.LineLocation; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.UmlDiagram; @@ -44,7 +43,6 @@ import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.style.PName; public class CommandFooter extends SingleLineCommand2 { @@ -67,14 +65,15 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) { final String align = arg.get("POSITION", 0); - HorizontalAlignment defaultAlign = HorizontalAlignment.CENTER; - if (SkinParam.USE_STYLES()) { - defaultAlign = FontParam.FOOTER.getStyleDefinition() + HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER); + if (SkinParam.USE_STYLES() && align == null) { + ha = FontParam.FOOTER.getStyleDefinition(null) .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) - .value(PName.HorizontalAlignment).asHorizontalAlignment(); + .getHorizontalAlignment(); } - diagram.getFooter().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), - HorizontalAlignment.fromString(align, defaultAlign)); + diagram.getFooter().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), ha); + + return CommandExecutionResult.ok(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandHeader.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandHeader.java index 79a16f45a..60f196f16 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandHeader.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandHeader.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,7 +32,6 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.LineLocation; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.UmlDiagram; @@ -44,7 +43,6 @@ import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.style.PName; public class CommandHeader extends SingleLineCommand2 { @@ -69,14 +67,13 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) { final String align = arg.get("POSITION", 0); - HorizontalAlignment defaultAlign = HorizontalAlignment.RIGHT; - if (SkinParam.USE_STYLES()) { - defaultAlign = FontParam.HEADER.getStyleDefinition() + HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT); + if (SkinParam.USE_STYLES() && align == null) { + ha = FontParam.HEADER.getStyleDefinition(null) .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) - .value(PName.HorizontalAlignment).asHorizontalAlignment(); + .getHorizontalAlignment(); } - diagram.getHeader().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), - HorizontalAlignment.fromString(align, defaultAlign)); + diagram.getHeader().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), ha); return CommandExecutionResult.ok(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandHideUnlinked.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandHideUnlinked.java index b25226db1..43995a237 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandHideUnlinked.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandHideUnlinked.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMainframe.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMainframe.java index b971cc1f7..25b8e257e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMainframe.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMainframe.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMinwidth.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMinwidth.java index 249790abd..3fd665a7e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMinwidth.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMinwidth.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilines.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilines.java index 5c0eca724..a6d34c733 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilines.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilines.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -56,7 +56,7 @@ final public CommandControl isValid(BlocLines lines) { if (isCommandForbidden()) { return CommandControl.NOT_OK; } - Matcher2 m1 = starting.matcher(lines.getFirst499().getTrimmed().getString()); + Matcher2 m1 = starting.matcher(lines.getFirst().getTrimmed().getString()); if (m1.matches() == false) { return CommandControl.NOT_OK; } @@ -64,7 +64,7 @@ final public CommandControl isValid(BlocLines lines) { return CommandControl.OK_PARTIAL; } - m1 = MyPattern.cmpile(getPatternEnd()).matcher(lines.getLast499().getTrimmed().getString()); + m1 = MyPattern.cmpile(getPatternEnd()).matcher(lines.getLast().getTrimmed().getString()); if (m1.matches() == false) { return CommandControl.OK_PARTIAL; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilines2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilines2.java index 64a08cb89..e637043f3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilines2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilines2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -61,13 +61,13 @@ public String[] getDescription() { } final public CommandControl isValid(BlocLines lines) { - lines = lines.cleanList2(strategy); + lines = lines.cleanList(strategy); if (isCommandForbidden()) { return CommandControl.NOT_OK; } if (syntaxWithFinalBracket()) { - if (lines.size() == 1 && lines.getFirst499().getTrimmed().getString().endsWith("{") == false) { - final String vline = ((StringLocated) lines.get499(0)).getString() + " {"; + if (lines.size() == 1 && lines.getFirst().getTrimmed().getString().endsWith("{") == false) { + final String vline = ((StringLocated) lines.getAt(0)).getString() + " {"; if (isValid(BlocLines.singleString(vline)) == CommandControl.OK_PARTIAL) { return CommandControl.OK_PARTIAL; } @@ -75,7 +75,7 @@ final public CommandControl isValid(BlocLines lines) { } lines = lines.eventuallyMoveBracket(); } - final StringLocated first = lines.getFirst499(); + final StringLocated first = lines.getFirst(); if (first == null) { return CommandControl.NOT_OK; } @@ -87,7 +87,7 @@ final public CommandControl isValid(BlocLines lines) { return CommandControl.OK_PARTIAL; } - final Matcher2 m1 = MyPattern.cmpile(getPatternEnd()).matcher(lines.getLast499().getTrimmed().getString()); + final Matcher2 m1 = MyPattern.cmpile(getPatternEnd()).matcher(lines.getLast().getTrimmed().getString()); if (m1.matches() == false) { return CommandControl.OK_PARTIAL; } @@ -97,7 +97,7 @@ final public CommandControl isValid(BlocLines lines) { } public final CommandExecutionResult execute(S system, BlocLines lines) { - lines = lines.cleanList2(strategy); + lines = lines.cleanList(strategy); if (syntaxWithFinalBracket()) { lines = lines.eventuallyMoveBracket(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilines3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilines3.java index 7e1813993..4de091f67 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilines3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilines3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -56,11 +56,11 @@ public String[] getDescription() { } final public CommandControl isValid(BlocLines lines) { - lines = lines.cleanList2(strategy); + lines = lines.cleanList(strategy); if (isCommandForbidden()) { return CommandControl.NOT_OK; } - final StringLocated first = lines.getFirst499(); + final StringLocated first = lines.getFirst(); if (first == null) { return CommandControl.NOT_OK; } @@ -72,7 +72,7 @@ final public CommandControl isValid(BlocLines lines) { return CommandControl.OK_PARTIAL; } - final StringLocated potentialLast = lines.getLast499().getTrimmed(); + final StringLocated potentialLast = lines.getLast().getTrimmed(); final boolean m1 = getPatternEnd2().match(potentialLast); if (m1 == false) { return CommandControl.OK_PARTIAL; @@ -83,7 +83,7 @@ final public CommandControl isValid(BlocLines lines) { } public final CommandExecutionResult execute(S system, BlocLines lines) { - lines = lines.cleanList2(strategy); + lines = lines.cleanList(strategy); return executeNow(system, lines); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesBracket.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesBracket.java index c7904a92a..b08d5313d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesBracket.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesBracket.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -66,7 +66,7 @@ final public CommandControl isValid(BlocLines lines) { if (isCommandForbidden()) { return CommandControl.NOT_OK; } - final Matcher2 m1 = starting.matcher(lines.getFirst499().getTrimmed().getString()); + final Matcher2 m1 = starting.matcher(lines.getFirst().getTrimmed().getString()); if (m1.matches() == false) { return CommandControl.NOT_OK; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesCaption.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesCaption.java new file mode 100644 index 000000000..a904f7a84 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesCaption.java @@ -0,0 +1,61 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.command; + +import net.sourceforge.plantuml.TitledDiagram; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.cucadiagram.DisplayPositionned; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; +import net.sourceforge.plantuml.graphic.VerticalAlignment; + +public class CommandMultilinesCaption extends CommandMultilines { + + public CommandMultilinesCaption() { + super("(?i)^caption$"); + } + + @Override + public String getPatternEnd() { + return "(?i)^end[%s]?caption$"; + } + + public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) { + lines = lines.subExtract(1, 1); + lines = lines.removeEmptyColumns(); + final Display strings = lines.toDisplay(); + if (strings.size() > 0) { + diagram.setCaption(DisplayPositionned.single(strings.replaceBackslashT(), HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM)); + return CommandExecutionResult.ok(); + } + return CommandExecutionResult.error("No caption defined"); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesComment.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesComment.java index ecb4f2759..5bfc6c4fa 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesComment.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesComment.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java index 029c8391c..be24977b8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,14 +31,12 @@ package net.sourceforge.plantuml.command; import net.sourceforge.plantuml.FontParam; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.style.PName; public class CommandMultilinesFooter extends CommandMultilines { @@ -52,8 +50,8 @@ public String getPatternEnd() { } public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) { - lines = lines.trim(false); - final Matcher2 m = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + lines = lines.trim(); + final Matcher2 m = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); if (m.find() == false) { throw new IllegalStateException(); } @@ -61,13 +59,13 @@ public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lin lines = lines.subExtract(1, 1); final Display strings = lines.toDisplay(); if (strings.size() > 0) { - HorizontalAlignment defaultAlign = HorizontalAlignment.CENTER; - if (SkinParam.USE_STYLES()) { - defaultAlign = FontParam.FOOTER.getStyleDefinition() + HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER); + if (SkinParam.USE_STYLES() && align == null) { + ha = FontParam.FOOTER.getStyleDefinition(null) .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) - .value(PName.HorizontalAlignment).asHorizontalAlignment(); + .getHorizontalAlignment(); } - diagram.getFooter().putDisplay(strings, HorizontalAlignment.fromString(align, defaultAlign)); + diagram.getFooter().putDisplay(strings, ha); return CommandExecutionResult.ok(); } return CommandExecutionResult.error("Empty footer"); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java index 7300e1f6b..3b1a218fd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,14 +31,12 @@ package net.sourceforge.plantuml.command; import net.sourceforge.plantuml.FontParam; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.style.PName; public class CommandMultilinesHeader extends CommandMultilines { @@ -52,8 +50,8 @@ public String getPatternEnd() { } public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) { - lines = lines.trim(false); - final Matcher2 m = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + lines = lines.trim(); + final Matcher2 m = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); if (m.find() == false) { throw new IllegalStateException(); } @@ -61,13 +59,13 @@ public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lin lines = lines.subExtract(1, 1); final Display strings = lines.toDisplay(); if (strings.size() > 0) { - HorizontalAlignment defaultAlign = HorizontalAlignment.RIGHT; - if (SkinParam.USE_STYLES()) { - defaultAlign = FontParam.HEADER.getStyleDefinition() + HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT); + if (SkinParam.USE_STYLES() && align == null) { + ha = FontParam.HEADER.getStyleDefinition(null) .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) - .value(PName.HorizontalAlignment).asHorizontalAlignment(); + .getHorizontalAlignment(); } - diagram.getHeader().putDisplay(strings, HorizontalAlignment.fromString(align, defaultAlign)); + diagram.getHeader().putDisplay(strings, ha); return CommandExecutionResult.ok(); } return CommandExecutionResult.error("Empty header"); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesLegend.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesLegend.java index 5b3829b25..309df34b2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesLegend.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesLegend.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -70,7 +70,7 @@ public String getPatternEnd() { @Override protected CommandExecutionResult executeNow(TitledDiagram diagram, BlocLines lines) { lines = lines.trimSmart(1); - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final String align = line0.get("ALIGN", 0); final String valign = line0.get("VALIGN", 0); lines = lines.subExtract(1, 1); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesTitle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesTitle.java index e5c6787bc..8f6c1ceb4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesTitle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandMultilinesTitle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandNamespace.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandNamespace.java index fbacb3c5d..5bca8e07e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandNamespace.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandNamespace.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.color.ColorParser; @@ -59,7 +60,7 @@ private static IRegex getRegexConcat() { return RegexConcat.build(CommandNamespace.class.getName(), RegexLeaf.start(), // new RegexLeaf("namespace"), // RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("NAME", "([\\p{L}0-9_][\\p{L}0-9_.:\\\\]*)"), // + new RegexLeaf("NAME", "([\\p{L}0-9_][-\\p{L}0-9_.:\\\\]*)"), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), // RegexLeaf.spaceZeroOrMore(), // @@ -72,10 +73,21 @@ private static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { - final Code code = Code.of(arg.get("NAME", 0)); - final IGroup currentPackage = diagram.getCurrentGroup(); - diagram.gotoGroup2(code, Display.getWithNewlines(code), GroupType.PACKAGE, currentPackage, - NamespaceStrategy.MULTIPLE); + final String idShort = arg.get("NAME", 0); + final Code code; + final IGroup currentPackage; + final Display display; + final Ident idNewLong = diagram.buildLeafIdent(idShort); + if (diagram.V1972()) { + code = null; + currentPackage = null; + display = Display.getWithNewlines(idNewLong.getName()); + } else { + code = diagram.buildCode(idShort); + currentPackage = diagram.getCurrentGroup(); + display = Display.getWithNewlines(code); + } + diagram.gotoGroup(idNewLong, code, display, GroupType.PACKAGE, currentPackage, NamespaceStrategy.MULTIPLE); final IEntity p = diagram.getCurrentGroup(); final String stereotype = arg.get("STEREOTYPE", 0); if (stereotype != null) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandNamespace2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandNamespace2.java new file mode 100644 index 000000000..42cf4486d --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandNamespace2.java @@ -0,0 +1,112 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.command; + +import net.sourceforge.plantuml.LineLocation; +import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.UrlBuilder; +import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.classdiagram.ClassDiagram; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Code; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.cucadiagram.GroupType; +import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.IGroup; +import net.sourceforge.plantuml.cucadiagram.Ident; +import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; +import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; + +public class CommandNamespace2 extends SingleLineCommand2 { + + public CommandNamespace2() { + super(getRegexConcat()); + } + + private static IRegex getRegexConcat() { + return RegexConcat.build(CommandNamespace2.class.getName(), RegexLeaf.start(), // + new RegexLeaf("namespace"), // + RegexLeaf.spaceOneOrMore(), // + + new RegexLeaf("[%g]"), // + new RegexLeaf("DISPLAY", "([^%g]+)"), // + new RegexLeaf("[%g]"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("as"), // + RegexLeaf.spaceOneOrMore(), // + + new RegexLeaf("NAME", "([\\p{L}0-9_][-\\p{L}0-9_.:\\\\]*)"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // + RegexLeaf.spaceZeroOrMore(), // + ColorParser.exp1(), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("\\{"), RegexLeaf.end()); + } + + @Override + protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { + final String idShort = arg.get("NAME", 0); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); + final IGroup currentPackage = diagram.getCurrentGroup(); + final String disp = arg.getLazzy("DISPLAY", 0); + final Display display = Display.getWithNewlines(disp); + diagram.gotoGroup(ident, code, display, GroupType.PACKAGE, currentPackage, NamespaceStrategy.MULTIPLE); + final IEntity p = diagram.getCurrentGroup(); + final String stereotype = arg.get("STEREOTYPE", 0); + if (stereotype != null) { + p.setStereotype(new Stereotype(stereotype)); + } + + final String urlString = arg.get("URL", 0); + if (urlString != null) { + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final Url url = urlBuilder.getUrl(urlString); + p.addUrl(url); + } + + final String color = arg.get("COLOR", 0); + if (color != null) { + p.setSpecificColorTOBEREMOVED(ColorType.BACK, + diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color)); + } + return CommandExecutionResult.ok(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java new file mode 100644 index 000000000..fdda000ad --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java @@ -0,0 +1,107 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.command; + +import net.sourceforge.plantuml.LineLocation; +import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.UrlBuilder; +import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.classdiagram.ClassDiagram; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Code; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.cucadiagram.GroupType; +import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.IGroup; +import net.sourceforge.plantuml.cucadiagram.Ident; +import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; +import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; + +public class CommandNamespaceEmpty extends SingleLineCommand2 { + + public CommandNamespaceEmpty() { + super(getRegexConcat()); + } + + private static IRegex getRegexConcat() { + return RegexConcat.build(CommandNamespaceEmpty.class.getName(), RegexLeaf.start(), // + new RegexLeaf("namespace"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("NAME", "([\\p{L}0-9_][-\\p{L}0-9_.:\\\\]*)"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // + RegexLeaf.spaceZeroOrMore(), // + ColorParser.exp1(), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("\\{"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("\\}"), // + RegexLeaf.end()); + } + + @Override + protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { + final String idShort = arg.get("NAME", 0); + final Ident idNewLong = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? idNewLong : diagram.buildCode(idShort); + final IGroup currentPackage = diagram.getCurrentGroup(); + final Display display = Display.getWithNewlines(code); + diagram.gotoGroup(idNewLong, code, display, GroupType.PACKAGE, currentPackage, NamespaceStrategy.MULTIPLE); + final IEntity p = diagram.getCurrentGroup(); + final String stereotype = arg.get("STEREOTYPE", 0); + if (stereotype != null) { + p.setStereotype(new Stereotype(stereotype)); + } + + final String urlString = arg.get("URL", 0); + if (urlString != null) { + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final Url url = urlBuilder.getUrl(urlString); + p.addUrl(url); + } + + final String color = arg.get("COLOR", 0); + if (color != null) { + p.setSpecificColorTOBEREMOVED(ColorType.BACK, + diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color)); + } + diagram.endGroup(); + return CommandExecutionResult.ok(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandNope.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandNope.java index bae37e226..235d23004 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandNope.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandNope.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandPackage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandPackage.java index 9147f2ee7..08e896bcf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandPackage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandPackage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -47,6 +47,7 @@ import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; import net.sourceforge.plantuml.cucadiagram.Stereotag; import net.sourceforge.plantuml.cucadiagram.Stereotype; @@ -64,7 +65,7 @@ public CommandPackage() { private static IRegex getRegexConcat() { return RegexConcat.build(CommandPackage.class.getName(), RegexLeaf.start(), // - new RegexLeaf("TYPE", "(package|together)"), // + new RegexLeaf("TYPE", "(package)"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("NAME", "([%g][^%g]+[%g]|[^#%s{}]*)"), // new RegexOptional( // @@ -96,31 +97,42 @@ private static ColorParser color() { @Override protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) { - final Code code; - final String display; + final String idShort; + /* final */String display; final String name = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0)); + boolean override1972 = false; if (arg.get("AS", 0) == null) { if (name.length() == 0) { - code = Code.of("##" + UniqueSequence.getValue()); + idShort = "##" + UniqueSequence.getValue(); display = null; } else { - code = Code.of(name); - display = code.getFullName(); + idShort = name; + display = idShort; + override1972 = true; } } else { display = name; - code = Code.of(arg.get("AS", 0)); + idShort = arg.get("AS", 0); } final IGroup currentPackage = diagram.getCurrentGroup(); - diagram.gotoGroup2(code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage, + // final Ident ident = diagram.buildLeafIdentSpecial(idShort); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); + if (diagram.V1972() && override1972) + display = ident.getLast(); + diagram.gotoGroup(ident, code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage, NamespaceStrategy.SINGLE); final IEntity p = diagram.getCurrentGroup(); final String stereotype = arg.get("STEREOTYPE", 0); - final USymbol type = USymbol.getFromString(arg.get("TYPE", 0)); - if (type == USymbol.TOGETHER) { - p.setUSymbol(type); - } else if (stereotype != null) { - final USymbol usymbol = USymbol.getFromString(stereotype); + // final USymbol type = USymbol.getFromString(arg.get("TYPE", 0), + // diagram.getSkinParam().getActorStyle()); +// if (type == USymbol.TOGETHER) { +// p.setUSymbol(type); +// p.setThisIsTogether(); +// } else + if (stereotype != null) { + final USymbol usymbol = USymbol.fromString(stereotype, diagram.getSkinParam().actorStyle(), + diagram.getSkinParam().componentStyle(), diagram.getSkinParam().packageStyle()); if (usymbol == null) { p.setStereotype(new Stereotype(stereotype)); } else { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java index 97cd91cf9..6e3a89b1f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.utils.UniqueSequence; @@ -76,22 +77,24 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) { - final Code code; + final String idShort; final String display; if (arg.get("CODE", 0) == null) { if (StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0)).length() == 0) { - code = Code.of("##" + UniqueSequence.getValue()); + idShort = "##" + UniqueSequence.getValue(); display = null; } else { - code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0))); - display = code.getFullName(); + idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0)); + display = idShort; } } else { display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("DISPLAY", 0)); - code = Code.of(arg.get("CODE", 0)); + idShort = arg.get("CODE", 0); } final IGroup currentPackage = diagram.getCurrentGroup(); - diagram.gotoGroup2(code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage, + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); + diagram.gotoGroup(ident, code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage, NamespaceStrategy.SINGLE); final IEntity p = diagram.getCurrentGroup(); final String color = arg.get("COLOR", 0); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandPage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandPage.java index 907705a52..585317062 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandPage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandPage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandPragma.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandPragma.java index 9bfec6bba..efdb7e972 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandPragma.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandPragma.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandRankDir.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandRankDir.java index a1b655ed0..b2d803d39 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandRankDir.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandRankDir.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandRotate.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandRotate.java index 92d1c23d6..de6685593 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandRotate.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandRotate.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScale.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScale.java index aab2ee06b..4744311a4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScale.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScale.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,10 +41,6 @@ public class CommandScale extends SingleLineCommand2 { - // public CommandScale() { - // super("(?i)^$"); - // } - public CommandScale() { super(getRegexConcat()); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleMaxHeight.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleMaxHeight.java index 00fd73d1c..007ae9bdf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleMaxHeight.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleMaxHeight.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleMaxWidth.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleMaxWidth.java index 3a5287e0d..033a40fdc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleMaxWidth.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleMaxWidth.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleMaxWidthAndHeight.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleMaxWidthAndHeight.java index c7660971d..7d31e01fd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleMaxWidthAndHeight.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleMaxWidthAndHeight.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleWidthAndHeight.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleWidthAndHeight.java index 402d33a8c..aedca2386 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleWidthAndHeight.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleWidthAndHeight.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleWidthOrHeight.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleWidthOrHeight.java index c3dfdabb2..023103b30 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleWidthOrHeight.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandScaleWidthOrHeight.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandSkinParam.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandSkinParam.java index 77ce0d62d..c27eacd8b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandSkinParam.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandSkinParam.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java index a74af1861..c113225a3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -58,7 +58,7 @@ private boolean hasStartingQuote(CharSequence line) { public CommandExecutionResult execute(UmlDiagram diagram, BlocLines lines) { final SkinLoader skinLoader = new SkinLoader(diagram); - final Matcher2 mStart = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + final Matcher2 mStart = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); if (mStart.find() == false) { throw new IllegalStateException(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandSpriteFile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandSpriteFile.java index 36075fcb4..24cf49abc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandSpriteFile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandSpriteFile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,15 +30,12 @@ */ package net.sourceforge.plantuml.command; -import java.io.File; -import java.io.FileInputStream; +import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import javax.imageio.ImageIO; - import net.sourceforge.plantuml.FileSystem; import net.sourceforge.plantuml.FileUtils; import net.sourceforge.plantuml.LineLocation; @@ -48,10 +45,11 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.preproc.FileWithSuffix; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; -import net.sourceforge.plantuml.ugraphic.sprite.SpriteImage; -import net.sourceforge.plantuml.ugraphic.sprite.SpriteSvg; +import net.sourceforge.plantuml.security.ImageIO; +import net.sourceforge.plantuml.security.SFile; +import net.sourceforge.plantuml.sprite.Sprite; +import net.sourceforge.plantuml.sprite.SpriteImage; +import net.sourceforge.plantuml.sprite.SpriteSvg; public class CommandSpriteFile extends SingleLineCommand2 { @@ -64,7 +62,7 @@ private static IRegex getRegexConcat() { new RegexLeaf("sprite"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("\\$?"), // - new RegexLeaf("NAME", "([\\p{L}0-9_]+)"), // + new RegexLeaf("NAME", "([-\\p{L}0-9_]+)"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("FILE", "(.*)"), RegexLeaf.end()); } @@ -83,24 +81,32 @@ protected CommandExecutionResult executeArg(UmlDiagram system, LineLocation loca sprite = new SpriteImage(ImageIO.read(is)); } else if (src.contains("~")) { final int idx = src.lastIndexOf("~"); - final File f = FileSystem.getInstance().getFile(src.substring(0, idx)); + final SFile f = FileSystem.getInstance().getFile(src.substring(0, idx)); if (f.exists() == false) { - return CommandExecutionResult.error("File does not exist: " + src); + return CommandExecutionResult.error("Cannot read: " + src); } final String name = src.substring(idx + 1); sprite = getImageFromZip(f, name); if (sprite == null) { - return CommandExecutionResult.error("No image " + name + " in " + FileWithSuffix.getFileName(f)); + return CommandExecutionResult.error("Cannot read: " + src); } } else { - final File f = FileSystem.getInstance().getFile(src); + final SFile f = FileSystem.getInstance().getFile(src); if (f.exists() == false) { - return CommandExecutionResult.error("File does not exist: " + src); + return CommandExecutionResult.error("Cannot read: " + src); } if (isSvg(f.getName())) { - sprite = new SpriteSvg(f); + final String tmp = FileUtils.readSvg(f); + if (tmp == null) { + return CommandExecutionResult.error("Cannot read: " + src); + } + sprite = new SpriteSvg(tmp); } else { - sprite = new SpriteImage(FileUtils.ImageIO_read(f)); + final BufferedImage tmp = f.readRasterImageFromFile(); + if (tmp == null) { + return CommandExecutionResult.error("Cannot read: " + src); + } + sprite = new SpriteImage(tmp); } } } catch (IOException e) { @@ -111,10 +117,14 @@ protected CommandExecutionResult executeArg(UmlDiagram system, LineLocation loca return CommandExecutionResult.ok(); } - private Sprite getImageFromZip(File f, String name) throws IOException { + private Sprite getImageFromZip(SFile f, String name) throws IOException { + final InputStream tmp = f.openFile(); + if (tmp == null) { + return null; + } ZipInputStream zis = null; try { - zis = new ZipInputStream(new FileInputStream(f)); + zis = new ZipInputStream(tmp); ZipEntry ze = zis.getNextEntry(); while (ze != null) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandTitle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandTitle.java index 25fcc8d8e..c1769de60 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandTitle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/CommandTitle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/MultilinesStrategy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/MultilinesStrategy.java index 08d57015f..0efc50737 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/MultilinesStrategy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/MultilinesStrategy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/PSystemAbstractFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/PSystemAbstractFactory.java index 096906864..0928c0135 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/PSystemAbstractFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/PSystemAbstractFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/PSystemBasicFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/PSystemBasicFactory.java index da2a4f6b7..e88ae32a2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/PSystemBasicFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/PSystemBasicFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/PSystemSingleLineFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/PSystemSingleLineFactory.java index 70dc5f979..ff13a83c6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/PSystemSingleLineFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/PSystemSingleLineFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/Position.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/Position.java index 32109d062..56ee8144f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/Position.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/Position.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/ProtectedCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/ProtectedCommand.java index edc994e7b..c57216ae5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/ProtectedCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/ProtectedCommand.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/SingleLineCommand2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/SingleLineCommand2.java index af8691264..21dbe6926 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/SingleLineCommand2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/SingleLineCommand2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -86,9 +86,9 @@ final public CommandControl isValid(BlocLines lines) { if (isCommandForbidden()) { return CommandControl.NOT_OK; } - final StringLocated line2 = myTrim2(lines.getFirst499()); + final StringLocated line2 = myTrim2(lines.getFirst()); if (syntaxWithFinalBracket() && line2.getString().endsWith("{") == false) { - final String vline = lines.get499(0).getString() + " {"; + final String vline = lines.getAt(0).getString() + " {"; if (isValid(BlocLines.singleString(vline)) == CommandControl.OK) { return CommandControl.OK_PARTIAL; } @@ -104,10 +104,10 @@ final public CommandControl isValid(BlocLines lines) { private CommandControl isValidBracket(BlocLines lines) { assert lines.size() == 2; assert syntaxWithFinalBracket(); - if (myTrim(lines.get499(1)).equals("{") == false) { + if (myTrim(lines.getAt(1)).equals("{") == false) { return CommandControl.NOT_OK; } - final String vline = lines.get499(0).getString() + " {"; + final String vline = lines.getAt(0).getString() + " {"; return isValid(BlocLines.singleString(vline)); } @@ -120,13 +120,13 @@ protected void actionIfCommandValid() { public final CommandExecutionResult execute(S system, BlocLines lines) { if (syntaxWithFinalBracket() && lines.size() == 2) { - assert myTrim(lines.get499(1)).equals("{"); - lines = BlocLines.singleString(lines.getFirst499().getString() + " {"); + assert myTrim(lines.getAt(1)).equals("{"); + lines = BlocLines.singleString(lines.getFirst().getString() + " {"); } if (lines.size() != 1) { throw new IllegalArgumentException(); } - final StringLocated first = lines.getFirst499(); + final StringLocated first = lines.getFirst(); final String line = myTrim(first); if (isForbidden(line)) { return CommandExecutionResult.error("Syntax error: " + line); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/SkinLoader.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/SkinLoader.java index 8a3c98d04..99b6e55f0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/SkinLoader.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/SkinLoader.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -74,7 +74,7 @@ public CommandExecutionResult execute(BlocLines lines, final String group1) { } lines = lines.subExtract(1, 1); - lines = lines.trim(true); + lines = lines.trim().removeEmptyLines(); for (StringLocated s : lines) { assert s.getString().length() > 0; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java index 691a944ed..417816874 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,7 +39,6 @@ import net.sourceforge.plantuml.ErrorUml; import net.sourceforge.plantuml.ErrorUmlType; import net.sourceforge.plantuml.LineLocation; -import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.classdiagram.command.CommandHideShowByGender; import net.sourceforge.plantuml.classdiagram.command.CommandHideShowByVisibility; @@ -50,7 +49,8 @@ import net.sourceforge.plantuml.error.PSystemErrorUtils; import net.sourceforge.plantuml.sequencediagram.command.CommandSkin; import net.sourceforge.plantuml.statediagram.command.CommandHideEmptyDescription; -import net.sourceforge.plantuml.style.CommandStyleMultilines; +import net.sourceforge.plantuml.style.CommandStyleImport; +import net.sourceforge.plantuml.style.CommandStyleMultilinesCSS; import net.sourceforge.plantuml.utils.StartUtils; import net.sourceforge.plantuml.version.IteratorCounter2; @@ -123,7 +123,7 @@ private AbstractPSystem executeFewLines(AbstractPSystem sys, UmlSource source, f final CommandExecutionResult result = sys.executeCommand(step.command, step.blocLines); if (result.isOk() == false) { final ErrorUml err = new ErrorUml(ErrorUmlType.EXECUTION_ERROR, result.getError(), - ((StringLocated) step.blocLines.getFirst499()).getLocation()); + ((StringLocated) step.blocLines.getFirst()).getLocation()); sys = PSystemErrorUtils.buildV2(source, err, result.getDebugLines(), it.getTrace()); } if (result.getNewDiagram() != null) { @@ -145,7 +145,7 @@ static class Step { } private Step getCandidate(final IteratorCounter2 it) { - final BlocLines single = BlocLines.single2(it.peek()); + final BlocLines single = BlocLines.single(it.peek()); if (cmds == null) { cmds = createCommands(); } @@ -191,11 +191,11 @@ private BlocLines isMultilineCommandOk(IteratorCounter2 it, Command cmd) { private BlocLines addOneSingleLineManageEmbedded2(IteratorCounter2 it, BlocLines lines) { final StringLocated linetoBeAdded = it.next(); - lines = lines.add2(linetoBeAdded); + lines = lines.add(linetoBeAdded); if (linetoBeAdded.getTrimmed().getString().equals("{{")) { while (it.hasNext()) { final StringLocated s = it.next(); - lines = lines.add2(s); + lines = lines.add(s); if (s.getTrimmed().getString().equals("}}")) { return lines; } @@ -214,8 +214,6 @@ final protected void addCommonCommands1(List cmds) { addTitleCommands(cmds); addCommonCommands2(cmds); addCommonHides(cmds); - cmds.add(new CommandStyleMultilines()); - } final protected void addCommonCommands2(List cmds) { @@ -235,10 +233,14 @@ final protected void addCommonCommands2(List cmds) { cmds.add(new CommandScaleMaxWidthAndHeight()); cmds.add(new CommandAffineTransform()); cmds.add(new CommandAffineTransformMultiline()); - final FactorySpriteCommand factorySpriteCommand = new FactorySpriteCommand(); + final CommandFactorySprite factorySpriteCommand = new CommandFactorySprite(); cmds.add(factorySpriteCommand.createMultiLine(false)); cmds.add(factorySpriteCommand.createSingleLine()); cmds.add(new CommandSpriteFile()); + + cmds.add(new CommandStyleMultilinesCSS()); + cmds.add(new CommandStyleImport()); + } final protected void addCommonHides(List cmds) { @@ -252,6 +254,7 @@ final protected void addTitleCommands(List cmds) { cmds.add(new CommandTitle()); cmds.add(new CommandMainframe()); cmds.add(new CommandCaption()); + cmds.add(new CommandMultilinesCaption()); cmds.add(new CommandMultilinesTitle()); cmds.add(new CommandMultilinesLegend()); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandConstraintOnLinks.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandConstraintOnLinks.java new file mode 100644 index 000000000..2c5aa7491 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandConstraintOnLinks.java @@ -0,0 +1,83 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.command.note; + +import java.util.List; + +import net.sourceforge.plantuml.LineLocation; +import net.sourceforge.plantuml.command.BlocLines; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.SingleLineCommand2; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.CucaDiagram; +import net.sourceforge.plantuml.cucadiagram.Link; +import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; + +public final class CommandConstraintOnLinks extends SingleLineCommand2 { + + public CommandConstraintOnLinks() { + super(getRegexConcat()); + } + + private static IRegex getRegexConcat() { + return RegexConcat.build(CommandConstraintOnLinks.class.getName(), RegexLeaf.start(), // + new RegexLeaf("constraint"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("on"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("links"), // + RegexLeaf.spaceZeroOrMore(), // + color().getRegex(), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf(":"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("NOTE", "(.*)"), RegexLeaf.end()); + } + + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + + @Override + protected CommandExecutionResult executeArg(CucaDiagram diagram, LineLocation location, RegexResult arg) { + final List links = diagram.getTwoLastLinks(); + if (links == null) { + return CommandExecutionResult.error("Cannot put constraint on two last links"); + } + final BlocLines note = BlocLines.getWithNewlines(arg.get("NOTE", 0)); + return diagram.constraintOnLinks(links.get(0), links.get(1), note.toDisplay()); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/FactoryNoteCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandFactoryNote.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/command/note/FactoryNoteCommand.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandFactoryNote.java index 58dd1fbae..b5b9f8116 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/FactoryNoteCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandFactoryNote.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -45,15 +45,16 @@ import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotag; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; -public final class FactoryNoteCommand implements SingleMultiFactoryCommand { +public final class CommandFactoryNote implements SingleMultiFactoryCommand { private IRegex getRegexConcatMultiLine() { - return RegexConcat.build(FactoryNoteCommand.class.getName() + "multi", RegexLeaf.start(), // + return RegexConcat.build(CommandFactoryNote.class.getName() + "multi", RegexLeaf.start(), // new RegexLeaf("note"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("as"), // @@ -68,7 +69,7 @@ private IRegex getRegexConcatMultiLine() { } private IRegex getRegexConcatSingleLine() { - return RegexConcat.build(FactoryNoteCommand.class.getName() + "single", RegexLeaf.start(), // + return RegexConcat.build(CommandFactoryNote.class.getName() + "single", RegexLeaf.start(), // new RegexLeaf("note"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("[%g]"), // @@ -111,7 +112,7 @@ public String getPatternEnd() { protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines) { // StringUtils.trim(lines, false); - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); lines = lines.subExtract(1, 1); lines = lines.removeEmptyColumns(); return executeInternal(system, line0, lines); @@ -120,11 +121,14 @@ protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, } private CommandExecutionResult executeInternal(AbstractEntityDiagram diagram, RegexResult arg, BlocLines display) { - final Code code = Code.of(arg.get("CODE", 0)); - if (diagram.leafExist(code)) { - return CommandExecutionResult.error("Note already created: " + code.getFullName()); + final String idShort = arg.get("CODE", 0); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); + final boolean leafExist = diagram.V1972() ? diagram.leafExistSmart(ident) : diagram.leafExist(code); + if (leafExist) { + return CommandExecutionResult.error("Note already created: " + code.getName()); } - final IEntity entity = diagram.createLeaf(code, display.toDisplay(), LeafType.NOTE, null); + final IEntity entity = diagram.createLeaf(ident, code, display.toDisplay(), LeafType.NOTE, null); assert entity != null; entity.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/FactoryNoteActivityCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteActivity.java similarity index 81% rename from src/plantuml-asl/src/net/sourceforge/plantuml/command/note/FactoryNoteActivityCommand.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteActivity.java index 99fb88ad6..8fb813c43 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/FactoryNoteActivityCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteActivity.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -47,8 +47,10 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; @@ -57,10 +59,10 @@ import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.utils.UniqueSequence; -public final class FactoryNoteActivityCommand implements SingleMultiFactoryCommand { +public final class CommandFactoryNoteActivity implements SingleMultiFactoryCommand { private IRegex getRegexConcatMultiLine() { - return RegexConcat.build(FactoryNoteActivityCommand.class.getName() + "multi", RegexLeaf.start(), // + return RegexConcat.build(CommandFactoryNoteActivity.class.getName() + "multi", RegexLeaf.start(), // new RegexLeaf("note"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("POSITION", "(right|left|top|bottom)"), // @@ -70,7 +72,7 @@ private IRegex getRegexConcatMultiLine() { } private IRegex getRegexConcatSingleLine() { - return RegexConcat.build(FactoryNoteActivityCommand.class.getName() + "single", RegexLeaf.start(), // + return RegexConcat.build(CommandFactoryNoteActivity.class.getName() + "single", RegexLeaf.start(), // new RegexLeaf("note"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("POSITION", "(right|left|top|bottom)"), // @@ -91,9 +93,9 @@ public String getPatternEnd() { return "(?i)^[%s]*end[%s]?note$"; } - public final CommandExecutionResult executeNow(final ActivityDiagram system, BlocLines lines) { + public final CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) { // StringUtils.trim(lines, true); - final RegexResult arg = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + final RegexResult arg = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); lines = lines.subExtract(1, 1); lines = lines.removeEmptyColumns(); @@ -101,7 +103,7 @@ public final CommandExecutionResult executeNow(final ActivityDiagram system, Blo Url url = null; if (strings.size() > 0) { - final UrlBuilder urlBuilder = new UrlBuilder(system.getSkinParam().getValue("topurl"), + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); url = urlBuilder.getUrl(strings.get(0).toString()); } @@ -111,11 +113,14 @@ public final CommandExecutionResult executeNow(final ActivityDiagram system, Blo // final String s = StringUtils.getMergedLines(strings); - final IEntity note = system.createLeaf(UniqueSequence.getCode("GMN"), strings, LeafType.NOTE, null); + final String codeString = UniqueSequence.getString("GMN"); + final Ident ident = diagram.buildLeafIdent(codeString); + final Code code = diagram.V1972() ? ident : diagram.buildCode(codeString); + final IEntity note = diagram.createLeaf(ident, code, strings, LeafType.NOTE, null); if (url != null) { note.addUrl(url); } - return executeInternal(system, arg, note); + return executeInternal(diagram, arg, note); } }; } @@ -124,11 +129,13 @@ public Command createSingleLine() { return new SingleLineCommand2(getRegexConcatSingleLine()) { @Override - protected CommandExecutionResult executeArg(final ActivityDiagram system, LineLocation location, + protected CommandExecutionResult executeArg(final ActivityDiagram diagram, LineLocation location, RegexResult arg) { - final IEntity note = system.createNote(UniqueSequence.getCode("GN"), - Display.getWithNewlines(arg.get("NOTE", 0))); - return executeInternal(system, arg, note); + final String tmp = UniqueSequence.getString("GN"); + final Ident ident = diagram.buildLeafIdent(tmp); + final Code code = diagram.V1972() ? ident : diagram.buildCode(tmp); + final IEntity note = diagram.createNote(ident, code, Display.getWithNewlines(arg.get("NOTE", 0))); + return executeInternal(diagram, arg, note); } }; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/FactoryNoteOnEntityCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnEntity.java similarity index 77% rename from src/plantuml-asl/src/net/sourceforge/plantuml/command/note/FactoryNoteOnEntityCommand.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnEntity.java index 18b94d22a..178ec855e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/FactoryNoteOnEntityCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnEntity.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,6 +30,8 @@ */ package net.sourceforge.plantuml.command.note; +import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; @@ -52,28 +54,30 @@ import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.cucadiagram.Stereotag; +import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.utils.UniqueSequence; -public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryCommand { +public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryCommand { private final IRegex partialPattern; private final String key; - public FactoryNoteOnEntityCommand(String key, IRegex partialPattern) { + public CommandFactoryNoteOnEntity(String key, IRegex partialPattern) { this.partialPattern = partialPattern; this.key = key; } private IRegex getRegexConcatSingleLine(IRegex partialPattern) { - return RegexConcat.build(FactoryNoteOnEntityCommand.class.getName() + key + "single", RegexLeaf.start(), // + return RegexConcat.build(CommandFactoryNoteOnEntity.class.getName() + key + "single", RegexLeaf.start(), // new RegexLeaf("note"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("POSITION", "(right|left|top|bottom)"), // @@ -83,6 +87,8 @@ private IRegex getRegexConcatSingleLine(IRegex partialPattern) { RegexLeaf.spaceOneOrMore(), partialPattern), // new RegexLeaf("")), // RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // + RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // RegexLeaf.spaceZeroOrMore(), // color().getRegex(), // @@ -93,7 +99,7 @@ private IRegex getRegexConcatSingleLine(IRegex partialPattern) { RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("NOTE", "(.*)"), // RegexLeaf.end() // - ); + ); } private static ColorParser color() { @@ -102,7 +108,7 @@ private static ColorParser color() { private IRegex getRegexConcatMultiLine(IRegex partialPattern, final boolean withBracket) { if (withBracket) { - return RegexConcat.build(FactoryNoteOnEntityCommand.class.getName() + key + "multi" + withBracket, + return RegexConcat.build(CommandFactoryNoteOnEntity.class.getName() + key + "multi" + withBracket, RegexLeaf.start(), // new RegexLeaf("note"), // RegexLeaf.spaceOneOrMore(), // @@ -114,6 +120,8 @@ private IRegex getRegexConcatMultiLine(IRegex partialPattern, final boolean with partialPattern), // new RegexLeaf("")), // RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // + RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // RegexLeaf.spaceZeroOrMore(), // color().getRegex(), // @@ -122,9 +130,9 @@ private IRegex getRegexConcatMultiLine(IRegex partialPattern, final boolean with RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("\\{"), // RegexLeaf.end() // - ); + ); } - return RegexConcat.build(FactoryNoteOnEntityCommand.class.getName() + key + "multi" + withBracket, + return RegexConcat.build(CommandFactoryNoteOnEntity.class.getName() + key + "multi" + withBracket, RegexLeaf.start(), // new RegexLeaf("note"), // RegexLeaf.spaceOneOrMore(), // @@ -136,13 +144,15 @@ private IRegex getRegexConcatMultiLine(IRegex partialPattern, final boolean with partialPattern), // new RegexLeaf("")), // RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // + RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // RegexLeaf.spaceZeroOrMore(), // color().getRegex(), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // RegexLeaf.end() // - ); + ); } public Command createSingleLine() { @@ -171,7 +181,7 @@ public String getPatternEnd() { protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines) { // StringUtils.trim(lines, false); - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); lines = lines.subExtract(1, 1); lines = lines.removeEmptyColumns(); @@ -192,31 +202,52 @@ private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntity final String pos = line0.get("POSITION", 0); - final Code code = Code.of(line0.get("ENTITY", 0)); + final String idShort = line0.get("ENTITY", 0); final IEntity cl1; - if (code == null) { + if (idShort == null) { cl1 = diagram.getLastEntity(); if (cl1 == null) { return CommandExecutionResult.error("Nothing to note to"); } - } else if (diagram.isGroup(code)) { - cl1 = diagram.getGroup(code); } else { - cl1 = diagram.getOrCreateLeaf(code, null, null); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); + if (diagram.isGroup(code)) { + cl1 = diagram.V1972() ? diagram.getGroupStrict(ident) : diagram.getGroup(code); + } else { + if (diagram.V1972() && diagram.leafExistSmart(diagram.cleanIdent(ident))) + cl1 = diagram.getLeafSmart(diagram.cleanIdent(ident)); + else + cl1 = diagram.getOrCreateLeaf(ident, code, null, null); + } } - final IEntity note = diagram - .createLeaf(UniqueSequence.getCode("GMN"), strings.toDisplay(), LeafType.NOTE, null); + final String tmp = UniqueSequence.getString("GMN"); + final Ident idNewLong = diagram.buildLeafIdent(tmp); + final IEntity note; + if (diagram.V1972()) + note = diagram.createLeaf(idNewLong, idNewLong, strings.toDisplay(), LeafType.NOTE, null); + else + note = diagram.createLeaf(idNewLong, diagram.buildCode(tmp), strings.toDisplay(), LeafType.NOTE, null); + + Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet()); + + final String stereotypeString = line0.get("STEREO", 0); + if (stereotypeString != null) { + final Stereotype stereotype = new Stereotype(stereotypeString); + colors = colors.applyStereotypeForNote(stereotype, diagram.getSkinParam(), FontParam.NOTE, + ColorParam.noteBackground, ColorParam.noteBorder); + note.setStereotype(stereotype); + } - final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet()); note.setColors(colors); if (url != null) { note.addUrl(url); } CommandCreateClassMultilines.addTags(note, line0.get("TAGS", 0)); - final Position position = Position.valueOf(StringUtils.goUpperCase(pos)).withRankdir( - diagram.getSkinParam().getRankdir()); + final Position position = Position.valueOf(StringUtils.goUpperCase(pos)) + .withRankdir(diagram.getSkinParam().getRankdir()); final Link link; final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).goDashed(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/FactoryNoteOnLinkCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnLink.java similarity index 93% rename from src/plantuml-asl/src/net/sourceforge/plantuml/command/note/FactoryNoteOnLinkCommand.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnLink.java index c1175f50b..0dcc6cdd5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/FactoryNoteOnLinkCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnLink.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -52,10 +52,10 @@ import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; -public final class FactoryNoteOnLinkCommand implements SingleMultiFactoryCommand { +public final class CommandFactoryNoteOnLink implements SingleMultiFactoryCommand { private IRegex getRegexConcatSingleLine() { - return RegexConcat.build(FactoryNoteOnLinkCommand.class.getName() + "single", RegexLeaf.start(), // + return RegexConcat.build(CommandFactoryNoteOnLink.class.getName() + "single", RegexLeaf.start(), // new RegexLeaf("note"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("POSITION", "(right|left|top|bottom)?"), // @@ -72,7 +72,7 @@ private IRegex getRegexConcatSingleLine() { } private IRegex getRegexConcatMultiLine() { - return RegexConcat.build(FactoryNoteOnLinkCommand.class.getName() + "multi", RegexLeaf.start(), // + return RegexConcat.build(CommandFactoryNoteOnLink.class.getName() + "multi", RegexLeaf.start(), // new RegexLeaf("note"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("POSITION", "(right|left|top|bottom)?"), // @@ -97,7 +97,7 @@ public String getPatternEnd() { } protected CommandExecutionResult executeNow(final CucaDiagram system, BlocLines lines) { - final String line0 = lines.getFirst499().getTrimmed().getString(); + final String line0 = lines.getFirst().getTrimmed().getString(); lines = lines.subExtract(1, 1); lines = lines.removeEmptyColumns(); if (lines.size() > 0) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/FactoryTipOnEntityCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandFactoryTipOnEntity.java similarity index 84% rename from src/plantuml-asl/src/net/sourceforge/plantuml/command/note/FactoryTipOnEntityCommand.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandFactoryTipOnEntity.java index 3e2350cad..1a0facbc7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/FactoryTipOnEntityCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/CommandFactoryTipOnEntity.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -48,25 +48,26 @@ import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.graphic.color.ColorParser; -public final class FactoryTipOnEntityCommand implements SingleMultiFactoryCommand { +public final class CommandFactoryTipOnEntity implements SingleMultiFactoryCommand { private final IRegex partialPattern; private final String key; - public FactoryTipOnEntityCommand(String key, IRegex partialPattern) { + public CommandFactoryTipOnEntity(String key, IRegex partialPattern) { this.partialPattern = partialPattern; this.key = key; } private RegexConcat getRegexConcatMultiLine(IRegex partialPattern, final boolean withBracket) { if (withBracket) { - return RegexConcat.build(FactoryTipOnEntityCommand.class.getName() + key + withBracket, RegexLeaf.start(), // + return RegexConcat.build(CommandFactoryTipOnEntity.class.getName() + key + withBracket, RegexLeaf.start(), // new RegexLeaf("note"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("POSITION", "(right|left)"), // @@ -83,7 +84,7 @@ private RegexConcat getRegexConcatMultiLine(IRegex partialPattern, final boolean RegexLeaf.end() // ); } - return RegexConcat.build(FactoryTipOnEntityCommand.class.getName() + key + withBracket, RegexLeaf.start(), // + return RegexConcat.build(CommandFactoryTipOnEntity.class.getName() + key + withBracket, RegexLeaf.start(), // new RegexLeaf("note"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("POSITION", "(right|left)"), // @@ -117,7 +118,7 @@ public String getPatternEnd() { protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines) { // StringUtils.trim(lines, false); - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); lines = lines.subExtract(1, 1); lines = lines.removeEmptyColumns(); @@ -138,19 +139,22 @@ private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntity final String pos = line0.get("POSITION", 0); - final Code code = Code.of(line0.get("ENTITY", 0)); + final String idShort = line0.get("ENTITY", 0); + final Ident identShort = diagram.buildLeafIdent(idShort); + final Code codeShort = diagram.V1972() ? identShort : diagram.buildCode(idShort); final String member = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("ENTITY", 1)); - if (code == null) { + if (codeShort == null) { + assert false; return CommandExecutionResult.error("Nothing to note to"); } - final IEntity cl1 = diagram.getOrCreateLeaf(code, null, null); + final IEntity cl1 = diagram.getOrCreateLeaf(identShort, codeShort, null, null); final Position position = Position.valueOf(StringUtils.goUpperCase(pos)).withRankdir( diagram.getSkinParam().getRankdir()); - final Code codeTip = code.addSuffix("$$$" + position.name()); - IEntity tips = diagram.getLeafsget(codeTip); + final Ident identTip = diagram.buildLeafIdent(idShort + "$$$" + position.name()); + IEntity tips = diagram.getLeafStrict(identTip); if (tips == null) { - tips = diagram.getOrCreateLeaf(codeTip, LeafType.TIPS, null); + tips = diagram.getOrCreateLeaf(identTip, identTip.toCode(diagram), LeafType.TIPS, null); final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getInvisible(); final Link link; if (position == Position.RIGHT) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/SingleMultiFactoryCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/SingleMultiFactoryCommand.java index b1b68089e..fba5d1105 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/SingleMultiFactoryCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/SingleMultiFactoryCommand.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteAcrossCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteAcrossCommand.java index e8d67ba8c..6c1d3cd11 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteAcrossCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteAcrossCommand.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -122,7 +122,7 @@ public String getPatternEnd() { } protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines) { - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); lines = lines.subExtract(1, 1); lines = lines.removeEmptyColumns(); return executeInternal(system, line0, lines); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java index 759c14317..08f28218c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -115,7 +115,7 @@ public String getPatternEnd() { } protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines) { - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); lines = lines.subExtract(1, 1); lines = lines.removeEmptyColumns(); return executeInternal(system, line0, lines); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java index 567834605..c442e3052 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -50,7 +50,6 @@ import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; @@ -61,6 +60,7 @@ import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteStyle; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFactoryCommand { @@ -71,7 +71,7 @@ private IRegex getRegexConcatMultiLine() { RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("POSITION", "(right|left)"), // + new RegexLeaf("POSITION", "(right|left|bottom|top)"), // RegexLeaf.spaceZeroOrMore(), // ColorParser.exp1(), // RegexLeaf.spaceZeroOrMore(), // @@ -85,7 +85,7 @@ private IRegex getRegexConcatSingleLine() { RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("POSITION", "(right|left)"), // + new RegexLeaf("POSITION", "(right|left|bottom|top)"), // RegexLeaf.spaceZeroOrMore(), // ColorParser.exp1(), // RegexLeaf.spaceZeroOrMore(), // @@ -118,7 +118,7 @@ public String getPatternEnd() { } protected CommandExecutionResult executeNow(final SequenceDiagram diagram, BlocLines lines) { - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); lines = lines.subExtract(1, 1); lines = lines.removeEmptyColumns(); return executeInternal(diagram, line0, lines); @@ -140,7 +140,7 @@ private CommandExecutionResult executeInternal(SequenceDiagram diagram, final Re final NoteStyle style = NoteStyle.getNoteStyle(line0.get("STYLE", 0)); final Display display = diagram.manageVariable(lines.toDisplay()); final String backcolor0 = line0.get("COLOR", 0); - Colors colors = Colors.empty().add(ColorType.BACK, HtmlColorSet.getInstance().getColorIfValid(backcolor0)); + Colors colors = Colors.empty().add(ColorType.BACK, HColorSet.instance().getColorIfValid(backcolor0)); final Note note = new Note(display, position, style, diagram.getSkinParam().getCurrentStyleBuilder()); final String stereotypeString = line0.get("STEREO", 0); if (stereotypeString != null) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java index 7c933fd7f..258b1ff89 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -62,6 +62,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF private IRegex getRegexConcatMultiLine() { return RegexConcat.build(FactorySequenceNoteOverSeveralCommand.class.getName() + "multi", RegexLeaf.start(), // + new RegexLeaf("PARALLEL", "(&[%s]*)?"), // new RegexLeaf("VMERGE", "(/)?"), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STYLE", "(note|hnote|rnote)"), // @@ -84,6 +85,7 @@ private IRegex getRegexConcatMultiLine() { private IRegex getRegexConcatSingleLine() { return RegexConcat.build(FactorySequenceNoteOverSeveralCommand.class.getName() + "single", RegexLeaf.start(), // + new RegexLeaf("PARALLEL", "(&[%s]*)?"), // new RegexLeaf("VMERGE", "(/)?"), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STYLE", "(note|hnote|rnote)"), // @@ -135,7 +137,7 @@ public String getPatternEnd() { } protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines) { - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); lines = lines.subExtract(1, 1); lines = lines.removeEmptyColumns(); return executeInternal(system, line0, lines); @@ -152,6 +154,7 @@ private CommandExecutionResult executeInternal(SequenceDiagram diagram, final Re if (lines.size() > 0) { final boolean tryMerge = line0.get("VMERGE", 0) != null; + final boolean parallel = line0.get("PARALLEL", 0) != null; final Display display = diagram.manageVariable(lines.toDisplay()); final Note note = new Note(p1, p2, display, diagram.getSkinParam().getCurrentStyleBuilder()); Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet()); @@ -171,6 +174,9 @@ private CommandExecutionResult executeInternal(SequenceDiagram diagram, final Re final Url urlLink = urlBuilder.getUrl(line0.get("URL", 0)); note.setUrl(urlLink); } + if (parallel) { + note.goParallel(); + } diagram.addNote(note, tryMerge); } return CommandExecutionResult.ok(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/FoxSignature.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/FoxSignature.java index 8bacfcb18..d6fe2bb04 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/FoxSignature.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/FoxSignature.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/IRegex.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/IRegex.java index 5eee613ec..e6dafe4b5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/IRegex.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/IRegex.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/Matcher2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/Matcher2.java index 5ddc2ca32..58a2df56c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/Matcher2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/Matcher2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -52,7 +52,8 @@ public static Matcher2 build(Pattern pattern, CharSequence input) { final long now = System.currentTimeMillis(); final String id = pattern.pattern(); try { - return new Matcher2(pattern.matcher(input), id); + final Matcher matcher2 = pattern.matcher(input); + return new Matcher2(matcher2, id); } finally { if (INSTRUMENT) { addTime(id, System.currentTimeMillis() - now); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/MatcherIterator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/MatcherIterator.java index cbba525f0..ee1b708f8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/MatcherIterator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/MatcherIterator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/MyPattern.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/MyPattern.java index 4ba1a5f4e..37202cad9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/MyPattern.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/MyPattern.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -56,27 +56,7 @@ public static Pattern2 cmpileNockeck(String p, int type) { } private static String transformAndCheck(String p) { - // if (p.contains("\\s")) { - // Thread.dumpStack(); - // System.err.println(p); - // System.exit(0); - // } - // if (p.contains("'")) { - // Thread.dumpStack(); - // System.err.println(p); - // System.exit(0); - // } - // if (p.contains("\"")) { - // Thread.dumpStack(); - // System.err.println(p); - // System.exit(0); - // } p = transform(p); - // if (p.contains(" ") || p.contains("%")) { - // Thread.dumpStack(); - // System.err.println(p); - // System.exit(0); - // } return p; } @@ -88,10 +68,6 @@ private static String transform(String p) { return p; } - // public static boolean mtches(String input, String regex) { - // return cmpile(regex).matcher(input).matches(); - // } - // public static boolean mtches(CharSequence input, String regex) { return cmpile(regex).matcher(input).matches(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/Pattern2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/Pattern2.java index 4e1044cb2..93a2ffe54 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/Pattern2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/Pattern2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexComposed.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexComposed.java index d272a00d2..d51661c5b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexComposed.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexComposed.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,11 +31,13 @@ package net.sourceforge.plantuml.command.regex; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; import java.util.regex.Pattern; import net.sourceforge.plantuml.StringLocated; @@ -43,26 +45,32 @@ public abstract class RegexComposed implements IRegex { protected static final AtomicInteger nbCreateMatches = new AtomicInteger(); - protected final List partials; + private final List partials; + + protected final List partials() { + return partials; + } abstract protected String getFullSlow(); - private Pattern2 fullCached; + private final AtomicReference fullCached = new AtomicReference(); - private synchronized Pattern2 getPattern2() { - if (fullCached == null) { + private Pattern2 getPattern2() { + Pattern2 result = fullCached.get(); + if (result == null) { final String fullSlow = getFullSlow(); - fullCached = MyPattern.cmpile(fullSlow, Pattern.CASE_INSENSITIVE); + result = MyPattern.cmpile(fullSlow, Pattern.CASE_INSENSITIVE); + fullCached.set(result); } - return fullCached; + return result; } - - protected boolean isCompiled() { - return fullCached != null; + + final protected boolean isCompiled() { + return fullCached.get() != null; } public RegexComposed(IRegex... partial) { - this.partials = Arrays.asList(partial); + this.partials = Collections.unmodifiableList(Arrays.asList(partial)); } public Map createPartialMatch(Iterator it) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexConcat.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexConcat.java index 796a5734f..84d723e33 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexConcat.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexConcat.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,13 +37,11 @@ import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.StringLocated; -public class RegexConcat extends RegexComposed implements IRegex { +public final class RegexConcat extends RegexComposed implements IRegex { private static final ConcurrentMap cache = new ConcurrentHashMap(); private final AtomicLong foxRegex = new AtomicLong(-1L); - private boolean invoked; - // private static final Set PRINTED2 = new HashSet(); public static void printCacheInfo() { @@ -53,7 +51,7 @@ public static void printCacheInfo() { if (reg.isCompiled()) { nbCompiled++; } - if (reg.invoked) { + if (reg.invoked()) { nbInvoked++; } } @@ -68,8 +66,8 @@ public RegexConcat(IRegex... partials) { private long foxRegex() { if (foxRegex.get() == -1L) { long tmp = 0L; - for (int i = 1; i < partials.size() - 1; i++) { - final IRegex part = partials.get(i); + for (int i = 1; i < partials().size() - 1; i++) { + final IRegex part = partials().get(i); if (part instanceof RegexLeaf) { final RegexLeaf leaf = (RegexLeaf) part; tmp = tmp | leaf.getFoxSignature(); @@ -104,9 +102,12 @@ private static RegexConcat buildInternal(IRegex... partials) { return result; } + private boolean invoked() { + return foxRegex.get() != -1L; + } + @Override public boolean match(StringLocated s) { - invoked = true; final long foxRegex = foxRegex(); if (foxRegex != 0L) { final long foxLine = s.getFoxSignature(); @@ -124,7 +125,7 @@ public boolean match(StringLocated s) { @Override protected String getFullSlow() { final StringBuilder sb = new StringBuilder(); - for (IRegex p : partials) { + for (IRegex p : partials()) { sb.append(p.getPattern()); } return sb.toString(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexLeaf.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexLeaf.java index e78e92fbd..efb4d9094 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexLeaf.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexLeaf.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -72,17 +72,6 @@ public static RegexLeaf end() { public RegexLeaf(String name, String regex) { this.pattern = regex; this.name = name; - // unknow=(left[%s]to[%s]right|top[%s]to[%s]bottom) - // unknow=is off on - // unknow=(-+)\> - // unknow=\[([^\[\]]+?)\] - // unknow=([*]+) - - // if (regex.equals("([*]+)") || regex.equals("\\[([^\\[\\]]+?)\\]") || regex.equals("(-+)\\>") - // || regex.equals("is off on")) { - // Thread.dumpStack(); - // System.exit(0); - // } } @Override diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexOptional.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexOptional.java index a4b885131..dad428c88 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexOptional.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexOptional.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,7 +41,7 @@ public RegexOptional(IRegex partial) { @Override protected String getFullSlow() { final StringBuilder sb = new StringBuilder("(?:"); - sb.append(partials.get(0).getPattern()); + sb.append(partials().get(0).getPattern()); sb.append(")?"); return sb.toString(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexOr.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexOr.java index 099892f52..1b8bbc960 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexOr.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexOr.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -55,7 +55,7 @@ protected String getFullSlow() { if (name == null) { sb.append("?:"); } - for (IRegex p : partials) { + for (IRegex p : partials()) { sb.append(p.getPattern()); sb.append("|"); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexPartialMatch.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexPartialMatch.java index d08571cec..1e1580511 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexPartialMatch.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexPartialMatch.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexResult.java b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexResult.java index 0c6f2adb9..6914b1c50 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexResult.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/command/regex/RegexResult.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/CompositeDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/CompositeDiagram.java index c1a58bfba..56d7839df 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/CompositeDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/CompositeDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,6 +35,7 @@ import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.graphic.USymbol; @@ -45,14 +46,16 @@ public CompositeDiagram(ISkinSimple skinParam) { } @Override - public IEntity getOrCreateLeaf(Code code, LeafType type, USymbol symbol) { + public IEntity getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) { + checkNotNull(ident); + // final Ident idNewLong = buildLeafIdent(id); if (type == null) { if (isGroup(code)) { return getGroup(code); } - return getOrCreateLeafDefault(code, LeafType.BLOCK, symbol); + return getOrCreateLeafDefault(ident, code, LeafType.BLOCK, symbol); } - return getOrCreateLeafDefault(code, type, symbol); + return getOrCreateLeafDefault(ident, code, type, symbol); } @Override diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/CompositeDiagramFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/CompositeDiagramFactory.java index f3c12d081..3fb627fc4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/CompositeDiagramFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/CompositeDiagramFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/command/CommandCreateBlock.java b/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/command/CommandCreateBlock.java index f9c617993..f540b2246 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/command/CommandCreateBlock.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/command/CommandCreateBlock.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -66,11 +66,12 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) { String display = arg.get("DISPLAY", 0); - final Code code = Code.of(arg.get("CODE", 0)); + final String idShort = arg.get("CODE", 0); + final Code code = diagram.buildCode(idShort); if (display == null) { - display = code.getFullName(); + display = code.getName(); } - final IEntity ent = diagram.getOrCreateLeaf(code, null, null); + final IEntity ent = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), code, null, null); ent.setDisplay(Display.getWithNewlines(display)); return CommandExecutionResult.ok(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/command/CommandCreatePackageBlock.java b/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/command/CommandCreatePackageBlock.java index f21e30c93..2a8b15ccf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/command/CommandCreatePackageBlock.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/command/CommandCreatePackageBlock.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IGroup; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; public class CommandCreatePackageBlock extends SingleLineCommand2 { @@ -70,11 +71,13 @@ static IRegex getRegexConcat() { protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) { final IGroup currentPackage = diagram.getCurrentGroup(); String display = arg.get("DISPLAY", 0); - final Code code = Code.of(arg.get("CODE", 0)); + final String idShort = arg.get("CODE", 0); + final Code code = diagram.buildCode(idShort); if (display == null) { - display = code.getFullName(); + display = code.getName(); } - diagram.gotoGroup2(code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage, + final Ident idNewLong = diagram.buildLeafIdent(idShort); + diagram.gotoGroup(idNewLong, code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage, NamespaceStrategy.SINGLE); return CommandExecutionResult.ok(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/command/CommandEndPackageBlock.java b/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/command/CommandEndPackageBlock.java index 58dc24fe9..034ace37d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/command/CommandEndPackageBlock.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/command/CommandEndPackageBlock.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/command/CommandLinkBlock.java b/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/command/CommandLinkBlock.java index a10604e2f..ea4f08a6e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/command/CommandLinkBlock.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/compositediagram/command/CommandLinkBlock.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,7 +39,6 @@ import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.compositediagram.CompositeDiagram; -import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.Link; @@ -72,8 +71,12 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocation location, RegexResult arg) { - final IEntity cl1 = diagram.getOrCreateLeaf(Code.of(arg.get("ENT1", 0)), null, null); - final IEntity cl2 = diagram.getOrCreateLeaf(Code.of(arg.get("ENT2", 0)), null, null); + final String ent1 = arg.get("ENT1", 0); + final String ent2 = arg.get("ENT2", 0); + final IEntity cl1 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(ent1), + diagram.buildCode(ent1), null, null); + final IEntity cl2 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(ent2), + diagram.buildCode(ent2), null, null); final String deco1 = arg.get("DECO1", 0); final String deco2 = arg.get("DECO2", 0); @@ -87,7 +90,8 @@ protected CommandExecutionResult executeArg(CompositeDiagram diagram, LineLocati final String queue = arg.get("QUEUE", 0); - final Link link = new Link(cl1, cl2, linkType, Display.getWithNewlines(arg.get("DISPLAY", 0)), queue.length(), diagram.getSkinParam().getCurrentStyleBuilder()); + final Link link = new Link(cl1, cl2, linkType, Display.getWithNewlines(arg.get("DISPLAY", 0)), queue.length(), + diagram.getSkinParam().getCurrentStyleBuilder()); diagram.addLink(link); return CommandExecutionResult.ok(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/core/Diagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/core/Diagram.java index 9c9612712..6f2d49b6d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/core/Diagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/core/Diagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/core/DiagramDescription.java b/src/plantuml-asl/src/net/sourceforge/plantuml/core/DiagramDescription.java index 85ddbe01c..f00ca3507 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/core/DiagramDescription.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/core/DiagramDescription.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/core/DiagramType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/core/DiagramType.java index 03198967e..752f4fc4b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/core/DiagramType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/core/DiagramType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,13 +33,16 @@ import net.sourceforge.plantuml.utils.StartUtils; public enum DiagramType { - UML, BPM, DITAA, DOT, PROJECT, JCCKIT, SALT, FLOW, CREOLE, JUNGLE, CUTE, MATH, LATEX, DEFINITION, GANTT, NW, MINDMAP, WBS, UNKNOWN; + UML, BPM, DITAA, DOT, PROJECT, JCCKIT, SALT, FLOW, CREOLE, JUNGLE, CUTE, MATH, LATEX, DEFINITION, GANTT, NW, MINDMAP, WBS, WIRE, UNKNOWN; static public DiagramType getTypeFromArobaseStart(String s) { s = s.toLowerCase(); // if (s.startsWith("@startuml2")) { // return UML2; // } + if (StartUtils.startsWithSymbolAnd("startwire", s)) { + return WIRE; + } if (StartUtils.startsWithSymbolAnd("startbpm", s)) { return BPM; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/core/ImageData.java b/src/plantuml-asl/src/net/sourceforge/plantuml/core/ImageData.java index 8b50a5372..d5b22556c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/core/ImageData.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/core/ImageData.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/core/UmlSource.java b/src/plantuml-asl/src/net/sourceforge/plantuml/core/UmlSource.java index 1aef79ceb..7eb36651c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/core/UmlSource.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/core/UmlSource.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -48,8 +48,8 @@ import net.sourceforge.plantuml.version.IteratorCounter2Impl; /** - * Represents the textual source of some diagram. The source should start with a @startfoo and end with - * @endfoo. + * Represents the textual source of some diagram. The source should start with a + * @startfoo and end with @endfoo. *

* So the diagram does not have to be a UML one. * @@ -59,6 +59,7 @@ final public class UmlSource { final private List source; + final private List rawSource; public UmlSource removeInitialSkinparam() { if (hasInitialSkinparam(source) == false) { @@ -68,7 +69,7 @@ public UmlSource removeInitialSkinparam() { while (hasInitialSkinparam(copy)) { copy.remove(1); } - return new UmlSource(copy); + return new UmlSource(copy, rawSource); } public boolean containsIgnoreCase(String searched) { @@ -81,23 +82,29 @@ public boolean containsIgnoreCase(String searched) { } private static boolean hasInitialSkinparam(final List copy) { - return copy.size() > 1 && (copy.get(1).getString().startsWith("skinparam ") || copy.get(1).getString().startsWith("skinparamlocked ")); + return copy.size() > 1 && (copy.get(1).getString().startsWith("skinparam ") + || copy.get(1).getString().startsWith("skinparamlocked ")); } - private UmlSource(List source) { + private UmlSource(List source, List rawSource) { this.source = source; + this.rawSource = rawSource; + } + + public UmlSource(List data, boolean checkEndingBackslash) { + this(data, checkEndingBackslash, new ArrayList()); } /** * Build the source from a text. * - * @param data - * the source of the diagram - * @param checkEndingBackslash - * true if an ending backslash means that a line has to be collapsed with the following one. + * @param data the source of the diagram + * @param checkEndingBackslash true if an ending backslash means + * that a line has to be collapsed with the + * following one. */ - public UmlSource(List data, boolean checkEndingBackslash) { - this(new ArrayList()); + public UmlSource(List data, boolean checkEndingBackslash, List rawSource) { + this(new ArrayList(), rawSource); if (checkEndingBackslash) { final StringBuilder pending = new StringBuilder(); @@ -117,7 +124,8 @@ public UmlSource(List data, boolean checkEndingBackslash) { } /** - * Retrieve the type of the diagram. This is based on the first line @startfoo. + * Retrieve the type of the diagram. This is based on the first line + * @startfoo. * * @return the type of the diagram. */ @@ -149,6 +157,16 @@ public String getPlainString() { return sb.toString(); } + public String getRawString() { + final StringBuilder sb = new StringBuilder(); + for (StringLocated s : rawSource) { + sb.append(s.getString()); + sb.append('\r'); + sb.append(BackSlash.CHAR_NEWLINE); + } + return sb.toString(); + } + public long seed() { long h = 1125899906842597L; // prime final String string = getPlainString(); @@ -179,7 +197,8 @@ public int getTotalLineCount() { } /** - * Check if a source diagram description is empty. Does not take comment line into account. + * Check if a source diagram description is empty. Does not take comment line + * into account. * * @return true if the diagram does not contain information. */ @@ -202,7 +221,8 @@ public boolean isEmpty() { } /** - * Retrieve the title, if defined in the diagram source. Never return null. + * Retrieve the title, if defined in the diagram source. Never return + * null. * * @return */ diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleContext.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleContext.java index e0d02c9e6..048232685 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleContext.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleContext.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleHorizontalLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleHorizontalLine.java index e94f4972d..aecd9a9aa 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleHorizontalLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleHorizontalLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,6 +35,8 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; +import net.sourceforge.plantuml.creole.atom.AbstractAtom; +import net.sourceforge.plantuml.creole.atom.Atom; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; @@ -76,16 +78,17 @@ private TextBlock getTitle() { if (line.length() == 0) { return TextBlockUtils.empty(0, 0); } - final CreoleParser parser = new CreoleParser(fontConfiguration, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL); + final SheetBuilder parser = Parser.build(fontConfiguration, HorizontalAlignment.LEFT, skinParam, + CreoleMode.FULL); final Sheet sheet = parser.createSheet(Display.getWithNewlines(line)); final TextBlock tb = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()); return tb; } public void drawU(UGraphic ug) { - // ug = ug.apply(new UChangeColor(fontConfiguration.getColor())); + // ug = ug.apply(UChangeColor.nnn(fontConfiguration.getColor())); final Dimension2D dim = calculateDimension(ug.getStringBounder()); - ug = ug.apply(new UTranslate(0, dim.getHeight() / 2)); + ug = ug.apply(UTranslate.dy(dim.getHeight() / 2)); ug.draw(getHorizontalLine()); } @@ -100,5 +103,5 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { public double getStartingAltitude(StringBounder stringBounder) { return 0; } - + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleMode.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleMode.java index 12dc2aa8d..142badcac 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleMode.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleMode.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Fission.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Fission.java index 273d323c7..c01748ddd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Fission.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Fission.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,6 +38,9 @@ import java.util.List; import net.sourceforge.plantuml.LineBreakStrategy; +import net.sourceforge.plantuml.creole.atom.AbstractAtom; +import net.sourceforge.plantuml.creole.atom.Atom; +import net.sourceforge.plantuml.creole.legacy.AtomText; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -62,7 +65,7 @@ public List getSplitted2(StringBounder stringBounder) { return Arrays.asList(stripe); } final List result = new ArrayList(); - StripeSimple current = new StripeSimple(stripe.getHeader()); + StripeSimpleInternal current = new StripeSimpleInternal(stripe.getLHeader()); double remainingSpace = valueMaxWidth; for (Atom atom : noHeader()) { while (true) { @@ -73,7 +76,7 @@ public List getSplitted2(StringBounder stringBounder) { remainingSpace -= widthPart1; if (remainingSpace <= 0) { result.add(current); - current = new StripeSimple(blank(stripe.getHeader())); + current = new StripeSimpleInternal(blank(stripe.getLHeader())); remainingSpace = valueMaxWidth; } if (splitInTwo.size() == 1) { @@ -83,7 +86,7 @@ public List getSplitted2(StringBounder stringBounder) { if (remainingSpace < valueMaxWidth && atom.calculateDimension(stringBounder).getWidth() > remainingSpace) { result.add(current); - current = new StripeSimple(blank(stripe.getHeader())); + current = new StripeSimpleInternal(blank(stripe.getLHeader())); remainingSpace = valueMaxWidth; } } @@ -102,13 +105,13 @@ public List getSplitted(StringBounder stringBounder) { return Arrays.asList(stripe); } final List result = new ArrayList(); - StripeSimple current = new StripeSimple(stripe.getHeader()); + StripeSimpleInternal current = new StripeSimpleInternal(stripe.getLHeader()); for (Atom atom : noHeader()) { for (Atom atomSplitted : getSplitted(stringBounder, atom)) { final double width = atomSplitted.calculateDimension(stringBounder).getWidth(); if (current.totalWidth + width > valueMaxWidth) { result.add(current); - current = new StripeSimple(blank(stripe.getHeader())); + current = new StripeSimpleInternal(blank(stripe.getLHeader())); } current.addAtom(atomSplitted, width); } @@ -121,7 +124,7 @@ public List getSplitted(StringBounder stringBounder) { private List noHeader() { final List atoms = stripe.getAtoms(); - if (stripe.getHeader() == null) { + if (stripe.getLHeader() == null) { return atoms; } return atoms.subList(1, atoms.size()); @@ -154,21 +157,12 @@ private Collection getSplitted(StringBounder stringBounder, Atom return Collections.singleton(atom); } - // private List getSplittedSimple() { - // final StripeSimple result = new StripeSimple(); - // for (Atom atom : stripe.getAtoms1()) { - // result.addAtom(atom, 0); - // - // } - // return Arrays.asList((Stripe) result); - // } - - static class StripeSimple implements Stripe { + static class StripeSimpleInternal implements Stripe { private final List atoms = new ArrayList(); private double totalWidth; - private StripeSimple(Atom header) { + private StripeSimpleInternal(Atom header) { if (header != null) { this.atoms.add(header); } @@ -183,7 +177,7 @@ private void addAtom(Atom atom, double width) { this.totalWidth += width; } - public Atom getHeader() { + public Atom getLHeader() { return null; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Parser.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Parser.java new file mode 100644 index 000000000..0ba6433ce --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Parser.java @@ -0,0 +1,85 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.creole; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.creole.legacy.CreoleParser; +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; + +public class Parser { + + public static final String MONOSPACED = "monospaced"; + + public static SheetBuilder build(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, + ISkinSimple skinParam, CreoleMode creoleMode) { + final FontConfiguration stereotype = fontConfiguration.forceFont(null, null); + return new CreoleParser(fontConfiguration, horizontalAlignment, skinParam, creoleMode, stereotype); + } + + public static SheetBuilder build(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, + ISkinSimple skinParam, CreoleMode creoleMode, FontConfiguration stereotype) { + return new CreoleParser(fontConfiguration, horizontalAlignment, skinParam, creoleMode, stereotype); + } + + public static boolean isTreeStart(String line) { + // return false; + return line.startsWith("|_"); + } + + public static double getScale(String s, double def) { + if (s == null) { + return def; + } + final Pattern p = Pattern.compile("(?:scale=|\\*)([0-9.]+)"); + final Matcher m = p.matcher(s); + if (m.find()) { + return Double.parseDouble(m.group(1)); + } + return def; + } + + public static String getColor(String s) { + if (s == null) { + return null; + } + final Pattern p = Pattern.compile("color[= :](#[0-9a-fA-F]{6}|\\w+)"); + final Matcher m = p.matcher(s); + if (m.find()) { + return m.group(1); + } + return null; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Position.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Position.java index 832f3c67f..50a73db96 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Position.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Position.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,13 +32,12 @@ import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.ugraphic.MinMax; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class Position { @@ -93,8 +92,7 @@ public MinMax update(MinMax minMax) { } public void drawDebug(UGraphic ug) { - // ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(HtmlColorUtils.LIGHT_GRAY)); - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(null)); + ug = ug.apply(HColorUtils.BLACK).apply(new HColorNone().bg()); ug = ug.apply(new UTranslate(x, y)); ug.draw(new URectangle(dim)); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Sea.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Sea.java index a6f0d0cec..edb3be150 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Sea.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Sea.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,6 +34,7 @@ import java.util.HashMap; import java.util.Map; +import net.sourceforge.plantuml.creole.atom.Atom; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.MinMax; @@ -44,6 +45,9 @@ public class Sea { private final StringBounder stringBounder; public Sea(StringBounder stringBounder) { + if (stringBounder == null) { + throw new IllegalArgumentException(); + } this.stringBounder = stringBounder; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Sheet.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Sheet.java index e4e9830ec..1a3f42836 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Sheet.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Sheet.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -44,7 +44,7 @@ public class Sheet implements Iterable { public Sheet(HorizontalAlignment horizontalAlignment) { this.horizontalAlignment = horizontalAlignment; } - + @Override public String toString() { return stripes.toString(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/SheetBlock1.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/SheetBlock1.java index 3a3373f20..4fcb4e0b7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/SheetBlock1.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/SheetBlock1.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,6 +39,8 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.LineBreakStrategy; +import net.sourceforge.plantuml.creole.atom.Atom; +import net.sourceforge.plantuml.creole.legacy.StripeSimple; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.InnerStrategy; @@ -53,7 +55,7 @@ public class SheetBlock1 extends AbstractTextBlock implements TextBlock, Atom, S public List splitInTwo(StringBounder stringBounder, double width) { throw new UnsupportedOperationException(getClass().toString()); } - + private final Sheet sheet; private List stripes; private Map heights; @@ -71,7 +73,7 @@ public SheetBlock1(Sheet sheet, LineBreakStrategy maxWidth, double padding) { throw new IllegalArgumentException(); } } - + @Override public String toString() { return sheet.toString(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/SheetBlock2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/SheetBlock2.java index 029437c30..7b8185a9c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/SheetBlock2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/SheetBlock2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,6 +34,7 @@ import java.awt.geom.Rectangle2D; import java.util.List; +import net.sourceforge.plantuml.creole.atom.Atom; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; @@ -47,11 +48,25 @@ public class SheetBlock2 extends AbstractTextBlock implements TextBlock, Atom { public List splitInTwo(StringBounder stringBounder, double width) { throw new UnsupportedOperationException(getClass().toString()); } - + private final SheetBlock1 block; private final UStroke defaultStroke; private final Stencil stencil; + public SheetBlock2 enlargeMe(final double delta1, final double delta2) { + final Stencil newStencil = new Stencil() { + + public double getStartingX(StringBounder stringBounder, double y) { + return stencil.getStartingX(stringBounder, y) - delta1; + } + + public double getEndingX(StringBounder stringBounder, double y) { + return stencil.getEndingX(stringBounder, y) + delta2; + } + }; + return new SheetBlock2(block, newStencil, defaultStroke); + } + public SheetBlock2(SheetBlock1 block, Stencil stencil, UStroke defaultStroke) { this.block = block; this.stencil = stencil; @@ -60,7 +75,7 @@ public SheetBlock2(SheetBlock1 block, Stencil stencil, UStroke defaultStroke) { throw new IllegalArgumentException(); } } - + @Override public String toString() { return block.toString(); @@ -80,10 +95,10 @@ public void drawU(UGraphic ug) { public double getStartingAltitude(StringBounder stringBounder) { return 0; } - + @Override public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) { return block.getInnerPosition(member, stringBounder, strategy); } - + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/SheetBuilder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/SheetBuilder.java new file mode 100644 index 000000000..783d892d8 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/SheetBuilder.java @@ -0,0 +1,39 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.creole; + +import net.sourceforge.plantuml.cucadiagram.Display; + +public interface SheetBuilder { + + public Sheet createSheet(Display display); + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Stencil.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Stencil.java index 21c65226e..d9ded6649 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Stencil.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Stencil.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Stripe.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Stripe.java index 87ed8e33c..e379e04c8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Stripe.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Stripe.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,10 +32,12 @@ import java.util.List; +import net.sourceforge.plantuml.creole.atom.Atom; + public interface Stripe { - public Atom getHeader(); - + public Atom getLHeader(); + public List getAtoms(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeStyle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeStyle.java index cdd101748..68879e3e2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeStyle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeStyle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,6 +30,9 @@ */ package net.sourceforge.plantuml.creole; +import net.sourceforge.plantuml.creole.atom.Atom; +import net.sourceforge.plantuml.creole.atom.Bullet; +import net.sourceforge.plantuml.creole.legacy.AtomText; import net.sourceforge.plantuml.graphic.FontConfiguration; public class StripeStyle { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeStyleType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeStyleType.java index fedca59fb..7dc68301c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeStyleType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeStyleType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/UCreole.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/UCreole.java index 50b8cde40..195492f63 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/UCreole.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/UCreole.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,6 +32,5 @@ import net.sourceforge.plantuml.ugraphic.UShape; - public interface UCreole extends UShape { } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AbstractAtom.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AbstractAtom.java similarity index 83% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/AbstractAtom.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AbstractAtom.java index daabffd55..ac7ed8dcc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AbstractAtom.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AbstractAtom.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,8 +28,9 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; +import java.util.Arrays; import java.util.List; import net.sourceforge.plantuml.graphic.StringBounder; @@ -37,7 +38,7 @@ public abstract class AbstractAtom implements Atom { public List splitInTwo(StringBounder stringBounder, double width) { - throw new UnsupportedOperationException(getClass().toString()); + return Arrays.asList((Atom) this); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Atom.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/Atom.java similarity index 89% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/Atom.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/Atom.java index 38bc79026..6dd59847f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Atom.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/Atom.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; import java.util.List; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomHorizontalTexts.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomHorizontalTexts.java similarity index 90% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomHorizontalTexts.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomHorizontalTexts.java index 2983e56b5..d5f6337b2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomHorizontalTexts.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomHorizontalTexts.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; import java.util.List; @@ -67,7 +67,7 @@ public void drawU(UGraphic ug) { double x = 0; for (Atom text : all) { final Dimension2D dim = text.calculateDimension(ug.getStringBounder()); - text.drawU(ug.apply(new UTranslate(x, 0))); + text.drawU(ug.apply(UTranslate.dx(x))); x += dim.getWidth(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomImg.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomImg.java similarity index 55% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomImg.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomImg.java index 84b61d29a..09d9869c0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomImg.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomImg.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,32 +28,33 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.Color; import java.awt.geom.Dimension2D; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; - -import javax.imageio.ImageIO; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FileSystem; import net.sourceforge.plantuml.FileUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.code.Base64Coder; +import net.sourceforge.plantuml.creole.legacy.AtomText; import net.sourceforge.plantuml.flashcode.FlashCodeFactory; import net.sourceforge.plantuml.flashcode.FlashCodeUtils; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.ImgValign; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TileImageSvg; +import net.sourceforge.plantuml.security.ImageIO; +import net.sourceforge.plantuml.security.SFile; +import net.sourceforge.plantuml.security.SURL; +import net.sourceforge.plantuml.security.SecurityProfile; +import net.sourceforge.plantuml.security.SecurityUtils; +import net.sourceforge.plantuml.ugraphic.AffineTransformType; +import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; @@ -64,11 +65,13 @@ public class AtomImg extends AbstractAtom implements Atom { private final BufferedImage image; private final double scale; private final Url url; + private final String rawFileName; - private AtomImg(BufferedImage image, double scale, Url url) { + private AtomImg(BufferedImage image, double scale, Url url, String rawFileName) { this.image = image; this.scale = scale; this.url = url; + this.rawFileName = rawFileName; } public static Atom createQrcode(String flash, double scale) { @@ -77,7 +80,9 @@ public static Atom createQrcode(String flash, double scale) { if (im == null) { im = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB); } - return new AtomImg(new UImage(im).scaleNearestNeighbor(scale).getImage(), 1, null); + return new AtomImg( + new UImage(new PixelImage(im, AffineTransformType.TYPE_NEAREST_NEIGHBOR)).scale(scale).getImage(1), 1, + null, null); } public static Atom create(String src, ImgValign valign, int vspace, double scale, Url url) { @@ -88,7 +93,7 @@ public static Atom create(String src, ImgValign valign, int vspace, double scale final String data = src.substring(DATA_IMAGE_PNG_BASE64.length(), src.length()); try { final byte bytes[] = Base64Coder.decode(data); - return build(src, fc, bytes, scale, url); + return buildRasterFromData(src, fc, bytes, scale, url); } catch (Exception e) { return AtomText.create("ERROR " + e.toString(), fc); } @@ -97,64 +102,73 @@ public static Atom create(String src, ImgValign valign, int vspace, double scale try { // Check if valid URL if (src.startsWith("http:") || src.startsWith("https:")) { - // final byte image[] = getFile(src); - return build(src, fc, new URL(src), scale, url); + if (src.endsWith(".svg")) { + return buildSvgFromUrl(src, fc, SURL.create(src), scale, url); + } + return buildRasterFromUrl(src, fc, SURL.create(src), scale, url); } - final File f = FileSystem.getInstance().getFile(src); + final SFile f = FileSystem.getInstance().getFile(src); if (f.exists() == false) { - return AtomText.create("(File not found: " + f.getCanonicalPath() + ")", fc); + if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) { + return AtomText.create("(File not found: " + f.getPrintablePath() + ")", fc); + } + return AtomText.create("(Cannot decode)", fc); } if (f.getName().endsWith(".svg")) { - return new AtomImgSvg(new TileImageSvg(f)); + final String tmp = FileUtils.readSvg(f); + if (tmp == null) { + return AtomText.create("(Cannot decode)", fc); + } + return new AtomImgSvg(new TileImageSvg(tmp)); } - final BufferedImage read = FileUtils.ImageIO_read(f); + final BufferedImage read = f.readRasterImageFromFile(); if (read == null) { - return AtomText.create("(Cannot decode: " + f.getCanonicalPath() + ")", fc); + if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) { + return AtomText.create("(Cannot decode: " + f.getPrintablePath() + ")", fc); + } + return AtomText.create("(Cannot decode)", fc); } - return new AtomImg(FileUtils.ImageIO_read(f), scale, url); + return new AtomImg(f.readRasterImageFromFile(), scale, url, src); } catch (IOException e) { - return AtomText.create("ERROR " + e.toString(), fc); + e.printStackTrace(); + if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) { + return AtomText.create("ERROR " + e.toString(), fc); + } + return AtomText.create("ERROR", fc); } } - private static Atom build(String source, final FontConfiguration fc, final byte[] data, double scale, Url url) - throws IOException { + private static Atom buildRasterFromData(String source, final FontConfiguration fc, final byte[] data, double scale, + Url url) throws IOException { final BufferedImage read = ImageIO.read(new ByteArrayInputStream(data)); if (read == null) { return AtomText.create("(Cannot decode: " + source + ")", fc); } - return new AtomImg(read, scale, url); + return new AtomImg(read, scale, url, null); } - private static Atom build(String text, final FontConfiguration fc, URL source, double scale, Url url) + private static Atom buildRasterFromUrl(String text, final FontConfiguration fc, SURL source, double scale, Url url) throws IOException { - final BufferedImage read = FileUtils.ImageIO_read(source); + if (source == null) { + return AtomText.create("(Cannot decode: " + text + ")", fc); + } + final BufferedImage read = source.readRasterImageFromURL(); if (read == null) { return AtomText.create("(Cannot decode: " + text + ")", fc); } - return new AtomImg(read, scale, url); + return new AtomImg(read, scale, url, "http"); } - // Added by Alain Corbiere - private static byte[] getFile(String host) throws IOException { - final ByteArrayOutputStream image = new ByteArrayOutputStream(); - InputStream input = null; - try { - final URL url = new URL(host); - final URLConnection connection = url.openConnection(); - input = connection.getInputStream(); - final byte[] buffer = new byte[1024]; - int read; - while ((read = input.read(buffer)) > 0) { - image.write(buffer, 0, read); - } - image.close(); - return image.toByteArray(); - } finally { - if (input != null) { - input.close(); - } + private static Atom buildSvgFromUrl(String text, final FontConfiguration fc, SURL source, double scale, Url url) + throws IOException { + if (source == null) { + return AtomText.create("(Cannot decode SVG: " + text + ")", fc); + } + final byte[] read = source.getBytes(); + if (read == null) { + return AtomText.create("(Cannot decode SVG: " + text + ")", fc); } + return new AtomImgSvg(new TileImageSvg(new String(read, "UTF-8"))); } // End @@ -171,9 +185,10 @@ public void drawU(UGraphic ug) { if (url != null) { ug.startUrl(url); } - ug.draw(new UImage(image).scale(scale)); + ug.draw(new UImage(new PixelImage(image, AffineTransformType.TYPE_BILINEAR)).withRawFileName(rawFileName) + .scale(scale)); if (url != null) { - ug.closeAction(); + ug.closeUrl(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomImgSvg.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomImgSvg.java similarity index 90% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomImgSvg.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomImgSvg.java index 813b1e021..c73d720ef 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomImgSvg.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomImgSvg.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomMath.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomMath.java similarity index 71% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomMath.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomMath.java index 1f4bb7db6..6c2ce155a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomMath.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomMath.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.Color; import java.awt.geom.Dimension2D; @@ -36,34 +36,31 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.SvgString; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.math.ScientificEquationSafe; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UImageSvg; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; public class AtomMath extends AbstractAtom implements Atom { - private final double scale; private final ScientificEquationSafe math; - private final HtmlColor foreground; - private final HtmlColor background; + private final HColor foreground; + private final HColor background; private final ColorMapper colorMapper; - public AtomMath(ScientificEquationSafe math, HtmlColor foreground, HtmlColor background, double scale, - ColorMapper colorMapper) { + public AtomMath(ScientificEquationSafe math, HColor foreground, HColor background, ColorMapper colorMapper) { this.math = math; this.colorMapper = colorMapper; this.foreground = foreground; this.background = background; - this.scale = scale; } private Dimension2D calculateDimensionSlow(StringBounder stringBounder) { - final BufferedImage image = math.getImage(scale, Color.BLACK, Color.WHITE); + final BufferedImage image = math.getImage(Color.BLACK, Color.WHITE).withScale(1).getImage(); return new Dimension2DDouble(image.getWidth(), image.getHeight()); } @@ -91,18 +88,17 @@ public void drawU(UGraphic ug) { final Color fore = getColor(foreground, Color.BLACK); // final double dpiFactor = ug.dpiFactor(); if (isSvg) { - final SvgString svg = math.getSvg(scale, fore, back); + final SvgString svg = math.getSvg(1, fore, back); ug.draw(new UImageSvg(svg)); } else { - final UImage image = new UImage(math.getImage(scale, fore, back), math.getFormula()); + final UImage image = new UImage(math.getImage(fore, back)).withFormula(math.getFormula()); ug.draw(image); } } - private Color getColor(HtmlColor color, Color defaultValue) { - if (color instanceof HtmlColorSimple) { - return colorMapper.getMappedColor(color); - // return ((HtmlColorSimple) color).getColor999(); + private Color getColor(HColor color, Color defaultValue) { + if (color instanceof HColorSimple) { + return colorMapper.toColor(color); } return defaultValue; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomOpenIcon.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomOpenIcon.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomOpenIcon.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomOpenIcon.java index 3a02c133c..9e7ffb4e3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomOpenIcon.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomOpenIcon.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,27 +28,27 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.openiconic.OpenIcon; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class AtomOpenIcon extends AbstractAtom implements Atom { private final OpenIcon openIcon; private final double factor; private final Url url; - private final HtmlColor color; + private final HColor color; - public AtomOpenIcon(HtmlColor newColor, double scale, OpenIcon openIcon, FontConfiguration fontConfiguration, + public AtomOpenIcon(HColor newColor, double scale, OpenIcon openIcon, FontConfiguration fontConfiguration, Url url) { this.url = url; this.openIcon = openIcon; @@ -74,7 +74,7 @@ public void drawU(UGraphic ug) { } asTextBlock().drawU(ug); if (url != null) { - ug.closeAction(); + ug.closeUrl(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomSpace.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomSpace.java similarity index 90% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomSpace.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomSpace.java index 843769c1e..d1a440463 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomSpace.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomSpace.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomSprite.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomSprite.java similarity index 75% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomSprite.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomSprite.java index 35df7310d..16359e88c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomSprite.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomSprite.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,32 +28,25 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; -import java.util.Arrays; -import java.util.List; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class AtomSprite extends AbstractAtom implements Atom { private final Sprite sprite; private final double scale; private final Url url; - private final HtmlColor color; + private final HColor color; - @Override - public List splitInTwo(StringBounder stringBounder, double width) { - return Arrays.asList((Atom) this); - } - - public AtomSprite(HtmlColor newColor, double scale, FontConfiguration fontConfiguration, Sprite sprite, Url url) { + public AtomSprite(HColor newColor, double scale, FontConfiguration fontConfiguration, Sprite sprite, Url url) { this.scale = scale; this.sprite = sprite; this.url = url; @@ -74,7 +67,7 @@ public void drawU(UGraphic ug) { } sprite.asTextBlock(color, scale).drawU(ug); if (url != null) { - ug.closeAction(); + ug.closeUrl(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomTable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomTable.java similarity index 80% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomTable.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomTable.java index 2eecb612e..3d248f556 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomTable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomTable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; import java.util.ArrayList; @@ -37,28 +37,29 @@ import java.util.Map; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.creole.Position; +import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; 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.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; public class AtomTable extends AbstractAtom implements Atom { class Line { private final List cells = new ArrayList(); - private final List cellsBackColor = new ArrayList(); - private final HtmlColor lineBackColor; + private final List cellsBackColor = new ArrayList(); + private final HColor lineBackColor; - private Line(HtmlColor lineBackColor) { + private Line(HColor lineBackColor) { this.lineBackColor = lineBackColor; } - public void add(Atom cell, HtmlColor cellBackColor) { + public void add(Atom cell, HColor cellBackColor) { cells.add(cell); cellsBackColor.add(cellBackColor); } @@ -75,9 +76,9 @@ public String toString() { private final List lines = new ArrayList(); private final Map positions = new HashMap(); - private final HtmlColor lineColor; + private final HColor lineColor; - public AtomTable(HtmlColor lineColor) { + public AtomTable(HColor lineColor) { this.lineColor = lineColor; } @@ -101,8 +102,8 @@ public void drawU(UGraphic ug) { final double y2 = getStartingY(i + 1); final double x1 = getStartingX(0); final double x2 = getStartingX(getNbCols()); - ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(line.lineBackColor)) - .apply(new UTranslate(x1, y1)).draw(new URectangle(x2 - x1, y2 - y1)); + ug.apply(new HColorNone()).apply(line.lineBackColor.bg()).apply(new UTranslate(x1, y1)) + .draw(new URectangle(x2 - x1, y2 - y1)); } for (int j = 0; j < getNbCols(); j++) { if (j >= line.cells.size()) { @@ -113,15 +114,15 @@ public void drawU(UGraphic ug) { if (cell instanceof SheetBlock1) { align = ((SheetBlock1) cell).getCellAlignment(); } - final HtmlColor cellBackColor = line.cellsBackColor.get(j); + final HColor cellBackColor = line.cellsBackColor.get(j); final double x1 = getStartingX(j); final double x2 = getStartingX(j + 1); final double cellWidth = x2 - x1; if (cellBackColor != null) { final double y1 = getStartingY(i); final double y2 = getStartingY(i + 1); - ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(cellBackColor)) - .apply(new UTranslate(x1, y1)).draw(new URectangle(x2 - x1, y2 - y1)); + ug.apply(new HColorNone()).apply(cellBackColor.bg()).apply(new UTranslate(x1, y1)) + .draw(new URectangle(x2 - x1, y2 - y1)); } final Position pos = positions.get(cell); final Dimension2D dimCell = cell.calculateDimension(ug.getStringBounder()); @@ -131,17 +132,17 @@ public void drawU(UGraphic ug) { } else { dx = 0; } - cell.drawU(ug.apply(pos.getTranslate().compose(new UTranslate(dx, 0)))); + cell.drawU(ug.apply(pos.getTranslate().compose(UTranslate.dx(dx)))); } } - ug = ug.apply(new UChangeColor(lineColor)); - final ULine hline = new ULine(getEndingX(getNbCols() - 1), 0); + ug = ug.apply(lineColor); + final ULine hline = ULine.hline(getEndingX(getNbCols() - 1)); for (int i = 0; i <= getNbLines(); i++) { - ug.apply(new UTranslate(0, getStartingY(i))).draw(hline); + ug.apply(UTranslate.dy(getStartingY(i))).draw(hline); } - final ULine vline = new ULine(0, getEndingY(getNbLines() - 1)); + final ULine vline = ULine.vline(getEndingY(getNbLines() - 1)); for (int i = 0; i <= getNbCols(); i++) { - ug.apply(new UTranslate(getStartingX(i), 0)).draw(vline); + ug.apply(UTranslate.dx(getStartingX(i))).draw(vline); } } @@ -251,12 +252,12 @@ private Line lastLine() { return lines.get(lines.size() - 1); } - public void addCell(Atom cell, HtmlColor cellBackColor) { + public void addCell(Atom cell, HColor cellBackColor) { lastLine().add(cell, cellBackColor); positions.clear(); } - public void newLine(HtmlColor lineBackColor) { + public void newLine(HColor lineBackColor) { lines.add(new Line(lineBackColor)); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomTree.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomTree.java similarity index 83% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomTree.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomTree.java index e15ec4bde..a766ebfc3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomTree.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomTree.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; import java.util.ArrayList; @@ -37,21 +37,20 @@ import java.util.Map; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.salt.element.Skeleton2; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class AtomTree extends AbstractAtom implements Atom { - private final HtmlColor lineColor; + private final HColor lineColor; private final List cells = new ArrayList(); private final Map levels = new HashMap(); private final double margin = 2; - public AtomTree(HtmlColor lineColor) { + public AtomTree(HColor lineColor) { this.lineColor = lineColor; } @@ -78,13 +77,13 @@ public void drawU(final UGraphic ugInit) { UGraphic ug = ugInit; for (Atom cell : cells) { final int level = getLevel(cell); - cell.drawU(ug.apply(new UTranslate(margin + skeleton.getXEndForLevel(level), 0))); + cell.drawU(ug.apply(UTranslate.dx(margin + skeleton.getXEndForLevel(level)))); final Dimension2D dim = cell.calculateDimension(ug.getStringBounder()); skeleton.add(level, y + dim.getHeight() / 2); - ug = ug.apply(new UTranslate(0, dim.getHeight())); + ug = ug.apply(UTranslate.dy(dim.getHeight())); y += dim.getHeight(); } - skeleton.draw(ugInit.apply(new UChangeColor(this.lineColor))); + skeleton.draw(ugInit.apply(this.lineColor)); } private int getLevel(Atom atom) { @@ -95,5 +94,5 @@ public void addCell(Atom cell, int level) { this.cells.add(cell); this.levels.put(cell, level); } - + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomVerticalTexts.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomVerticalTexts.java similarity index 90% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomVerticalTexts.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomVerticalTexts.java index 6a833dff5..935e22d16 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomVerticalTexts.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomVerticalTexts.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; import java.util.List; @@ -64,7 +64,7 @@ public void drawU(UGraphic ug) { double y = 0; for (Atom text : all) { final Dimension2D dim = text.calculateDimension(ug.getStringBounder()); - text.drawU(ug.apply(new UTranslate(0, y))); + text.drawU(ug.apply(UTranslate.dy(y))); y += dim.getHeight(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomWithMargin.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomWithMargin.java similarity index 67% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomWithMargin.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomWithMargin.java index c0c7c695d..f7c3a4739 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomWithMargin.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/AtomWithMargin.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,16 +28,19 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -class AtomWithMargin extends AbstractAtom implements Atom { +public class AtomWithMargin extends AbstractAtom implements Atom { private final double marginY1; private final double marginY2; @@ -49,6 +52,24 @@ public AtomWithMargin(Atom atom, double marginY1, double marginY2) { this.marginY2 = marginY2; } + @Override + public List splitInTwo(StringBounder stringBounder, double width) { + final List result = new ArrayList(); + final List list = atom.splitInTwo(stringBounder, width); + for (Atom a : list) { + double y1 = marginY1; + double y2 = marginY2; + if (list.size() == 2 && result.size() == 0) { + y2 = 0; + } + if (list.size() == 2 && result.size() == 1) { + y1 = 0; + } + result.add(new AtomWithMargin(a, y1, y2)); + } + return Collections.unmodifiableList(result); + } + public Dimension2D calculateDimension(StringBounder stringBounder) { return Dimension2DDouble.delta(atom.calculateDimension(stringBounder), 0, marginY1 + marginY2); } @@ -58,7 +79,7 @@ public double getStartingAltitude(StringBounder stringBounder) { } public void drawU(UGraphic ug) { - atom.drawU(ug.apply(new UTranslate(0, marginY1))); + atom.drawU(ug.apply(UTranslate.dy(marginY1))); } - + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Bullet.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/Bullet.java similarity index 79% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/Bullet.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/Bullet.java index 24d548665..3db343d0b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Bullet.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/atom/Bullet.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,21 +28,19 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.atom; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Bullet extends AbstractAtom implements Atom { @@ -75,10 +73,10 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { } private void drawU0(UGraphic ug) { - final HtmlColor color = fontConfiguration.getColor(); - ug = ug.apply(new UChangeColor(color)).apply(new UChangeBackColor(color)).apply(new UStroke(0)); + final HColor color = fontConfiguration.getColor(); + ug = ug.apply(color).apply(color.bg()).apply(new UStroke(0)); // final double width = getWidth(ug.getStringBounder()); - ug = ug.apply(new UTranslate(3, 0)); + ug = ug.apply(UTranslate.dx(3)); ug.draw(new UEllipse(5, 5)); } @@ -91,16 +89,15 @@ private Dimension2D calculateDimension0(StringBounder stringBounder) { } private void drawU1(UGraphic ug) { - final HtmlColor color = fontConfiguration.getColor(); - ug = ug.apply(new UChangeColor(color)).apply(new UChangeBackColor(color)).apply(new UStroke(0)); + final HColor color = fontConfiguration.getColor(); + ug = ug.apply(color).apply(color.bg()).apply(new UStroke(0)); final double width = getWidth(ug.getStringBounder()); - ug = ug.apply(new UTranslate(width - 5, 0)); + ug = ug.apply(UTranslate.dx(width - 5)); ug.draw(new URectangle(3.5, 3.5)); } private Dimension2D calculateDimension1(StringBounder stringBounder) { return new Dimension2DDouble(getWidth(stringBounder), 3); } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Command.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/Command.java similarity index 82% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/Command.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/Command.java index 3ec53bdd4..ccd21d111 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/Command.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/Command.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,11 +28,13 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; + +import net.sourceforge.plantuml.creole.legacy.StripeSimple; public interface Command { - + public int matchingSize(String line); - + public String executeAndGetRemaining(String line, StripeSimple stripe); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleColorAndSizeChange.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorAndSizeChange.java similarity index 86% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleColorAndSizeChange.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorAndSizeChange.java index d4b446c4f..75df8ab77 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleColorAndSizeChange.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorAndSizeChange.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,14 +28,15 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; 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.creole.legacy.StripeSimple; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class CommandCreoleColorAndSizeChange implements Command { @@ -79,7 +80,7 @@ public String executeAndGetRemaining(String line, StripeSimple stripe) { fc2 = fc2.changeSize(Integer.parseInt(m.group(2))); } if (m.group(3) != null) { - final HtmlColor color = HtmlColorSet.getInstance().getColorIfValid(m.group(3)); + final HColor color = HColorSet.instance().getColorIfValid(m.group(3)); fc2 = fc2.changeColor(color); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleColorChange.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorChange.java similarity index 84% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleColorChange.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorChange.java index cb2f9f587..ad9fbbf39 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleColorChange.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorChange.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,15 +28,16 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; 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.creole.legacy.StripeSimple; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.Splitter; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class CommandCreoleColorChange implements Command { @@ -69,7 +70,7 @@ public String executeAndGetRemaining(String line, StripeSimple stripe) { throw new IllegalStateException(); } final FontConfiguration fc1 = stripe.getActualFontConfiguration(); - final HtmlColor color = HtmlColorSet.getInstance().getColorIfValid(m.group(2)); + final HColor color = HColorSet.instance().getColorIfValid(m.group(2)); final FontConfiguration fc2 = fc1.changeColor(color); stripe.setActualFontConfiguration(fc2); stripe.analyzeAndAdd(m.group(3)); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleExposantChange.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleExposantChange.java similarity index 84% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleExposantChange.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleExposantChange.java index 9c7a7db52..734dd8a58 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleExposantChange.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleExposantChange.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,11 +28,12 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; 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.creole.legacy.StripeSimple; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontPosition; @@ -47,12 +48,14 @@ private CommandCreoleExposantChange(String p, FontPosition position) { } public static Command create(FontPosition position) { - return new CommandCreoleExposantChange("^(?i)(" + "\\<" + position.getHtmlTag() + "\\>" + "(.*?)\\)", position); + return new CommandCreoleExposantChange( + "^(?i)(" + "\\<" + position.getHtmlTag() + "\\>" + "(.*?)\\)", + position); } // public static Command createLegacyEol(FontStyle style) { - // return new CommandCreoleExposantChange("^(" + style.getActivationPattern() + "(.+))$", style); + // return new CommandCreoleExposantChange("^(" + style.getActivationPattern() + + // "(.+))$", style); // } public int matchingSize(String line) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleFontFamilyChange.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleFontFamilyChange.java similarity index 91% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleFontFamilyChange.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleFontFamilyChange.java index 8e8122102..a974dfb6b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleFontFamilyChange.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleFontFamilyChange.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,11 +28,12 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; 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.creole.legacy.StripeSimple; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.Splitter; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleImg.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleImg.java similarity index 72% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleImg.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleImg.java index 8424e7c8a..0a9552827 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleImg.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleImg.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,15 +28,14 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.StringUtils; 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.creole.Parser; +import net.sourceforge.plantuml.creole.legacy.StripeSimple; import net.sourceforge.plantuml.graphic.Splitter; public class CommandCreoleImg implements Command { @@ -65,7 +64,7 @@ public String executeAndGetRemaining(String line, StripeSimple stripe) { throw new IllegalStateException(); } String src = m.group(2); - final double scale = getScale(m.group(3), 1); + final double scale = Parser.getScale(m.group(3), 1); if (src.toLowerCase().startsWith("src=")) { src = src.substring(4); } @@ -74,28 +73,4 @@ public String executeAndGetRemaining(String line, StripeSimple stripe) { return line.substring(m.group(1).length()); } - public static double getScale(String s, double def) { - if (s == null) { - return def; - } - final Pattern p = Pattern.compile("(?:scale=|\\*)([0-9.]+)"); - final Matcher m = p.matcher(s); - if (m.find()) { - return Double.parseDouble(m.group(1)); - } - return def; - } - - public static String getColor(String s) { - if (s == null) { - return null; - } - final Pattern p = Pattern.compile("color[= :](#[0-9a-fA-F]{6}|\\w+)"); - final Matcher m = p.matcher(s); - if (m.find()) { - return m.group(1); - } - return null; - } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleLatex.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleLatex.java similarity index 82% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleLatex.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleLatex.java index 52788425e..1c1588e2a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleLatex.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleLatex.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,26 +28,25 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; 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.creole.legacy.StripeSimple; import net.sourceforge.plantuml.graphic.Splitter; import net.sourceforge.plantuml.math.ScientificEquationSafe; public class CommandCreoleLatex implements Command { private final Pattern2 pattern; - private final double scale; - private CommandCreoleLatex(String p, double scale) { + private CommandCreoleLatex(String p) { this.pattern = MyPattern.cmpile(p); - this.scale = scale; } - public static Command create(double scale) { - return new CommandCreoleLatex("^(?i)(" + Splitter.latexPattern + ")", scale); + public static Command create() { + return new CommandCreoleLatex("^(?i)(" + Splitter.latexPattern + ")"); } public int matchingSize(String line) { @@ -64,7 +63,7 @@ public String executeAndGetRemaining(String line, StripeSimple stripe) { throw new IllegalStateException(); } final String latex = m.group(2); - stripe.addMath(ScientificEquationSafe.fromLatex(latex), scale); + stripe.addMath(ScientificEquationSafe.fromLatex(latex)); return line.substring(m.group(1).length()); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleMath.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleMath.java similarity index 82% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleMath.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleMath.java index 4c076bb19..f29009d19 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleMath.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleMath.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,26 +28,25 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; 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.creole.legacy.StripeSimple; import net.sourceforge.plantuml.graphic.Splitter; import net.sourceforge.plantuml.math.ScientificEquationSafe; public class CommandCreoleMath implements Command { private final Pattern2 pattern; - private final double scale; - private CommandCreoleMath(String p, double scale) { + private CommandCreoleMath(String p) { this.pattern = MyPattern.cmpile(p); - this.scale = scale; } - public static Command create(double scale) { - return new CommandCreoleMath("^(?i)(" + Splitter.mathPattern + ")", scale); + public static Command create() { + return new CommandCreoleMath("^(?i)(" + Splitter.mathPattern + ")"); } public int matchingSize(String line) { @@ -64,7 +63,7 @@ public String executeAndGetRemaining(String line, StripeSimple stripe) { throw new IllegalStateException(); } final String math = m.group(2); - stripe.addMath(ScientificEquationSafe.fromAsciiMath(math), scale); + stripe.addMath(ScientificEquationSafe.fromAsciiMath(math)); return line.substring(m.group(1).length()); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleMonospaced.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleMonospaced.java similarity index 90% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleMonospaced.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleMonospaced.java index b78f3eaf0..588faac23 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleMonospaced.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleMonospaced.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,17 +28,16 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; 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.creole.legacy.StripeSimple; import net.sourceforge.plantuml.graphic.FontConfiguration; public class CommandCreoleMonospaced implements Command { - public static final String MONOSPACED = "monospaced"; - private final Pattern2 pattern; private final String monospacedFamily; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleOpenIcon.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleOpenIcon.java similarity index 74% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleOpenIcon.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleOpenIcon.java index b85f1ff65..70b7460dd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleOpenIcon.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleOpenIcon.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,26 +28,28 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; 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.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.creole.Parser; +import net.sourceforge.plantuml.creole.legacy.StripeSimple; import net.sourceforge.plantuml.graphic.Splitter; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class CommandCreoleOpenIcon implements Command { private final Pattern2 pattern; - private final IHtmlColorSet colorSet; + private final HColorSet colorSet; - private CommandCreoleOpenIcon(IHtmlColorSet colorSet, String p) { + private CommandCreoleOpenIcon(HColorSet colorSet, String p) { this.pattern = MyPattern.cmpile(p); this.colorSet = colorSet; } - public static Command create(IHtmlColorSet colorSet) { + public static Command create(HColorSet colorSet) { return new CommandCreoleOpenIcon(colorSet, "^(?i)(" + Splitter.openiconPattern + ")"); } @@ -65,9 +67,9 @@ public String executeAndGetRemaining(String line, StripeSimple stripe) { throw new IllegalStateException(); } final String src = m.group(2); - final double scale = CommandCreoleImg.getScale(m.group(3), 1); - final String colorName = CommandCreoleImg.getColor(m.group(3)); - HtmlColor color = null; + final double scale = Parser.getScale(m.group(3), 1); + final String colorName = Parser.getColor(m.group(3)); + HColor color = null; if (colorName != null) { color = colorSet.getColorIfValid(colorName); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleQrcode.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleQrcode.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleQrcode.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleQrcode.java index c0e6b2bc9..b71d1992d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleQrcode.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleQrcode.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,11 +28,13 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; 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.creole.Parser; +import net.sourceforge.plantuml.creole.legacy.StripeSimple; import net.sourceforge.plantuml.graphic.Splitter; public class CommandCreoleQrcode implements Command { @@ -61,7 +63,7 @@ public String executeAndGetRemaining(String line, StripeSimple stripe) { throw new IllegalStateException(); } final String src = m.group(2); - final double scale = CommandCreoleImg.getScale(m.group(3), 3); + final double scale = Parser.getScale(m.group(3), 3); stripe.addQrcode(src, scale); return line.substring(m.group(1).length()); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleSizeChange.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleSizeChange.java similarity index 91% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleSizeChange.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleSizeChange.java index 659025607..2bb1baf9a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleSizeChange.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleSizeChange.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,11 +28,12 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; 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.creole.legacy.StripeSimple; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.Splitter; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleSpace.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleSpace.java similarity index 90% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleSpace.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleSpace.java index 21e13c038..fa592405d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleSpace.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleSpace.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,11 +28,12 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; 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.creole.legacy.StripeSimple; public class CommandCreoleSpace implements Command { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleSprite.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleSprite.java similarity index 74% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleSprite.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleSprite.java index 896510cee..011162ac6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleSprite.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleSprite.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,26 +28,28 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; 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.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.creole.Parser; +import net.sourceforge.plantuml.creole.legacy.StripeSimple; import net.sourceforge.plantuml.graphic.Splitter; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class CommandCreoleSprite implements Command { private final Pattern2 pattern; - private final IHtmlColorSet colorSet; + private final HColorSet colorSet; - private CommandCreoleSprite(IHtmlColorSet colorSet, String p) { + private CommandCreoleSprite(HColorSet colorSet, String p) { this.pattern = MyPattern.cmpile(p); this.colorSet = colorSet; } - public static Command create(IHtmlColorSet colorSet) { + public static Command create(HColorSet colorSet) { return new CommandCreoleSprite(colorSet, "^(?i)(" + Splitter.spritePattern2 + ")"); } @@ -65,9 +67,9 @@ public String executeAndGetRemaining(String line, StripeSimple stripe) { throw new IllegalStateException(); } final String src = m.group(2); - final double scale = CommandCreoleImg.getScale(m.group(3), 1); - final String colorName = CommandCreoleImg.getColor(m.group(3)); - HtmlColor color = null; + final double scale = Parser.getScale(m.group(3), 1); + final String colorName = Parser.getColor(m.group(3)); + HColor color = null; if (colorName != null) { color = colorSet.getColorIfValid(colorName); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleStyle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleStyle.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleStyle.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleStyle.java index a7bfcc1c4..3e6dc37eb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleStyle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleStyle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,15 +28,16 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; 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.creole.legacy.StripeSimple; import net.sourceforge.plantuml.graphic.AddStyle; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontStyle; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandCreoleStyle implements Command { @@ -50,8 +51,9 @@ public static CommandCreoleStyle createCreole(FontStyle style) { } public static Command createLegacy(FontStyle style) { - return new CommandCreoleStyle("^((" + style.getActivationPattern() + ")(.+?)" + style.getDeactivationPattern() - + ")", style, style.canHaveExtendedColor()); + return new CommandCreoleStyle( + "^((" + style.getActivationPattern() + ")(.+?)" + style.getDeactivationPattern() + ")", style, + style.canHaveExtendedColor()); } public static Command createLegacyEol(FontStyle style) { @@ -65,7 +67,7 @@ private CommandCreoleStyle(String p, FontStyle style, boolean tryExtendedColor) this.tryExtendedColor = tryExtendedColor; } - private HtmlColor getExtendedColor(Matcher2 m) { + private HColor getExtendedColor(Matcher2 m) { if (tryExtendedColor) { return style.getExtendedColor(m.group(2)); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleSvgAttributeChange.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleSvgAttributeChange.java similarity index 91% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleSvgAttributeChange.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleSvgAttributeChange.java index 638af7814..5005ad5f2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleSvgAttributeChange.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleSvgAttributeChange.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,11 +28,12 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; 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.creole.legacy.StripeSimple; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.Splitter; import net.sourceforge.plantuml.graphic.SvgAttributes; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleUrl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleUrl.java similarity index 80% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleUrl.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleUrl.java index dad1711ab..9aa2f8cf2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CommandCreoleUrl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/command/CommandCreoleUrl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.Url; @@ -37,6 +37,7 @@ 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.creole.legacy.StripeSimple; public class CommandCreoleUrl implements Command { @@ -69,14 +70,6 @@ public String executeAndGetRemaining(String line, StripeSimple stripe) { final UrlBuilder urlBuilder = new UrlBuilder(skinParam.getValue("topurl"), ModeUrl.STRICT); final Url url = urlBuilder.getUrl(m.group(1)); stripe.addUrl(url); - -// final int size = Integer.parseInt(m.group(2)); -// final FontConfiguration fc1 = stripe.getActualFontConfiguration(); -// final FontConfiguration fc2 = fc1.changeSize(size); -// // final FontConfiguration fc2 = new AddStyle(style, null).apply(fc1); -// stripe.setActualFontConfiguration(fc2); - // stripe.analyzeAndAdd("AZERTY"); -// stripe.setActualFontConfiguration(fc1); return line.substring(m.group(1).length()); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomText.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/AtomText.java similarity index 70% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomText.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/AtomText.java index ea3456691..9f261f26f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/AtomText.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/AtomText.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,12 +28,13 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.legacy; import java.awt.font.LineMetrics; import java.awt.geom.Dimension2D; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.StringTokenizer; @@ -47,20 +48,28 @@ import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.creole.Parser; +import net.sourceforge.plantuml.creole.atom.AbstractAtom; +import net.sourceforge.plantuml.creole.atom.Atom; +import net.sourceforge.plantuml.creole.atom.AtomHorizontalTexts; +import net.sourceforge.plantuml.creole.atom.AtomImg; +import net.sourceforge.plantuml.creole.atom.AtomOpenIcon; +import net.sourceforge.plantuml.creole.atom.AtomSprite; +import net.sourceforge.plantuml.creole.atom.AtomVerticalTexts; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorAutomatic; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; import net.sourceforge.plantuml.graphic.ImgValign; import net.sourceforge.plantuml.graphic.Splitter; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.openiconic.OpenIcon; +import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UText; import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorAutomatic; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; import net.sourceforge.plantuml.utils.CharHidder; public class AtomText extends AbstractAtom implements Atom { @@ -101,8 +110,8 @@ public static Atom createUrl(Url url, FontConfiguration fontConfiguration, ISkin private static Atom createAtomText(final String text, Url url, FontConfiguration fontConfiguration, ISkinSimple skinSimple) { - final Pattern p = Pattern.compile(Splitter.openiconPattern + "|" + Splitter.spritePattern2 + "|" - + Splitter.imgPatternNoSrcColon); + final Pattern p = Pattern.compile( + Splitter.openiconPattern + "|" + Splitter.spritePattern2 + "|" + Splitter.imgPatternNoSrcColon); final Matcher m = p.matcher(text); final List result = new ArrayList(); while (m.find()) { @@ -117,17 +126,17 @@ private static Atom createAtomText(final String text, Url url, FontConfiguration if (valOpenicon != null) { final OpenIcon openIcon = OpenIcon.retrieve(valOpenicon); if (openIcon != null) { - final double scale = CommandCreoleImg.getScale(m.group(2), 1); + final double scale = Parser.getScale(m.group(2), 1); result.add(new AtomOpenIcon(null, scale, openIcon, fontConfiguration, url)); } } else if (valSprite != null) { final Sprite sprite = skinSimple.getSprite(valSprite); if (sprite != null) { - final double scale = CommandCreoleImg.getScale(m.group(4), 1); + final double scale = Parser.getScale(m.group(4), 1); result.add(new AtomSprite(null, scale, fontConfiguration, sprite, url)); } } else if (valImg != null) { - final double scale = CommandCreoleImg.getScale(m.group(6), 1); + final double scale = Parser.getScale(m.group(6), 1); result.add(AtomImg.create(valImg, ImgValign.TOP, 0, scale, url)); } @@ -143,19 +152,6 @@ private static Atom createAtomText(final String text, Url url, FontConfiguration return new AtomHorizontalTexts(result); } - public static AtomText createHeading(String text, FontConfiguration fontConfiguration, int order) { - if (order == 0) { - fontConfiguration = fontConfiguration.bigger(4).bold(); - } else if (order == 1) { - fontConfiguration = fontConfiguration.bigger(2).bold(); - } else if (order == 2) { - fontConfiguration = fontConfiguration.bigger(1).bold(); - } else { - fontConfiguration = fontConfiguration.italic(); - } - return new AtomText(text, fontConfiguration, null, ZERO, ZERO); - } - public static Atom createListNumber(final FontConfiguration fontConfiguration, final int order, int localNumber) { final DelayedDouble left = new DelayedDouble() { public double getDouble(StringBounder stringBounder) { @@ -177,14 +173,15 @@ public String toString() { return text + " " + fontConfiguration; } - private AtomText(String text, FontConfiguration style, Url url, DelayedDouble marginLeft, DelayedDouble marginRight) { + private AtomText(String text, FontConfiguration style, Url url, DelayedDouble marginLeft, + DelayedDouble marginRight) { if (text.contains("" + BackSlash.hiddenNewLine())) { throw new IllegalArgumentException(text); } this.marginLeft = marginLeft; this.marginRight = marginRight; - this.text = StringUtils.manageTildeArobaseStart(StringUtils.manageUnicodeNotationUplus(StringUtils - .manageAmpDiese(StringUtils.showComparatorCharacters(CharHidder.unhide(text))))); + this.text = StringUtils.manageTildeArobaseStart(StringUtils.manageUnicodeNotationUplus( + StringUtils.manageAmpDiese(StringUtils.showComparatorCharacters(CharHidder.unhide(text))))); this.fontConfiguration = style; this.url = url; } @@ -235,47 +232,48 @@ private String tabString() { } public void drawU(UGraphic ug) { - if (ug.matchesProperty("SPECIALTXT")) { - ug.draw(this); - return; - } if (url != null) { ug.startUrl(url); } - HtmlColor textColor = fontConfiguration.getColor(); - FontConfiguration useFontConfiguration = fontConfiguration; - if (textColor instanceof HtmlColorAutomatic && ug.getParam().getBackcolor() != null) { - textColor = ((HtmlColorSimple) ug.getParam().getBackcolor()).opposite(); - useFontConfiguration = fontConfiguration.changeColor(textColor); - } - if (marginLeft != ZERO) { - ug = ug.apply(new UTranslate(marginLeft.getDouble(ug.getStringBounder()), 0)); - } - - final StringTokenizer tokenizer = new StringTokenizer(text, "\t", true); + if (ug.matchesProperty("SPECIALTXT")) { + ug.draw(this); + } else { + HColor textColor = fontConfiguration.getColor(); + FontConfiguration useFontConfiguration = fontConfiguration; + if (textColor instanceof HColorAutomatic && ug.getParam().getBackcolor() != null) { + textColor = ((HColorSimple) ug.getParam().getBackcolor()).opposite(); + useFontConfiguration = fontConfiguration.changeColor(textColor); + } + if (marginLeft != ZERO) { + ug = ug.apply(UTranslate.dx(marginLeft.getDouble(ug.getStringBounder()))); + } - double x = 0; - // final int ypos = fontConfiguration.getSpace(); - final Dimension2D rect = ug.getStringBounder().calculateDimension(fontConfiguration.getFont(), text); - final double descent = getDescent(); - final double ypos = rect.getHeight() - descent; - if (tokenizer.hasMoreTokens()) { - final double tabSize = getTabSize(ug.getStringBounder()); - while (tokenizer.hasMoreTokens()) { - final String s = tokenizer.nextToken(); - if (s.equals("\t")) { - final double remainder = x % tabSize; - x += tabSize - remainder; - } else { - final UText utext = new UText(s, useFontConfiguration); - final Dimension2D dim = ug.getStringBounder().calculateDimension(fontConfiguration.getFont(), s); - ug.apply(new UTranslate(x, ypos)).draw(utext); - x += dim.getWidth(); + final StringTokenizer tokenizer = new StringTokenizer(text, "\t", true); + + double x = 0; + // final int ypos = fontConfiguration.getSpace(); + final Dimension2D rect = ug.getStringBounder().calculateDimension(fontConfiguration.getFont(), text); + final double descent = getDescent(); + final double ypos = rect.getHeight() - descent; + if (tokenizer.hasMoreTokens()) { + final double tabSize = getTabSize(ug.getStringBounder()); + while (tokenizer.hasMoreTokens()) { + final String s = tokenizer.nextToken(); + if (s.equals("\t")) { + final double remainder = x % tabSize; + x += tabSize - remainder; + } else { + final UText utext = new UText(s, useFontConfiguration); + final Dimension2D dim = ug.getStringBounder().calculateDimension(fontConfiguration.getFont(), + s); + ug.apply(new UTranslate(x, ypos)).draw(utext); + x += dim.getWidth(); + } } } } if (url != null) { - ug.closeAction(); + ug.closeUrl(); } } @@ -330,10 +328,8 @@ public List getSplitted(StringBounder stringBounder, LineBreakStrategy @Override public List splitInTwo(StringBounder stringBounder, double width) { - final StringTokenizer st = new StringTokenizer(text, " ", true); final StringBuilder tmp = new StringBuilder(); - while (st.hasMoreTokens()) { - final String token = st.nextToken(); + for (String token : splitted()) { if (tmp.length() > 0 && getWidth(stringBounder, tmp.toString() + token) > width) { final Atom part1 = new AtomText(tmp.toString(), fontConfiguration, url, marginLeft, marginRight); String remain = text.substring(tmp.length()); @@ -349,29 +345,57 @@ public List splitInTwo(StringBounder stringBounder, double width) { return Collections.singletonList((Atom) this); } - private List splitLong1(StringBounder stringBounder, double maxWidth, String add) { - return Arrays.asList(add); + private Collection splitted() { + final List result = new ArrayList(); + for (int i = 0; i < text.length(); i++) { + final char ch = text.charAt(i); + if (Character.isLetter(ch)) { + final StringBuilder tmp = new StringBuilder(); + tmp.append(ch); + while (i + 1 < text.length() && Character.isLetter(text.charAt(i + 1))) { + i++; + tmp.append(text.charAt(i)); + } + result.add(tmp.toString()); + } else { + result.add("" + text.charAt(i)); + } + } + return result; } - private List splitLong2(StringBounder stringBounder, double maxWidth, String add) { + private Collection splittedOld() { final List result = new ArrayList(); - if (getWidth(stringBounder, add) <= maxWidth) { - result.add(add); - return result; + final StringTokenizer st = new StringTokenizer(text, " ", true); + while (st.hasMoreTokens()) { + final String token = st.nextToken(); + result.add(token); } - final StringBuilder current = new StringBuilder(); - for (int i = 0; i < add.length(); i++) { - final char c = add.charAt(i); - if (getWidth(stringBounder, current.toString() + c) > maxWidth) { - result.add(current.toString()); - current.setLength(0); + return result; + } + + private List splitInTwoOld(StringBounder stringBounder, double width) { + final StringTokenizer st = new StringTokenizer(text, " ", true); + final StringBuilder tmp = new StringBuilder(); + while (st.hasMoreTokens()) { + final String token = st.nextToken(); + if (tmp.length() > 0 && getWidth(stringBounder, tmp.toString() + token) > width) { + final Atom part1 = new AtomText(tmp.toString(), fontConfiguration, url, marginLeft, marginRight); + String remain = text.substring(tmp.length()); + while (remain.startsWith(" ")) { + remain = remain.substring(1); + } + + final Atom part2 = new AtomText(remain, fontConfiguration, url, marginLeft, marginRight); + return Arrays.asList(part1, part2); } - current.append(c); - } - if (current.length() > 0) { - result.add(current.toString()); + tmp.append(token); } - return result; + return Collections.singletonList((Atom) this); + } + + private List splitLong1(StringBounder stringBounder, double maxWidth, String add) { + return Arrays.asList(add); } public final String getText() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleParser.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/CreoleParser.java similarity index 68% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleParser.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/CreoleParser.java index 202cb2cec..dd50e669a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleParser.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/CreoleParser.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.legacy; import java.util.Arrays; import java.util.List; @@ -36,20 +36,30 @@ import net.sourceforge.plantuml.EmbeddedDiagram; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.creole.CreoleContext; +import net.sourceforge.plantuml.creole.CreoleMode; +import net.sourceforge.plantuml.creole.Parser; +import net.sourceforge.plantuml.creole.Sheet; +import net.sourceforge.plantuml.creole.SheetBuilder; +import net.sourceforge.plantuml.creole.Stripe; +import net.sourceforge.plantuml.creole.atom.Atom; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -public class CreoleParser { +public class CreoleParser implements SheetBuilder { private final FontConfiguration fontConfiguration; private final ISkinSimple skinParam; private final HorizontalAlignment horizontalAlignment; - private final CreoleMode modeSimpleLine; + private final CreoleMode creoleMode; + private final FontConfiguration stereotype; public CreoleParser(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, - ISkinSimple skinParam, CreoleMode modeSimpleLine) { - this.modeSimpleLine = modeSimpleLine; + ISkinSimple skinParam, CreoleMode creoleMode, FontConfiguration stereotype) { + this.stereotype = stereotype; + this.creoleMode = creoleMode; this.fontConfiguration = fontConfiguration; this.skinParam = skinParam; if (skinParam == null) { @@ -58,21 +68,22 @@ public CreoleParser(FontConfiguration fontConfiguration, HorizontalAlignment hor this.horizontalAlignment = horizontalAlignment; } - private Stripe createStripe(String line, CreoleContext context, Stripe lastStripe) { + private Stripe createStripe(String line, CreoleContext context, Stripe lastStripe, + FontConfiguration fontConfiguration) { if (lastStripe instanceof StripeTable && isTableLine(line)) { final StripeTable table = (StripeTable) lastStripe; - table.analyzeAndAddNormal(line); + table.analyzeAndAddLine(line); return null; - } else if (lastStripe instanceof StripeTree && isTreeStart(StringUtils.trinNoTrace(line))) { + } else if (lastStripe instanceof StripeTree && Parser.isTreeStart(StringUtils.trinNoTrace(line))) { final StripeTree tree = (StripeTree) lastStripe; tree.analyzeAndAdd(line); return null; } else if (isTableLine(line)) { return new StripeTable(fontConfiguration, skinParam, line); - } else if (isTreeStart(line)) { + } else if (Parser.isTreeStart(line)) { return new StripeTree(fontConfiguration, skinParam, line); } - return new CreoleStripeSimpleParser(line, context, fontConfiguration, skinParam, modeSimpleLine) + return new CreoleStripeSimpleParser(line, context, fontConfiguration, skinParam, creoleMode) .createStripe(context); } @@ -81,12 +92,7 @@ private static boolean isTableLine(String line) { } public static boolean doesStartByColor(String line) { - return line.matches("^(\\<#\\w+(,#?\\w+)?\\>).*"); - } - - public static boolean isTreeStart(String line) { - // return false; - return line.startsWith("|_"); + return line.matches("^\\=?\\s*(\\<#\\w+(,#?\\w+)?\\>).*"); } public Sheet createSheet(Display display) { @@ -98,7 +104,7 @@ public Sheet createSheet(Display display) { if (cs instanceof EmbeddedDiagram) { final Atom atom = ((EmbeddedDiagram) cs).asDraw(skinParam); stripe = new Stripe() { - public Atom getHeader() { + public Atom getLHeader() { return null; } @@ -106,8 +112,13 @@ public List getAtoms() { return Arrays.asList(atom); } }; + } else if (cs instanceof Stereotype) { + for (String st : ((Stereotype) cs).getLabels(skinParam.guillemet())) { + sheet.add(createStripe(st, context, sheet.getLastStripe(), stereotype)); + } + continue; } else { - stripe = createStripe(cs.toString(), context, sheet.getLastStripe()); + stripe = createStripe(cs.toString(), context, sheet.getLastStripe(), fontConfiguration); } if (stripe != null) { sheet.add(stripe); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleStripeSimpleParser.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/CreoleStripeSimpleParser.java similarity index 91% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleStripeSimpleParser.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/CreoleStripeSimpleParser.java index ea971ab35..930245f9d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/CreoleStripeSimpleParser.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/CreoleStripeSimpleParser.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.legacy; import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.ISkinSimple; @@ -36,6 +36,11 @@ 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.creole.CreoleContext; +import net.sourceforge.plantuml.creole.CreoleMode; +import net.sourceforge.plantuml.creole.Stripe; +import net.sourceforge.plantuml.creole.StripeStyle; +import net.sourceforge.plantuml.creole.StripeStyleType; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.utils.CharHidder; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/PSystemCreole.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/PSystemCreole.java similarity index 77% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/PSystemCreole.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/PSystemCreole.java index 641acf558..60a159a42 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/PSystemCreole.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/PSystemCreole.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.legacy; import java.io.IOException; import java.io.OutputStream; @@ -42,12 +42,16 @@ import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; +import net.sourceforge.plantuml.creole.CreoleMode; +import net.sourceforge.plantuml.creole.Parser; +import net.sourceforge.plantuml.creole.Sheet; +import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemCreole extends AbstractPSystem { @@ -70,18 +74,18 @@ final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatO final Display display = Display.create(lines); final UFont font = UFont.serif(14); final FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(font); - final Sheet sheet = new CreoleParser(fontConfiguration, HorizontalAlignment.LEFT, SkinParam.create(UmlDiagramType.SEQUENCE), CreoleMode.FULL) - .createSheet(display); + final Sheet sheet = Parser.build(fontConfiguration, HorizontalAlignment.LEFT, + SkinParam.create(UmlDiagramType.SEQUENCE), CreoleMode.FULL).createSheet(display); final SheetBlock1 sheetBlock = new SheetBlock1(sheet, LineBreakStrategy.NONE, 0); - final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), 1.0, null, null, null, 0, 0, null, - false); + final ImageBuilder builder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, null, null, 1.0, null); builder.setUDrawable(sheetBlock); return builder.writeImageTOBEMOVED(fileFormat, seed, os); // final Dimension2D dim = TextBlockUtils.getDimension(sheetBlock); - // final UGraphic2 ug = fileFormat.createUGraphic(new ColorMapperIdentity(), 1, dim, null, false); - // // sheetBlock.drawU(ug.apply(new UTranslate(0, 10))); + // final UGraphic2 ug = fileFormat.createUGraphic(new ColorMapperIdentity(), 1, + // dim, null, false); + // // sheetBlock.drawU(ug.apply(UTranslate.dy(10))); // sheetBlock.drawU(ug); // ug.writeImageTOBEMOVED(os, null, 96); // return new ImageDataSimple(dim); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/PSystemCreoleFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/PSystemCreoleFactory.java similarity index 89% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/PSystemCreoleFactory.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/PSystemCreoleFactory.java index 03274878f..b1e2cd597 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/PSystemCreoleFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/PSystemCreoleFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.legacy; import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.core.DiagramType; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeSimple.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/StripeSimple.java similarity index 70% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeSimple.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/StripeSimple.java index 81247f0f9..7fd64c473 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeSimple.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/StripeSimple.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.legacy; import java.util.ArrayList; import java.util.Collections; @@ -37,15 +37,45 @@ import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.creole.CreoleContext; +import net.sourceforge.plantuml.creole.CreoleHorizontalLine; +import net.sourceforge.plantuml.creole.CreoleMode; +import net.sourceforge.plantuml.creole.Stripe; +import net.sourceforge.plantuml.creole.StripeStyle; +import net.sourceforge.plantuml.creole.StripeStyleType; +import net.sourceforge.plantuml.creole.atom.Atom; +import net.sourceforge.plantuml.creole.atom.AtomImg; +import net.sourceforge.plantuml.creole.atom.AtomMath; +import net.sourceforge.plantuml.creole.atom.AtomOpenIcon; +import net.sourceforge.plantuml.creole.atom.AtomSpace; +import net.sourceforge.plantuml.creole.atom.AtomSprite; +import net.sourceforge.plantuml.creole.command.Command; +import net.sourceforge.plantuml.creole.command.CommandCreoleColorAndSizeChange; +import net.sourceforge.plantuml.creole.command.CommandCreoleColorChange; +import net.sourceforge.plantuml.creole.command.CommandCreoleExposantChange; +import net.sourceforge.plantuml.creole.command.CommandCreoleFontFamilyChange; +import net.sourceforge.plantuml.creole.command.CommandCreoleImg; +import net.sourceforge.plantuml.creole.command.CommandCreoleLatex; +import net.sourceforge.plantuml.creole.command.CommandCreoleMath; +import net.sourceforge.plantuml.creole.command.CommandCreoleMonospaced; +import net.sourceforge.plantuml.creole.command.CommandCreoleOpenIcon; +import net.sourceforge.plantuml.creole.command.CommandCreoleQrcode; +import net.sourceforge.plantuml.creole.command.CommandCreoleSizeChange; +import net.sourceforge.plantuml.creole.command.CommandCreoleSpace; +import net.sourceforge.plantuml.creole.command.CommandCreoleSprite; +import net.sourceforge.plantuml.creole.command.CommandCreoleStyle; +import net.sourceforge.plantuml.creole.command.CommandCreoleSvgAttributeChange; +import net.sourceforge.plantuml.creole.command.CommandCreoleUrl; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontPosition; import net.sourceforge.plantuml.graphic.FontStyle; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.ImgValign; import net.sourceforge.plantuml.math.ScientificEquationSafe; import net.sourceforge.plantuml.openiconic.OpenIcon; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; +import net.sourceforge.plantuml.security.SecurityUtils; +import net.sourceforge.plantuml.sprite.Sprite; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.CharHidder; public class StripeSimple implements Stripe { @@ -74,7 +104,7 @@ public String toString() { return super.toString() + " " + atoms.toString(); } - public Atom getHeader() { + public Atom getLHeader() { return header; } @@ -117,16 +147,17 @@ public StripeSimple(FontConfiguration fontConfiguration, StripeStyle style, Creo this.commands.add(CommandCreoleImg.create()); this.commands.add(CommandCreoleQrcode.create()); this.commands.add(CommandCreoleOpenIcon.create(skinParam.getIHtmlColorSet())); - final double scale = skinParam.getDpi() / 96.0; - this.commands.add(CommandCreoleMath.create(scale)); - this.commands.add(CommandCreoleLatex.create(scale)); + this.commands.add(CommandCreoleMath.create()); + this.commands.add(CommandCreoleLatex.create()); this.commands.add(CommandCreoleSprite.create(skinParam.getIHtmlColorSet())); this.commands.add(CommandCreoleSpace.create()); this.commands.add(CommandCreoleFontFamilyChange.create()); this.commands.add(CommandCreoleFontFamilyChange.createEol()); this.commands.add(CommandCreoleMonospaced.create(skinParam.getMonospacedFamily())); this.commands.add(CommandCreoleUrl.create(skinParam)); - this.commands.add(CommandCreoleSvgAttributeChange.create()); + if (SecurityUtils.allowSvgText()) { + this.commands.add(CommandCreoleSvgAttributeChange.create()); + } this.header = style.getHeader(fontConfiguration, context); @@ -159,7 +190,8 @@ public void analyzeAndAdd(String line) { } line = CharHidder.hide(line); if (style.getType() == StripeStyleType.HEADING) { - atoms.add(AtomText.createHeading(line, fontConfiguration, style.getOrder())); + fontConfiguration = fontConfigurationForHeading(fontConfiguration, style.getOrder()); + modifyStripe(line); } else if (style.getType() == StripeStyleType.HORIZONTAL_LINE) { atoms.add(CreoleHorizontalLine.create(fontConfiguration, line, style.getStyle(), skinParam)); } else { @@ -167,6 +199,19 @@ public void analyzeAndAdd(String line) { } } + private static FontConfiguration fontConfigurationForHeading(FontConfiguration fontConfiguration, int order) { + if (order == 0) { + fontConfiguration = fontConfiguration.bigger(4).bold(); + } else if (order == 1) { + fontConfiguration = fontConfiguration.bigger(2).bold(); + } else if (order == 2) { + fontConfiguration = fontConfiguration.bigger(1).bold(); + } else { + fontConfiguration = fontConfiguration.italic(); + } + return fontConfiguration; + } + public void addImage(String src, double scale) { atoms.add(AtomImg.create(src, ImgValign.TOP, 0, scale, null)); } @@ -183,22 +228,22 @@ public void addUrl(Url url) { atoms.add(AtomText.createUrl(url, fontConfiguration, skinParam)); } - public void addSprite(String src, double scale, HtmlColor color) { + public void addSprite(String src, double scale, HColor color) { final Sprite sprite = skinParam.getSprite(src); if (sprite != null) { atoms.add(new AtomSprite(color, scale, fontConfiguration, sprite, null)); } } - public void addOpenIcon(String src, double scale, HtmlColor color) { + public void addOpenIcon(String src, double scale, HColor color) { final OpenIcon openIcon = OpenIcon.retrieve(src); if (openIcon != null) { atoms.add(new AtomOpenIcon(color, scale, openIcon, fontConfiguration, null)); } } - public void addMath(ScientificEquationSafe math, double scale) { - atoms.add(new AtomMath(math, fontConfiguration.getColor(), fontConfiguration.getExtendedColor(), scale, + public void addMath(ScientificEquationSafe math) { + atoms.add(new AtomMath(math, fontConfiguration.getColor(), fontConfiguration.getExtendedColor(), skinParam.getColorMapper())); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeTable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/StripeTable.java similarity index 76% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeTable.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/StripeTable.java index 8129e4dd4..455704321 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeTable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/StripeTable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.legacy; import java.util.ArrayList; import java.util.Collections; @@ -38,9 +38,19 @@ import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; +import net.sourceforge.plantuml.creole.CreoleContext; +import net.sourceforge.plantuml.creole.CreoleMode; +import net.sourceforge.plantuml.creole.Sheet; +import net.sourceforge.plantuml.creole.SheetBlock1; +import net.sourceforge.plantuml.creole.Stripe; +import net.sourceforge.plantuml.creole.StripeStyle; +import net.sourceforge.plantuml.creole.StripeStyleType; +import net.sourceforge.plantuml.creole.atom.Atom; +import net.sourceforge.plantuml.creole.atom.AtomTable; +import net.sourceforge.plantuml.creole.atom.AtomWithMargin; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class StripeTable implements Stripe { @@ -48,7 +58,7 @@ static enum Mode { HEADER, NORMAL }; - private FontConfiguration fontConfiguration; + final private FontConfiguration fontConfiguration; final private ISkinSimple skinParam; final private AtomTable table; final private Atom marged; @@ -57,20 +67,20 @@ static enum Mode { public StripeTable(FontConfiguration fontConfiguration, ISkinSimple skinParam, String line) { this.skinParam = skinParam; this.fontConfiguration = fontConfiguration; - HtmlColor lineColor = getBackOrFrontColor(line, 1); + HColor lineColor = getBackOrFrontColor(line, 1); if (lineColor == null) { lineColor = fontConfiguration.getColor(); } this.table = new AtomTable(lineColor); this.marged = new AtomWithMargin(table, 2, 2); - analyzeAndAddInternal(line, Mode.HEADER); + analyzeAndAddInternal(line); } public List getAtoms() { - return Collections. singletonList(marged); + return Collections.singletonList(marged); } - - public Atom getHeader() { + + public Atom getLHeader() { return null; } @@ -82,7 +92,7 @@ static Atom asAtom(List cells, double padding) { return new SheetBlock1(sheet, LineBreakStrategy.NONE, padding); } - private HtmlColor getBackOrFrontColor(String line, int idx) { + private HColor getBackOrFrontColor(String line, int idx) { if (CreoleParser.doesStartByColor(line)) { final int idx1 = line.indexOf('#'); final int idx2 = line.indexOf('>'); @@ -107,27 +117,29 @@ private String withouBackColor(String line) { private static final String hiddenBar = "\uE000"; - private void analyzeAndAddInternal(String line, Mode mode) { + private void analyzeAndAddInternal(String line) { line = line.replace("\\|", hiddenBar); - HtmlColor lineBackColor = getBackOrFrontColor(line, 0); + HColor lineBackColor = getBackOrFrontColor(line, 0); if (lineBackColor != null) { line = withouBackColor(line); } table.newLine(lineBackColor); for (final StringTokenizer st = new StringTokenizer(line, "|"); st.hasMoreTokens();) { + Mode mode = Mode.NORMAL; String v = st.nextToken().replace(hiddenBar.charAt(0), '|'); - HtmlColor cellBackColor = getBackOrFrontColor(v, 0); + if (v.startsWith("=")) { + v = v.substring(1); + mode = Mode.HEADER; + } + HColor cellBackColor = getBackOrFrontColor(v, 0); if (cellBackColor != null) { v = withouBackColor(v); } - if (mode == Mode.HEADER && v.startsWith("=")) { - v = v.substring(1); - } final List lines = getWithNewlinesInternal(v); final List cells = new ArrayList(); for (String s : lines) { - final StripeSimple cell = new StripeSimple(getFontConfiguration(mode), stripeStyle, - new CreoleContext(), skinParam, CreoleMode.FULL); + final StripeSimple cell = new StripeSimple(getFontConfiguration(mode), stripeStyle, new CreoleContext(), + skinParam, CreoleMode.FULL); if (s.startsWith("")) { cell.setCellAlignment(HorizontalAlignment.RIGHT); s = s.substring("".length()); @@ -174,8 +186,8 @@ private FontConfiguration getFontConfiguration(Mode mode) { return fontConfiguration.bold(); } - public void analyzeAndAddNormal(String line) { - analyzeAndAddInternal(line, Mode.NORMAL); + public void analyzeAndAddLine(String line) { + analyzeAndAddInternal(line); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeTree.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/StripeTree.java similarity index 68% rename from src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeTree.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/StripeTree.java index 01921704c..65ef69402 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/StripeTree.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/legacy/StripeTree.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,12 +28,20 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.creole; +package net.sourceforge.plantuml.creole.legacy; import java.util.Collections; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.creole.CreoleContext; +import net.sourceforge.plantuml.creole.CreoleMode; +import net.sourceforge.plantuml.creole.Stripe; +import net.sourceforge.plantuml.creole.StripeStyle; +import net.sourceforge.plantuml.creole.StripeStyleType; +import net.sourceforge.plantuml.creole.atom.Atom; +import net.sourceforge.plantuml.creole.atom.AtomTree; +import net.sourceforge.plantuml.creole.atom.AtomWithMargin; import net.sourceforge.plantuml.graphic.FontConfiguration; public class StripeTree implements Stripe { @@ -53,10 +61,10 @@ public StripeTree(FontConfiguration fontConfiguration, ISkinSimple skinParam, St } public List getAtoms() { - return Collections. singletonList(marged); + return Collections.singletonList(marged); } - - public Atom getHeader() { + + public Atom getLHeader() { return null; } @@ -65,13 +73,29 @@ public void analyzeAndAdd(String line) { for (String s : lines) { final StripeSimple cell = new StripeSimple(fontConfiguration, stripeStyle, new CreoleContext(), skinParam, CreoleMode.FULL); - // EMTEC final String text = s.replaceFirst("^\\s*\\|_", ""); - final int level = (s.length() - text.length()) / 2; + final int level = computeLevel(s); cell.analyzeAndAdd(text); this.tree.addCell(StripeTable.asAtom(Collections.singletonList(cell), 0), level); } } + private int computeLevel(String s) { + int result = 1; + while (s.length() > 0) { + if (s.startsWith(" ")) { + result++; + s = s.substring(2); + continue; + } else if (s.startsWith("\t")) { + result++; + s = s.substring(1); + continue; + } + return result; + } + return result; + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/AtomText22.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/AtomText22.java new file mode 100644 index 000000000..c76f4f0f5 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/AtomText22.java @@ -0,0 +1,284 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.creole.rosetta; + +import java.awt.font.LineMetrics; +import java.awt.geom.Dimension2D; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.StringTokenizer; + +import net.sourceforge.plantuml.BackSlash; +import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.LineBreakStrategy; +import net.sourceforge.plantuml.Log; +import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.creole.atom.AbstractAtom; +import net.sourceforge.plantuml.creole.atom.Atom; +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorAutomatic; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; +import net.sourceforge.plantuml.utils.CharHidder; + +public class AtomText22 extends AbstractAtom implements Atom { + + interface DelayedDouble { + public double getDouble(StringBounder stringBounder); + } + + private static DelayedDouble ZERO = new DelayedDouble() { + public double getDouble(StringBounder stringBounder) { + return 0; + } + }; + + private final FontConfiguration fontConfiguration; + private final String text; + private final DelayedDouble marginLeft; + private final DelayedDouble marginRight; + private final Url url; + + public static Atom create(String text, FontConfiguration fontConfiguration) { + return new AtomText22(text, fontConfiguration, null, ZERO, ZERO); + } + + @Override + public String toString() { + return text + " " + fontConfiguration; + } + + private AtomText22(String text, FontConfiguration style, Url url, DelayedDouble marginLeft, + DelayedDouble marginRight) { + if (text.contains("" + BackSlash.hiddenNewLine())) { + throw new IllegalArgumentException(text); + } + this.marginLeft = marginLeft; + this.marginRight = marginRight; + this.text = CharHidder.unhide(text); +// this.text = StringUtils.manageTildeArobaseStart(StringUtils.manageUnicodeNotationUplus( +// StringUtils.manageAmpDiese(StringUtils.showComparatorCharacters(CharHidder.unhide(text))))); + this.fontConfiguration = style; + this.url = url; + } + + public FontConfiguration getFontConfiguration() { + return fontConfiguration; + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + final Dimension2D rect = stringBounder.calculateDimension(fontConfiguration.getFont(), text); + Log.debug("g2d=" + rect); + Log.debug("Size for " + text + " is " + rect); + double h = rect.getHeight(); + if (h < 10) { + h = 10; + } + final double width = text.indexOf('\t') == -1 ? rect.getWidth() : getWidth(stringBounder); + final double left = marginLeft.getDouble(stringBounder); + final double right = marginRight.getDouble(stringBounder); + + return new Dimension2DDouble(width + left + right, h); + } + + private double getDescent() { + final LineMetrics fm = TextBlockUtils.getLineMetrics(fontConfiguration.getFont(), text); + final double descent = fm.getDescent(); + return descent; + } + + public double getFontSize2D() { + return fontConfiguration.getFont().getSize2D(); + } + + public double getStartingAltitude(StringBounder stringBounder) { + return fontConfiguration.getSpace(); + } + + private double getTabSize(StringBounder stringBounder) { + return stringBounder.calculateDimension(fontConfiguration.getFont(), tabString()).getWidth(); + } + + private String tabString() { + final int nb = fontConfiguration.getTabSize(); + if (nb >= 1 && nb < 7) { + return " ".substring(0, nb); + } + return " "; + } + + public void drawU(UGraphic ug) { + if (url != null) { + ug.startUrl(url); + } + if (ug.matchesProperty("SPECIALTXT")) { + ug.draw(this); + throw new UnsupportedOperationException("SPECIALTXT"); + } else { + HColor textColor = fontConfiguration.getColor(); + FontConfiguration useFontConfiguration = fontConfiguration; + if (textColor instanceof HColorAutomatic && ug.getParam().getBackcolor() != null) { + textColor = ((HColorSimple) ug.getParam().getBackcolor()).opposite(); + useFontConfiguration = fontConfiguration.changeColor(textColor); + } + if (marginLeft != ZERO) { + ug = ug.apply(UTranslate.dx(marginLeft.getDouble(ug.getStringBounder()))); + } + + final StringTokenizer tokenizer = new StringTokenizer(text, "\t", true); + + double x = 0; + // final int ypos = fontConfiguration.getSpace(); + final Dimension2D rect = ug.getStringBounder().calculateDimension(fontConfiguration.getFont(), text); + final double descent = getDescent(); + final double ypos = rect.getHeight() - descent; + if (tokenizer.hasMoreTokens()) { + final double tabSize = getTabSize(ug.getStringBounder()); + while (tokenizer.hasMoreTokens()) { + final String s = tokenizer.nextToken(); + if (s.equals("\t")) { + final double remainder = x % tabSize; + x += tabSize - remainder; + } else { + final UText utext = new UText(s, useFontConfiguration); + final Dimension2D dim = ug.getStringBounder().calculateDimension(fontConfiguration.getFont(), + s); + ug.apply(new UTranslate(x, ypos)).draw(utext); + x += dim.getWidth(); + } + } + } + } + if (url != null) { + ug.closeUrl(); + } + } + + private double getWidth(StringBounder stringBounder) { + return getWidth(stringBounder, text); + } + + private double getWidth(StringBounder stringBounder, String text) { + final StringTokenizer tokenizer = new StringTokenizer(text, "\t", true); + final double tabSize = getTabSize(stringBounder); + double x = 0; + while (tokenizer.hasMoreTokens()) { + final String s = tokenizer.nextToken(); + if (s.equals("\t")) { + final double remainder = x % tabSize; + x += tabSize - remainder; + } else { + final Dimension2D dim = stringBounder.calculateDimension(fontConfiguration.getFont(), s); + x += dim.getWidth(); + } + } + return x; + } + + public List getSplitted(StringBounder stringBounder, LineBreakStrategy maxWidthAsString) { + final double maxWidth = maxWidthAsString.getMaxWidth(); + if (maxWidth == 0) { + throw new IllegalStateException(); + } + final List result = new ArrayList(); + final StringTokenizer st = new StringTokenizer(text, " ", true); + final StringBuilder currentLine = new StringBuilder(); + while (st.hasMoreTokens()) { + final String token1 = st.nextToken(); + for (String tmp : Arrays.asList(token1)) { + final double w = getWidth(stringBounder, currentLine + tmp); + if (w > maxWidth) { + result.add(new AtomText22(currentLine.toString(), fontConfiguration, url, marginLeft, marginRight)); + currentLine.setLength(0); + if (tmp.startsWith(" ") == false) { + currentLine.append(tmp); + } + } else { + currentLine.append(tmp); + } + } + } + result.add(new AtomText22(currentLine.toString(), fontConfiguration, url, marginLeft, marginRight)); + return Collections.unmodifiableList(result); + + } + + @Override + public List splitInTwo(StringBounder stringBounder, double width) { + final StringBuilder tmp = new StringBuilder(); + for (String token : splitted()) { + if (tmp.length() > 0 && getWidth(stringBounder, tmp.toString() + token) > width) { + final Atom part1 = new AtomText22(tmp.toString(), fontConfiguration, url, marginLeft, marginRight); + String remain = text.substring(tmp.length()); + while (remain.startsWith(" ")) { + remain = remain.substring(1); + } + + final Atom part2 = new AtomText22(remain, fontConfiguration, url, marginLeft, marginRight); + return Arrays.asList(part1, part2); + } + tmp.append(token); + } + return Collections.singletonList((Atom) this); + } + + private Collection splitted() { + final List result = new ArrayList(); + for (int i = 0; i < text.length(); i++) { + final char ch = text.charAt(i); + if (Character.isLetter(ch)) { + final StringBuilder tmp = new StringBuilder(); + tmp.append(ch); + while (i + 1 < text.length() && Character.isLetter(text.charAt(i + 1))) { + i++; + tmp.append(text.charAt(i)); + } + result.add(tmp.toString()); + } else { + result.add("" + text.charAt(i)); + } + } + return result; + } + + public final String getText() { + return text; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/CreoleParser2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/CreoleParser2.java new file mode 100644 index 000000000..6fb4a9a98 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/CreoleParser2.java @@ -0,0 +1,73 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.creole.rosetta; + +import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.creole.CreoleMode; +import net.sourceforge.plantuml.creole.Sheet; +import net.sourceforge.plantuml.creole.SheetBuilder; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; + +public class CreoleParser2 implements SheetBuilder { + + private final FontConfiguration fontConfiguration; + private final ISkinSimple skinParam; + private final HorizontalAlignment horizontalAlignment; + private final CreoleMode creoleMode; + private final FontConfiguration stereotype; + + public CreoleParser2(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, + ISkinSimple skinParam, CreoleMode creoleMode, FontConfiguration stereotype) { + this.stereotype = stereotype; + this.creoleMode = creoleMode; + this.fontConfiguration = fontConfiguration; + this.skinParam = skinParam; + if (skinParam == null) { + throw new IllegalArgumentException(); + } + this.horizontalAlignment = horizontalAlignment; + } + + public Sheet createSheet(Display display) { + final Sheet sheet = new Sheet(horizontalAlignment); + if (display.isWhite() == false) { + final Rosetta rosetta = Rosetta.fromSyntax(WikiLanguage.CREOLE, display); + for (String cs : rosetta.translateTo(WikiLanguage.UNICODE)) { + final StripeRow row = StripeRow.parseUnicode(cs, fontConfiguration); + sheet.add(row); + } + } + return sheet; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/ReaderAbstractWiki.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/ReaderAbstractWiki.java new file mode 100644 index 000000000..30d55eaf5 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/ReaderAbstractWiki.java @@ -0,0 +1,135 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.creole.rosetta; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public abstract class ReaderAbstractWiki implements ReaderWiki { + + static protected final String PNG_OR_GIF = "([-_\\w]+\\.(?:png|gif))"; + + static protected final String BRACKET1 = "\\[([^\\[\\]]+?)\\]"; + static protected final String BRACKET0 = "\\[([^\\[\\]]*?)\\]"; + + final public List transform(String... data) { + return transform(Arrays.asList(data)); + } + + // final protected String protectURL(String s) { + // return WikiLanguage.protectURL(s); + // } + + final protected String rawCode(String s, String start, String end) { + final StringBuilder sb = new StringBuilder(s.length()); + boolean rawMode = false; + boolean rawInRaw = false; + for (int i = 0; i < s.length(); i++) { + if (rawMode == false && s.substring(i).startsWith(start)) { + rawMode = true; + rawInRaw = false; + i += start.length() - 1; + sb.append(WikiLanguage.UNICODE.tag("code")); + if (s.substring(i + 1).startsWith(start)) { + i += start.length(); + sb.append(WikiLanguage.hideCharsF7(start)); + rawInRaw = true; + } + continue; + } + if (rawMode == true && s.substring(i).startsWith(end) && s.substring(i + 1).startsWith(end) == false) { + rawMode = false; + i += end.length() - 1; + if (rawInRaw && s.substring(i + 1).startsWith(end)) { + i += end.length(); + sb.append(WikiLanguage.hideCharsF7(end)); + } + sb.append(WikiLanguage.UNICODE.slashTag("code")); + rawInRaw = false; + continue; + } + char ch = s.charAt(i); + if (rawMode) { + ch = WikiLanguage.toF7(ch); + } + sb.append(ch); + } + return sb.toString(); + } + + protected final String cleanAndHideBackslashSeparator(String s, String sep, String unicodeSep) { + s = s.trim(); + if (s.startsWith(sep)) { + s = s.substring(1); + } + if (s.endsWith(sep)) { + s = s.substring(0, s.length() - 1); + } + s = s.trim(); + final String regex; + if (sep.equals("^") || sep.equals("|")) { + regex = "\\\\\\" + sep; + } else { + throw new IllegalArgumentException(); + } + s = s.replaceAll(regex, unicodeSep); + s = singleLineFormat(s.trim()); + s = s.replace(sep, " " + sep + " "); + return s; + } + + protected abstract String singleLineFormat(String wiki); + + final protected void exportCodeInternal(List uhtml, String tag, List lines) { + uhtml.add(WikiLanguage.UNICODE.tag(tag)); + for (String s : lines) { + uhtml.add(s); + } + uhtml.add(WikiLanguage.UNICODE.slashTag(tag)); + } + + final protected void exportCodeInternalEnsureStartuml(List uhtml, String tag, List lines) { + exportCodeInternal(uhtml, tag, ensureStartuml(lines)); + } + + private List ensureStartuml(List lines) { + final String first = lines.get(0); + if (first.startsWith("@start")) { + return lines; + } + final List copy = new ArrayList(lines); + copy.add(0, "@startuml"); + copy.add("@enduml"); + return copy; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/ReaderCreole.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/ReaderCreole.java new file mode 100644 index 000000000..9ae736482 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/ReaderCreole.java @@ -0,0 +1,70 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.creole.rosetta; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class ReaderCreole extends ReaderAbstractWiki implements ReaderWiki { + + @Override + protected String singleLineFormat(String wiki) { + + // Legacy HTML + wiki = wiki.replace("", WikiLanguage.UNICODE.tag("strong")); + wiki = wiki.replace("", WikiLanguage.UNICODE.slashTag("strong")); + wiki = wiki.replace("", WikiLanguage.UNICODE.tag("em")); + wiki = wiki.replace("", WikiLanguage.UNICODE.slashTag("em")); + + // Em & Strong + wiki = wiki.replaceAll("\\*\\*(.+?)\\*\\*", + WikiLanguage.UNICODE.tag("strong") + "$1" + WikiLanguage.UNICODE.slashTag("strong")); + wiki = wiki.replaceAll("//(.+?)//", + WikiLanguage.UNICODE.tag("em") + "$1" + WikiLanguage.UNICODE.slashTag("em")); + + // Strike + wiki = wiki.replaceAll("--([^-]+?)--", + WikiLanguage.UNICODE.tag("strike") + "$1" + WikiLanguage.UNICODE.slashTag("strike")); + + return wiki; + } + + public List transform(List raw) { + final List uhtml = new ArrayList(); + for (int i = 0; i < raw.size(); i++) { + String current = raw.get(i); + uhtml.add(singleLineFormat(current)); + } + return Collections.unmodifiableList(uhtml); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/ReaderDokuwiki.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/ReaderDokuwiki.java new file mode 100644 index 000000000..ed76ebf61 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/ReaderDokuwiki.java @@ -0,0 +1,356 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.creole.rosetta; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class ReaderDokuwiki extends ReaderAbstractWiki implements ReaderWiki { + + @Override + protected String singleLineFormat(String wiki) { + final boolean endingSlashSlash = wiki.endsWith("\\\\"); + if (endingSlashSlash) { + wiki = wiki.substring(0, wiki.length() - 2); + } + + // Raw %% and '' + wiki = rawCode(wiki, "''%%", "%%''"); + wiki = rawCode(wiki, "%%", "%%"); + wiki = rawCode(wiki, "''", "''"); + + // Protect/escape some character + for (char c : "^|<".toCharArray()) { + wiki = wiki.replace("\\" + c, "" + WikiLanguage.toF7(c)); + } + + // Horizontal lines + wiki = wiki.replaceAll("^___+$", WikiLanguage.UNICODE.tag("hr")); + wiki = wiki.replaceAll("^---+$", WikiLanguage.UNICODE.tag("hr")); + wiki = wiki.replaceAll("^\\*\\*\\*+$", WikiLanguage.UNICODE.tag("hr")); + + // Strike + wiki = wiki.replaceAll("\\([^<>]+?)\\", + WikiLanguage.UNICODE.tag("strike") + "$1" + WikiLanguage.UNICODE.slashTag("strike")); + wiki = wiki.replaceAll("\\([^<>]+?)\\", + WikiLanguage.UNICODE.tag("strike") + "$1" + WikiLanguage.UNICODE.slashTag("strike")); + wiki = wiki.replaceAll("~~([^~]+?)~~", + WikiLanguage.UNICODE.tag("strike") + "$1" + WikiLanguage.UNICODE.slashTag("strike")); + + // break + wiki = wiki.replace("\\\\ ", WikiLanguage.UNICODE.tag("br")); + + // Em & Strong + wiki = wiki.replaceAll("//(.+?)//", + WikiLanguage.UNICODE.tag("em") + "$1" + WikiLanguage.UNICODE.slashTag("em")); + wiki = wiki.replaceAll("\\*\\*(.+?)\\*\\*", + WikiLanguage.UNICODE.tag("strong") + "$1" + WikiLanguage.UNICODE.slashTag("strong")); + wiki = wiki.replace(WikiLanguage.UNICODE.tag("strong") + WikiLanguage.UNICODE.tag("em"), + WikiLanguage.UNICODE.tag("strongem")); + wiki = wiki.replace(WikiLanguage.UNICODE.tag("em") + WikiLanguage.UNICODE.tag("strong"), + WikiLanguage.UNICODE.tag("strongem")); + wiki = wiki.replace(WikiLanguage.UNICODE.slashTag("strong") + WikiLanguage.UNICODE.slashTag("em"), + WikiLanguage.UNICODE.slashTag("strongem")); + wiki = wiki.replace(WikiLanguage.UNICODE.slashTag("em") + WikiLanguage.UNICODE.slashTag("strong"), + WikiLanguage.UNICODE.slashTag("strongem")); + + // Underscore + wiki = wiki.replaceAll("__(.+?)__", WikiLanguage.UNICODE.tag("u") + "$1" + WikiLanguage.UNICODE.slashTag("u")); + + if (endingSlashSlash) { + wiki += WikiLanguage.UNICODE.tag("br"); + } + + return wiki; + } + + public List transform(List raw) { + final List uhtml = new ArrayList(); + for (int i = 0; i < raw.size(); i++) { + String current = raw.get(i); + + if (current.startsWith("FIXME ")) { + continue; + } + + current = current.replaceFirst("^\\s+@start", "@start"); + current = current.replaceFirst("^\\s+@end", "@end"); + + final AutoGroup autoGroup = getAutoGroup(raw, i); + if (autoGroup != null) { + i += autoGroup.getSkipped() - 1; + autoGroup.exportHtml(uhtml); + continue; + } + + final StartEndGroup startEndGroup = getStartEndGroup(raw, i); + if (startEndGroup != null) { + i += startEndGroup.getSkipped() - 1; + startEndGroup.exportHtml(uhtml); + continue; + } + + if (current.length() == 0) { + uhtml.add(WikiLanguage.UNICODE.tag("p")); + } else { + uhtml.add(singleLineFormat(current)); + } + } + return Collections.unmodifiableList(uhtml); + } + + private StartEndGroup getStartEndGroup(List raw, int i) { + if (raw.get(i).equals("")) { + return new StartEndGroup(raw, i, ""); + } + if (raw.get(i).startsWith(""); + } + if (raw.get(i).equals("")) { + return new StartEndGroup(raw, i, ""); + } + return null; + } + + private AutoGroup getAutoGroup(List raw, int i) { + AutoGroup group = getAutoGroup(raw, i, " * ", " * "); + if (group != null) { + return group; + } + group = getAutoGroup(raw, i, " - ", " - "); + if (group != null) { + return group; + } + group = getAutoGroup(raw, i, "\t"); + if (group != null) { + return group; + } + group = getAutoGroup(raw, i, "> "); + if (group != null) { + return group; + } + group = getAutoGroup(raw, i, "] "); + if (group != null) { + return group; + } + group = getAutoGroup(raw, i, " "); + if (group != null) { + return group; + } + group = getAutoGroup(raw, i, "^"); + if (group != null) { + return group; + } + return null; + } + + private AutoGroup getAutoGroup(List raw, int i, String... headers) { + if (raw.get(i).startsWith(headers[0]) == false) { + return null; + } + final AutoGroup result = new AutoGroup(headers); + while (i < raw.size() && result.isInTheGroup(raw.get(i))) { + result.addLine(raw.get(i)); + i++; + } + return result; + } + + class AutoGroup { + + private final List lines = new ArrayList(); + private int skip = 0; + private final String[] headers; + + private AutoGroup(String[] headers) { + this.headers = headers; + } + + private void addLine(String s) { + if (headers[0].equals("> ") && s.equals(">")) { + lines.add(""); + } else if (headers[0].equals("] ") && s.equals("]")) { + lines.add(""); + } else if (headers[0].equals("^")) { + lines.add(s); + } else { + lines.add(s.substring(headers[0].length())); + } + skip++; + } + + private int getSkipped() { + return skip; + } + + private void exportHtml(List uhtml) { + if (headers[0].equals(" * ")) { + exportList(uhtml, "ul"); + } else if (headers[0].equals(" - ")) { + exportList(uhtml, "ol"); + } else if (headers[0].equals(" ")) { + exportCode(uhtml); + } else if (headers[0].equals("\t")) { + exportCode(uhtml); + } else if (headers[0].equals("> ")) { + exportBlockquote(uhtml); + } else if (headers[0].equals("] ")) { + exportFieldset(uhtml); + } else if (headers[0].equals("^")) { + exportTable(uhtml); + } else { + throw new UnsupportedOperationException(); + } + } + + private void exportCode(List uhtml) { + exportCodeInternal(uhtml, "codepre", lines); + } + + private void exportList(List uhtml, String type) { + uhtml.add(WikiLanguage.UNICODE.tag(type)); + for (String s : lines) { + int level = 0; + if (s.startsWith("* ") || s.startsWith("- ")) { + level++; + s = s.substring(2); + } + uhtml.add(WikiLanguage.UNICODE.tag(type + "li", "level", "" + level) + singleLineFormat(s) + + WikiLanguage.UNICODE.slashTag(type + "li")); + } + uhtml.add(WikiLanguage.UNICODE.slashTag(type)); + } + + private void exportFieldset(List uhtml) { + uhtml.add(WikiLanguage.UNICODE.tag("fieldset")); + uhtml.addAll(transform(lines)); + uhtml.add(WikiLanguage.UNICODE.slashTag("fieldset")); + } + + private void exportBlockquote(List uhtml) { + uhtml.add(WikiLanguage.UNICODE.tag("blockquote")); + uhtml.addAll(transform(lines)); + uhtml.add(WikiLanguage.UNICODE.slashTag("blockquote")); + } + + private void exportTable(List uhtml) { + uhtml.add(WikiLanguage.UNICODE.tag("table")); + int i = 0; + int sizeHeader = 0; + for (String s : lines) { + final String sep = i == 0 ? "^" : "|"; + final String tagHeader = i == 0 ? "th" : "tr"; + final String cellHeader = i == 0 ? "tdh" : "td"; + uhtml.add(WikiLanguage.UNICODE.tag(tagHeader)); + + s = cleanAndHideBackslashSeparator(s, sep, "\uF500"); + + final String cols[] = s.split("\\" + sep); + // System.err.println("cols1=" + Arrays.asList(cols)); + if (i == 0) { + sizeHeader = cols.length; + } else if (cols.length != sizeHeader) { + System.err.println("lines=" + lines); + System.err.println("WARNING!!! " + sizeHeader + " " + cols.length); + throw new IllegalStateException("WARNING!!! " + sizeHeader + " " + cols.length); + } + for (String cell : cols) { + cell = cell.trim(); + // if (cell.length() > 0) { + uhtml.add(WikiLanguage.UNICODE.tag(cellHeader)); + // uhtml.add(singleLineFormat(cell)); + uhtml.add(WikiLanguage.restoreAllCharsF7(cell.replace('\uF500', sep.charAt(0)))); + uhtml.add(WikiLanguage.UNICODE.slashTag(cellHeader)); + // } + + } + uhtml.add(WikiLanguage.UNICODE.slashTag(tagHeader)); + i++; + } + uhtml.add(WikiLanguage.UNICODE.slashTag("table")); + } + + public boolean isInTheGroup(String line) { + if (headers[0].equals("^") && line.startsWith("|")) { + return true; + } + if (headers[0].equals("> ") && line.startsWith(">")) { + return true; + } + if (headers[0].equals("] ") && line.startsWith("]")) { + return true; + } + for (String header : headers) { + if (line.startsWith(header)) { + return true; + } + } + return false; + } + } + + class StartEndGroup { + + private final List lines = new ArrayList(); + private int skip = 0; + private final String first; + + private StartEndGroup(List raw, int i, String end) { + this.first = raw.get(i); + skip++; + i++; + while (i < raw.size() && raw.get(i).equals(end) == false) { + lines.add(raw.get(i)); + i++; + skip++; + } + skip++; + } + + private void exportHtml(List uhtml) { + if (first.equals("")) { + exportCodeInternal(uhtml, "codepre", lines); + } else if (first.startsWith("")) { + exportCodeInternalEnsureStartuml(uhtml, "codeandimg", lines); + } else { + throw new UnsupportedOperationException(); + } + } + + private int getSkipped() { + return skip; + } + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Instant.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/ReaderWiki.java similarity index 73% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/Instant.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/ReaderWiki.java index af38745f2..fca9af78a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Instant.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/ReaderWiki.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,14 +28,14 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.creole.rosetta; -public interface Instant extends Value, Comparable { +import java.util.List; - public Instant increment(); +public interface ReaderWiki { - public Instant decrement(); + public static final String REGEX_HTTP = "https?://[^\\s/$.?#][^()\\[\\]\\s]*"; - public String toShortString(); + public List transform(List data); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/Rosetta.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/Rosetta.java new file mode 100644 index 000000000..99b422205 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/Rosetta.java @@ -0,0 +1,95 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.creole.rosetta; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import net.sourceforge.plantuml.cucadiagram.Display; + +public class Rosetta { + + private final List unicodeHtml; + + public static Rosetta fromUnicodeHtml(List lines) { + return new Rosetta(lines); + } + + public static Rosetta fromSyntax(WikiLanguage syntaxSource, String... wiki) { + return new Rosetta(syntaxSource, Arrays.asList(wiki)); + } + + public static Rosetta fromSyntax(WikiLanguage syntaxSource, List wiki) { + return new Rosetta(syntaxSource, wiki); + } + + public static Rosetta fromSyntax(WikiLanguage syntaxSource, Display display) { + return new Rosetta(syntaxSource, from(display)); + } + + private static List from(Display display) { + final List result = new ArrayList(); + for (CharSequence cs : display) { + result.add(cs.toString()); + } + return result; + } + + private Rosetta(List lines) { + this.unicodeHtml = new ArrayList(lines); + } + + private Rosetta(WikiLanguage syntaxSource, List wiki) { + final ReaderWiki reader; + if (syntaxSource == WikiLanguage.DOKUWIKI) { + reader = new ReaderDokuwiki(); + } else if (syntaxSource == WikiLanguage.CREOLE) { + reader = new ReaderCreole(); +// } else if (syntaxSource == WikiLanguage.MARKDOWN) { +// reader = new ReaderMarkdown(); +// } else if (syntaxSource == WikiLanguage.ASCIIDOC) { +// reader = new ReaderAsciidoc(); + } else { + throw new UnsupportedOperationException(); + } + this.unicodeHtml = reader.transform(wiki); + } + + public List translateTo(WikiLanguage syntaxDestination) { + final List html = new ArrayList(); + final WriterWiki writer = new WriterWiki(syntaxDestination); + html.addAll(writer.transform(unicodeHtml)); + return Collections.unmodifiableList(html); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/StripeRow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/StripeRow.java new file mode 100644 index 000000000..2cc4f62a7 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/StripeRow.java @@ -0,0 +1,123 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.creole.rosetta; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.sourceforge.plantuml.creole.Stripe; +import net.sourceforge.plantuml.creole.atom.Atom; +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.graphic.FontStyle; + +public class StripeRow implements Stripe { + + private final List atoms = new ArrayList(); + + public Atom getLHeader() { + return null; + } + + public List getAtoms() { + return Collections.unmodifiableList(atoms); + } + + public void add(Atom atom) { + atoms.add(atom); + } + + private static final Pattern bold = Pattern.compile("^" + WikiLanguage.UNICODE.tag("strong") + "(.*)$"); + private static final Pattern unbold = Pattern.compile("^" + WikiLanguage.UNICODE.slashTag("strong") + "(.*)$"); + private static final Pattern italic = Pattern.compile("^" + WikiLanguage.UNICODE.tag("em") + "(.*)$"); + private static final Pattern unitalic = Pattern.compile("^" + WikiLanguage.UNICODE.slashTag("em") + "(.*)$"); + private static final Pattern strike = Pattern.compile("^" + WikiLanguage.UNICODE.tag("strike") + "(.*)$"); + private static final Pattern unstrike = Pattern.compile("^" + WikiLanguage.UNICODE.slashTag("strike") + "(.*)$"); + + private static Pattern getPattern(String line) { + if (bold.matcher(line).find()) { + return bold; + } + if (unbold.matcher(line).find()) { + return unbold; + } + if (italic.matcher(line).find()) { + return italic; + } + if (unitalic.matcher(line).find()) { + return unitalic; + } + return null; + } + + public static StripeRow parseUnicode(String line, FontConfiguration fontConfiguration) { + final StripeRow result = new StripeRow(); + StringBuilder tmp = new StringBuilder(); + while (line.length() > 0) { + final Pattern cmd = getPattern(line); + if (cmd == null) { + tmp.append(line.charAt(0)); + line = line.substring(1); + continue; + } + if (tmp.length() > 0) { + result.add(AtomText22.create(tmp.toString(), fontConfiguration)); + tmp.setLength(0); + } + final Matcher matcher = cmd.matcher(line); + matcher.find(); + if (cmd == bold) { + fontConfiguration = fontConfiguration.bold(); + } else if (cmd == unbold) { + fontConfiguration = fontConfiguration.unbold(); + } else if (cmd == italic) { + fontConfiguration = fontConfiguration.italic(); + } else if (cmd == unitalic) { + fontConfiguration = fontConfiguration.unitalic(); + } else if (cmd == strike) { + fontConfiguration = fontConfiguration.add(FontStyle.STRIKE); + } else if (cmd == unstrike) { + fontConfiguration = fontConfiguration.remove(FontStyle.STRIKE); + } else { + throw new IllegalStateException(); + } + line = matcher.group(1); + } + assert line.length() == 0; + if (tmp.length() > 0) { + result.add(AtomText22.create(tmp.toString(), fontConfiguration)); + } + return result; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/URosetta.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/URosetta.java new file mode 100644 index 000000000..208560b5e --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/URosetta.java @@ -0,0 +1,36 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.creole.rosetta; + +import net.sourceforge.plantuml.ugraphic.UShape; + +public interface URosetta extends UShape { +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/WikiLanguage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/WikiLanguage.java new file mode 100644 index 000000000..9eeb71cec --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/WikiLanguage.java @@ -0,0 +1,140 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.creole.rosetta; + +public enum WikiLanguage { + DOKUWIKI, MARKDOWN, ASCIIDOC, MEDIAWIKI, CREOLE, UNICODE, HTML_DEBUG; + + public String toString() { + return super.toString().toLowerCase(); + } + + static class MyChar { + + final String unicode; + final String htmlDebug; + + MyChar(String unicode, String htmlDebug) { + this.unicode = unicode; + this.htmlDebug = htmlDebug; + } + + String toRightSyntax(WikiLanguage lg) { + if (lg == WikiLanguage.UNICODE) { + return "" + unicode; + } else if (lg == WikiLanguage.HTML_DEBUG) { + return "" + htmlDebug; + } + throw new UnsupportedOperationException(); + } + + public String toHtmlDebug(String s) { + return s.replace(unicode, htmlDebug); + } + } + + static public String toHtmlDebug(String s) { + s = START.toHtmlDebug(s); + s = END.toHtmlDebug(s); + s = SEMICOLON.toHtmlDebug(s); + s = EQUALS.toHtmlDebug(s); + s = EOB.toHtmlDebug(s); + return s; + } + + private static final MyChar START = new MyChar("\uF800", "<<{{"); + private static final MyChar END = new MyChar("\uF802", "<>"); + + public static String hideCharsF7(String s) { + final StringBuilder sb = new StringBuilder(s.length()); + for (char ch : s.toCharArray()) { + sb.append(toF7(ch)); + } + return sb.toString(); + } + + public static String restoreAllCharsF7AndDoEscapeForBackSlash(String s) { + return restoreAllCharsF7(s); + } + + public static String restoreAllCharsF7(String s) { + final StringBuilder sb = new StringBuilder(s.length()); + for (char ch : s.toCharArray()) { + if (ch >= '\uF700' && ch <= '\uF7FF') { + ch = (char) (ch - '\uF700'); + } + sb.append(ch); + } + return sb.toString(); + } + + public static char toF7(char ch) { + if (ch < 127) { + return (char) ('\uF700' + ch); + } + return ch; + } + + public String slashTag(String tagName) { + final StringBuilder tmp = new StringBuilder(); + tmp.append(END.toRightSyntax(this)); + tmp.append(tagName); + tmp.append(SEMICOLON.toRightSyntax(this)); + tmp.append(EOB.toRightSyntax(this)); + return tmp.toString(); + } + + public String tag(String tagName) { + final StringBuilder tmp = new StringBuilder(); + tmp.append(START.toRightSyntax(this)); + tmp.append(tagName); + tmp.append(SEMICOLON.toRightSyntax(this)); + tmp.append(EOB.toRightSyntax(this)); + return tmp.toString(); + } + + public String tag(String tagName, String name, String value) { + final StringBuilder tmp = new StringBuilder(); + tmp.append(START.toRightSyntax(this)); + tmp.append(tagName); + tmp.append(SEMICOLON.toRightSyntax(this)); + tmp.append(name); + tmp.append(EQUALS.toRightSyntax(this)); + tmp.append(value); + tmp.append(SEMICOLON.toRightSyntax(this)); + tmp.append(EOB.toRightSyntax(this)); + return tmp.toString(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/PlayerConcise.java b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/WriterWiki.java similarity index 54% rename from src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/PlayerConcise.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/WriterWiki.java index 30e98ea8f..487131eb4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/timingdiagram/PlayerConcise.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/creole/rosetta/WriterWiki.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,20 +28,31 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.timingdiagram; +package net.sourceforge.plantuml.creole.rosetta; -import net.sourceforge.plantuml.ISkinParam; +import java.util.ArrayList; +import java.util.List; -public class PlayerConcise extends AbstractPlayer { +public class WriterWiki { - protected TimeDrawing buildDrawing() { - final TimeDrawing result; - result = new Ribbon(ruler, skinParam, notes); - return result; + private final WikiLanguage syntaxDestination; + + public WriterWiki(WikiLanguage syntaxDestination) { + this.syntaxDestination = syntaxDestination; + if (syntaxDestination != WikiLanguage.HTML_DEBUG && syntaxDestination != WikiLanguage.UNICODE) { + throw new IllegalArgumentException(syntaxDestination.toString()); + } } - public PlayerConcise(TitleStrategy titleStrategy, String full, ISkinParam skinParam, TimingRuler ruler) { - super(titleStrategy, full, skinParam, ruler); + public List transform(List data) { + if (syntaxDestination == WikiLanguage.UNICODE) { + return data; + } + final List result = new ArrayList(); + for (String s : data) { + result.add(WikiLanguage.toHtmlDebug(s)); + } + return result; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Bodier.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Bodier.java index f6070b870..d939cb5cf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Bodier.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Bodier.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,206 +30,28 @@ */ package net.sourceforge.plantuml.cucadiagram; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import java.util.Set; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockLineBefore; -import net.sourceforge.plantuml.graphic.TextBlockUtils; -import net.sourceforge.plantuml.skin.VisibilityModifier; -public class Bodier { +public interface Bodier { - private final List rawBody = new ArrayList(); - private final Set hides; - private LeafType type; - private List methodsToDisplay; - private List fieldsToDisplay; - private final boolean manageModifier; - private ILeaf leaf; + public void setLeaf(ILeaf leaf); - public void muteClassToObject() { - methodsToDisplay = null; - fieldsToDisplay = null; - type = LeafType.OBJECT; - } + public List getFieldsToDisplay(); - public Bodier(LeafType type, Set hides) { - this.hides = hides; - this.type = type; - this.manageModifier = type == null ? false : type.manageModifier(); - } + public List getMethodsToDisplay(); - public void setLeaf(ILeaf leaf) { - if (leaf == null) { - throw new IllegalArgumentException(); - } - this.leaf = leaf; + public void addFieldOrMethod(String s); - } + public TextBlock getBody(FontParam fontParam, ISkinParam skinParam, boolean showMethods, boolean showFields, + Stereotype stereotype); - public void addFieldOrMethod(String s, IEntity leaf) { - if (leaf == null) { - throw new IllegalArgumentException(); - } - // Empty cache - methodsToDisplay = null; - fieldsToDisplay = null; - rawBody.add(s); - if (leaf instanceof ILeaf) { - if (this.leaf != null && this.leaf != leaf) { - throw new IllegalArgumentException(); - } - this.leaf = (ILeaf) leaf; - } - } + public List getRawBody(); - private boolean isBodyEnhanced() { - for (String s : rawBody) { - if (BodyEnhanced.isBlockSeparator(s)) { - return true; - } - } - return false; - } - - private boolean isMethod(String s) { - if (type == LeafType.ANNOTATION || type == LeafType.ABSTRACT_CLASS || type == LeafType.CLASS - || type == LeafType.INTERFACE || type == LeafType.ENUM) { - return MemberImpl.isMethod(s); - } - return false; - } - - public List getMethodsToDisplay() { - if (methodsToDisplay == null) { - methodsToDisplay = new ArrayList(); - for (int i = 0; i < rawBody.size(); i++) { - final String s = rawBody.get(i); - if (isMethod(i, rawBody) == false) { - continue; - } - if (s.length() == 0 && methodsToDisplay.size() == 0) { - continue; - } - final Member m = new MemberImpl(s, true, manageModifier); - if (hides == null || hides.contains(m.getVisibilityModifier()) == false) { - methodsToDisplay.add(m); - } - } - removeFinalEmptyMembers(methodsToDisplay); - } - return Collections.unmodifiableList(methodsToDisplay); - } - - private boolean isMethod(int i, List rawBody) { - if (i > 0 && i < rawBody.size() - 1 && rawBody.get(i).length() == 0 && isMethod(rawBody.get(i - 1)) - && isMethod(rawBody.get(i + 1))) { - return true; - } - return isMethod(rawBody.get(i)); - } - - public List getFieldsToDisplay() { - if (fieldsToDisplay == null) { - fieldsToDisplay = new ArrayList(); - for (String s : rawBody) { - if (isMethod(s) == true) { - continue; - } - if (s.length() == 0 && fieldsToDisplay.size() == 0) { - continue; - } - final Member m = new MemberImpl(s, false, manageModifier); - if (hides == null || hides.contains(m.getVisibilityModifier()) == false) { - fieldsToDisplay.add(m); - } - } - removeFinalEmptyMembers(fieldsToDisplay); - } - return Collections.unmodifiableList(fieldsToDisplay); - } - - private void removeFinalEmptyMembers(List result) { - while (result.size() > 0 && StringUtils.trin(result.get(result.size() - 1).getDisplay(false)).length() == 0) { - result.remove(result.size() - 1); - } - } - - public boolean hasUrl() { - for (Member m : getFieldsToDisplay()) { - if (m.hasUrl()) { - return true; - } - } - for (Member m : getMethodsToDisplay()) { - if (m.hasUrl()) { - return true; - } - } - return false; - } - - private List rawBodyWithoutHidden() { - if (hides == null || hides.size() == 0) { - return rawBody; - } - final List result = new ArrayList(); - for (String s : rawBody) { - final Member m = new MemberImpl(s, isMethod(s), manageModifier); - if (hides.contains(m.getVisibilityModifier()) == false) { - result.add(s); - } - - } - return result; - } - - public TextBlock getBody(final FontParam fontParam, final ISkinParam skinParam, final boolean showMethods, - final boolean showFields, Stereotype stereotype) { - if (type.isLikeClass() && isBodyEnhanced()) { - if (showMethods || showFields) { - return new BodyEnhanced(rawBodyWithoutHidden(), fontParam, skinParam, manageModifier, stereotype, leaf); - } - return null; - } - if (leaf == null) { - throw new IllegalStateException(); - } - final MethodsOrFieldsArea fields = new MethodsOrFieldsArea(getFieldsToDisplay(), fontParam, skinParam, - stereotype, leaf); - if (type == LeafType.OBJECT) { - if (showFields == false) { - return new TextBlockLineBefore(TextBlockUtils.empty(0, 0)); - } - return fields.asBlockMemberImpl(); - } - if (type.isLikeClass() == false) { - throw new UnsupportedOperationException(); - } - final MethodsOrFieldsArea methods = new MethodsOrFieldsArea(getMethodsToDisplay(), fontParam, skinParam, - stereotype, leaf); - if (showFields && showMethods == false) { - return fields.asBlockMemberImpl(); - } else if (showMethods && showFields == false) { - return methods.asBlockMemberImpl(); - } else if (showFields == false && showMethods == false) { - return TextBlockUtils.empty(0, 0); - } - - final TextBlock bb1 = fields.asBlockMemberImpl(); - final TextBlock bb2 = methods.asBlockMemberImpl(); - return TextBlockUtils.mergeTB(bb1, bb2, HorizontalAlignment.LEFT); - } - - public List getRawBody() { - return Collections.unmodifiableList(rawBody); - } + public void muteClassToObject(); + public boolean hasUrl(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/BodierImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/BodierImpl.java new file mode 100644 index 000000000..6769a589e --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/BodierImpl.java @@ -0,0 +1,231 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.cucadiagram; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Set; + +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.TextBlockLineBefore; +import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.skin.VisibilityModifier; +import net.sourceforge.plantuml.style.SName; + +public class BodierImpl implements Bodier { + + private final List rawBody = new ArrayList(); + private final Set hides; + private LeafType type; + private List methodsToDisplay; + private List fieldsToDisplay; + private final boolean manageModifier; + private ILeaf leaf; + + public void muteClassToObject() { + methodsToDisplay = null; + fieldsToDisplay = null; + type = LeafType.OBJECT; + } + + public BodierImpl(LeafType type, Set hides) { + if (type == LeafType.MAP) { + throw new IllegalArgumentException(); + } + this.hides = hides; + this.type = type; + this.manageModifier = type == null ? false : type.manageModifier(); + } + + public void setLeaf(ILeaf leaf) { + if (leaf == null) { + throw new IllegalArgumentException(); + } + this.leaf = leaf; + + } + + public void addFieldOrMethod(String s) { + // Empty cache + methodsToDisplay = null; + fieldsToDisplay = null; + rawBody.add(s); + } + + private boolean isBodyEnhanced() { + for (String s : rawBody) { + if (BodyEnhanced.isBlockSeparator(s)) { + return true; + } + } + return false; + } + + private boolean isMethod(String s) { + if (type == LeafType.ANNOTATION || type == LeafType.ABSTRACT_CLASS || type == LeafType.CLASS + || type == LeafType.INTERFACE || type == LeafType.ENUM) { + return Member.isMethod(s); + } + return false; + } + + public List getMethodsToDisplay() { + if (methodsToDisplay == null) { + methodsToDisplay = new ArrayList(); + for (int i = 0; i < rawBody.size(); i++) { + final String s = rawBody.get(i); + if (isMethod(i, rawBody) == false) { + continue; + } + if (s.length() == 0 && methodsToDisplay.size() == 0) { + continue; + } + final Member m = new Member(s, true, manageModifier); + if (hides == null || hides.contains(m.getVisibilityModifier()) == false) { + methodsToDisplay.add(m); + } + } + removeFinalEmptyMembers(methodsToDisplay); + } + return Collections.unmodifiableList(methodsToDisplay); + } + + private boolean isMethod(int i, List rawBody) { + if (i > 0 && i < rawBody.size() - 1 && rawBody.get(i).length() == 0 && isMethod(rawBody.get(i - 1)) + && isMethod(rawBody.get(i + 1))) { + return true; + } + return isMethod(rawBody.get(i)); + } + + public List getFieldsToDisplay() { + if (fieldsToDisplay == null) { + fieldsToDisplay = new ArrayList(); + for (String s : rawBody) { + if (isMethod(s) == true) { + continue; + } + if (s.length() == 0 && fieldsToDisplay.size() == 0) { + continue; + } + final Member m = new Member(s, false, manageModifier); + if (hides == null || hides.contains(m.getVisibilityModifier()) == false) { + fieldsToDisplay.add(m); + } + } + removeFinalEmptyMembers(fieldsToDisplay); + } + return Collections.unmodifiableList(fieldsToDisplay); + } + + private void removeFinalEmptyMembers(List result) { + while (result.size() > 0 && StringUtils.trin(result.get(result.size() - 1).getDisplay(false)).length() == 0) { + result.remove(result.size() - 1); + } + } + + public boolean hasUrl() { + for (Member m : getFieldsToDisplay()) { + if (m.hasUrl()) { + return true; + } + } + for (Member m : getMethodsToDisplay()) { + if (m.hasUrl()) { + return true; + } + } + return false; + } + + private List rawBodyWithoutHidden() { + if (hides == null || hides.size() == 0) { + return rawBody; + } + final List result = new ArrayList(); + for (String s : rawBody) { + final Member m = new Member(s, isMethod(s), manageModifier); + if (hides.contains(m.getVisibilityModifier()) == false) { + result.add(s); + } + + } + return result; + } + + public TextBlock getBody(final FontParam fontParam, final ISkinParam skinParam, final boolean showMethods, + final boolean showFields, Stereotype stereotype) { + if (type.isLikeClass() && isBodyEnhanced()) { + if (showMethods || showFields) { + return new BodyEnhanced(rawBodyWithoutHidden(), fontParam, skinParam, manageModifier, stereotype, leaf, + SName.classDiagram); + } + return null; + } + if (leaf == null) { + throw new IllegalStateException(); + } + final MethodsOrFieldsArea fields = new MethodsOrFieldsArea(getFieldsToDisplay(), fontParam, skinParam, + stereotype, leaf, SName.classDiagram); + if (type == LeafType.OBJECT) { + if (showFields == false) { + return new TextBlockLineBefore(TextBlockUtils.empty(0, 0)); + } + return fields.asBlockMemberImpl(); + } + if (type.isLikeClass() == false) { + throw new UnsupportedOperationException(); + } + final MethodsOrFieldsArea methods = new MethodsOrFieldsArea(getMethodsToDisplay(), fontParam, skinParam, + stereotype, leaf, SName.classDiagram); + if (showFields && showMethods == false) { + return fields.asBlockMemberImpl(); + } else if (showMethods && showFields == false) { + return methods.asBlockMemberImpl(); + } else if (showFields == false && showMethods == false) { + return TextBlockUtils.empty(0, 0); + } + + final TextBlock bb1 = fields.asBlockMemberImpl(); + final TextBlock bb2 = methods.asBlockMemberImpl(); + return TextBlockUtils.mergeTB(bb1, bb2, HorizontalAlignment.LEFT); + } + + public List getRawBody() { + return Collections.unmodifiableList(rawBody); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/BodierMap.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/BodierMap.java new file mode 100644 index 000000000..aa83fb9f6 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/BodierMap.java @@ -0,0 +1,107 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.cucadiagram; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.graphic.TextBlock; + +public class BodierMap implements Bodier { + + private final List rawBody = new ArrayList(); + private final Map map = new LinkedHashMap(); + private ILeaf leaf; + + public void muteClassToObject() { + throw new UnsupportedOperationException(); + } + + public BodierMap() { + } + + public void setLeaf(ILeaf leaf) { + if (leaf == null) { + throw new IllegalArgumentException(); + } + this.leaf = leaf; + + } + + public static String getLinkedEntry(String s) { + final Pattern p = Pattern.compile("(\\*-+\\>)"); + final Matcher m = p.matcher(s); + if (m.find()) { + return m.group(1); + } + return null; + } + + public void addFieldOrMethod(String s) { + if (s.contains("=>")) { + final int x = s.indexOf("=>"); + map.put(s.substring(0, x).trim(), s.substring(x + 2).trim()); + } else if (getLinkedEntry(s) != null) { + final String link = getLinkedEntry(s); + final int x = s.indexOf(link); + map.put(s.substring(0, x).trim(), "\0"); + } + } + + public List getMethodsToDisplay() { + throw new UnsupportedOperationException(); + } + + public List getFieldsToDisplay() { + throw new UnsupportedOperationException(); + } + + public boolean hasUrl() { + return false; + } + + public TextBlock getBody(FontParam fontParam, ISkinParam skinParam, final boolean showMethods, + final boolean showFields, Stereotype stereotype) { + return new TextBlockMap(fontParam, skinParam, map); + } + + public List getRawBody() { + return Collections.unmodifiableList(rawBody); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java index 0b245d165..86606ee37 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -44,7 +44,7 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.creole.CreoleMode; -import net.sourceforge.plantuml.creole.CreoleParser; +import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; @@ -54,13 +54,14 @@ import net.sourceforge.plantuml.graphic.TextBlockLineBefore; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockVertical2; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.svek.Ports; import net.sourceforge.plantuml.svek.WithPorts; import net.sourceforge.plantuml.ugraphic.UGraphic; public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPorts { - private TextBlock area2; + private TextBlock area; private final FontConfiguration titleConfig; private final List rawBody; private final FontParam fontParam; @@ -73,9 +74,12 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo private final Stereotype stereotype; private final ILeaf entity; private final boolean inEllipse; + private final double minClassWidth; + private final SName diagramType; public BodyEnhanced(List rawBody, FontParam fontParam, ISkinParam skinParam, boolean manageModifier, - Stereotype stereotype, ILeaf entity) { + Stereotype stereotype, ILeaf entity, SName diagramType) { + this.diagramType = diagramType; this.rawBody = new ArrayList(rawBody); this.stereotype = stereotype; this.fontParam = fontParam; @@ -88,10 +92,21 @@ public BodyEnhanced(List rawBody, FontParam fontParam, ISkinParam skinPa this.manageModifier = manageModifier; this.entity = entity; this.inEllipse = false; + this.minClassWidth = 0; } public BodyEnhanced(Display display, FontParam fontParam, ISkinParam skinParam, HorizontalAlignment align, - Stereotype stereotype, boolean manageHorizontalLine, boolean manageModifier, ILeaf entity) { + Stereotype stereotype, boolean manageHorizontalLine, boolean manageModifier, ILeaf entity, + SName diagramType) { + this(display, fontParam, skinParam, align, stereotype, manageHorizontalLine, manageHorizontalLine, entity, 0, + diagramType); + } + + public BodyEnhanced(Display display, FontParam fontParam, ISkinParam skinParam, HorizontalAlignment align, + Stereotype stereotype, boolean manageHorizontalLine, boolean manageModifier, ILeaf entity, + double minClassWidth, SName diagramType) { + this.diagramType = diagramType; + this.minClassWidth = minClassWidth; this.entity = entity; this.stereotype = stereotype; this.rawBody = new ArrayList(); @@ -132,8 +147,8 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { } private TextBlock getArea(StringBounder stringBounder) { - if (area2 != null) { - return area2; + if (area != null) { + return area; } urls.clear(); final List blocks = new ArrayList(); @@ -150,22 +165,22 @@ private TextBlock getArea(StringBounder stringBounder) { final String s = s2.toString(); if (manageHorizontalLine && isBlockSeparator(s)) { blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align, - stereotype, entity), separator, title)); + stereotype, entity, diagramType), separator, title)); separator = s.charAt(0); title = getTitle(s, skinParam); members = new ArrayList(); - } else if (CreoleParser.isTreeStart(s)) { + } else if (Parser.isTreeStart(s)) { if (members.size() > 0) { - blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, - align, stereotype, entity), separator, title)); + blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align, + stereotype, entity, diagramType), separator, title)); } members = new ArrayList(); final List allTree = buildAllTree(s, it); - final TextBlock bloc = Display.create(allTree).create(fontParam.getFontConfiguration(skinParam), + final TextBlock bloc = Display.create(allTree).create7(fontParam.getFontConfiguration(skinParam), align, skinParam, CreoleMode.FULL); blocks.add(bloc); } else { - final Member m = new MemberImpl(s, MemberImpl.isMethod(s), manageModifier); + final Member m = new Member(s, Member.isMethod(s), manageModifier); members.add(m); if (m.getUrl() != null) { urls.add(m.getUrl()); @@ -174,18 +189,23 @@ private TextBlock getArea(StringBounder stringBounder) { } } if (inEllipse && members.size() == 0) { - members.add(new MemberImpl("", false, false)); + members.add(new Member("", false, false)); } - blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype, - entity), separator, title)); + blocks.add(decorate(stringBounder, + new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype, entity, diagramType), + separator, title)); if (blocks.size() == 1) { - this.area2 = blocks.get(0); + this.area = blocks.get(0); } else { - this.area2 = new TextBlockVertical2(blocks, align); + this.area = new TextBlockVertical2(blocks, align); + } + if (minClassWidth > 0) { + this.area = TextBlockUtils.withMinWidth(this.area, minClassWidth, + skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT)); } - return area2; + return area; } private static List buildAllTree(String init, ListIterator it) { @@ -193,7 +213,7 @@ private static List buildAllTree(String init, ListIterator { - - private final String fullName; - private final String separator; - - private Code(String fullName, String separator) { - if (fullName == null) { - throw new IllegalArgumentException(); - } - this.fullName = fullName; - this.separator = separator; - } - - public Code removeMemberPart() { - final int x = fullName.lastIndexOf("::"); - if (x == -1) { - return null; - } - return new Code(fullName.substring(0, x), separator); - } - - public String getPortMember() { - final int x = fullName.lastIndexOf("::"); - if (x == -1) { - return null; - } - return fullName.substring(x + 2); - } - - public Code withSeparator(String separator) { - if (separator == null) { - throw new IllegalArgumentException(); - } - if (this.separator != null && this.separator.equals(separator) == false) { - throw new IllegalStateException(); - } - return new Code(fullName, separator); - } - - public static Code of(String code) { - return of(code, null); - } - - public static Code of(String code, String separator) { - if (code == null) { - return null; - } - return new Code(code, separator); - } - - public final String getFullName() { - return fullName; - } - - @Override - public String toString() { - return fullName + "(" + separator + ")"; - } - - @Override - public int hashCode() { - return fullName.hashCode(); - } - - @Override - public boolean equals(Object obj) { - final Code other = (Code) obj; - return this.fullName.equals(other.fullName); - } - - public Code addSuffix(String suffix) { - return new Code(fullName + suffix, separator); - } - - public int compareTo(Code other) { - return this.fullName.compareTo(other.fullName); - } - - public Code eventuallyRemoveStartingAndEndingDoubleQuote(String format) { - return Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(fullName, format), separator); - } - - public final String getSeparator() { - return separator; - } + public String getName(); + public Code eventuallyRemoveStartingAndEndingDoubleQuote(String format); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Resource.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/CodeImpl.java similarity index 55% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/Resource.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/CodeImpl.java index 70a6dbc88..630e6a31f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Resource.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/CodeImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,32 +28,31 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.cucadiagram; -import java.util.Set; -import java.util.TreeSet; +import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory; -public class Resource implements Subject /* , LoadPlanable */{ +public class CodeImpl implements Code { private final String name; - private ResourceDraw draw; - // private final LoadPlanable loadPlanable; - private Set closed = new TreeSet(); - public Resource(String name, LoadPlanable loadPlanable) { + private CodeImpl(String name) { + if (name == null) { + throw new IllegalArgumentException(); + } this.name = name; - // this.loadPlanable = loadPlanable; } - @Override - public int hashCode() { - return name.hashCode(); + public static Code of(String code) { + if (code == null) { + EntityFactory.bigError(); + } + return new CodeImpl(code); } - @Override - public boolean equals(Object obj) { - final Resource other = (Resource) obj; - return this.name.equals(other.name); + public final String getName() { + return name; } @Override @@ -61,30 +60,20 @@ public String toString() { return name; } - public String getName() { - return name; + @Override + public int hashCode() { + return name.hashCode(); } - public ResourceDraw getResourceDraw() { - return draw; + @Override + public boolean equals(Object obj) { + final CodeImpl other = (CodeImpl) obj; + return this.name.equals(other.name); } - public void setTaskDraw(ResourceDraw draw) { - this.draw = draw; - } - public boolean isClosedAt(Instant instant) { - return this.closed.contains(instant); + public Code eventuallyRemoveStartingAndEndingDoubleQuote(String format) { + return CodeImpl.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(getName(), format)); } -// public int getLoadAt(Instant instant) { -// if (this.closed.contains(instant)) { -// return 0; -// } -// return loadPlanable.getLoadAt(instant); -// } - - public void addCloseDay(Instant instant) { - this.closed.add(instant); - } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java index cd163775d..bb21478ab 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,7 +32,6 @@ import java.io.IOException; import java.io.OutputStream; -import java.io.PrintStream; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -48,45 +47,95 @@ import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.api.ImageDataSimple; +import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.ImageData; +import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.cucadiagram.dot.CucaDiagramTxtMaker; import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.jdot.CucaDiagramFileMakerJDot; +import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.statediagram.StateDiagram; import net.sourceforge.plantuml.svek.CucaDiagramFileMaker; import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek; -import net.sourceforge.plantuml.ugraphic.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.xmi.CucaDiagramXmiMaker; import net.sourceforge.plantuml.xmlsc.StateDiagramScxmlMaker; public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy, PortionShower { + static private final boolean G1972 = false; + + // private String namespaceSeparator = "."; + // private String namespaceSeparator1 = GO1972 ? "::" : "."; + private String namespaceSeparator = null; + private boolean namespaceSeparatorHasBeenSet = false; + + public final boolean V1972() { + if (getPragma().backToLegacyPackage()) { + return false; + } + if (getPragma().useNewPackage()) { + return true; + } + if (G1972) + return true; + return false; + } + + public final boolean mergeIntricated() { + if (getNamespaceSeparator() == null) { + return false; + } + return this.V1972() && this.getUmlDiagramType() == UmlDiagramType.CLASS; + } + + public Set getAllSuperGroups() { + return entityFactory.getAllSuperGroups(); + } + private int horizontalPages = 1; private int verticalPages = 1; private final List hides2 = new ArrayList(); private final List removed = new ArrayList(); - protected final EntityFactory entityFactory = new EntityFactory(hides2, removed); + protected final EntityFactory entityFactory = new EntityFactory(hides2, removed, this); private IGroup currentGroup = entityFactory.getRootGroup(); + private List stacks2 = new ArrayList(); + private List stacks = new ArrayList(); private boolean visibilityModifierPresent; - public abstract IEntity getOrCreateLeaf(Code code, LeafType type, USymbol symbol); + public abstract IEntity getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol); + + public Ident cleanIdent(Ident ident) { + return ident; + } - public CucaDiagram(ISkinSimple orig) { super(orig); + this.stacks2.add(Ident.empty()); } - private String namespaceSeparator = "."; + private Ident getLastID() { + if (stacks2.size() == 0) { + // Thread.dumpStack(); + return Ident.empty(); + // throw new IllegalArgumentException(); + } + return this.stacks2.get(stacks2.size() - 1); + } final public void setNamespaceSeparator(String namespaceSeparator) { + this.namespaceSeparatorHasBeenSet = true; this.namespaceSeparator = namespaceSeparator; } final public String getNamespaceSeparator() { + if (namespaceSeparatorHasBeenSet == false) { + return V1972() ? "::" : "."; + } return namespaceSeparator; } @@ -97,7 +146,7 @@ public boolean hasUrl() { return true; } } - for (IEntity entity : entityFactory.getLeafsvalues()) { + for (IEntity entity : entityFactory.leafs()) { if (entity.hasUrl()) { return true; } @@ -110,13 +159,22 @@ public boolean hasUrl() { return false; } - final protected ILeaf getOrCreateLeafDefault(Code code, LeafType type, USymbol symbol) { + final public void setLastEntity(ILeaf foo) { + this.lastEntity = foo; + } + + final protected ILeaf getOrCreateLeafDefault(Ident idNewLong, Code code, LeafType type, USymbol symbol) { + checkNotNull(idNewLong); if (type == null) { throw new IllegalArgumentException(); } - ILeaf result = entityFactory.getLeafsget(code); + ILeaf result; + if (this.V1972()) + result = entityFactory.getLeafStrict(idNewLong); + else + result = entityFactory.getLeaf(code); if (result == null) { - result = createLeafInternal(code, Display.getWithNewlines(code), type, symbol); + result = createLeafInternal(idNewLong, code, Display.getWithNewlines(code), type, symbol); result.setUSymbol(symbol); } if (result.getLeafType() == LeafType.CLASS && type == LeafType.OBJECT) { @@ -128,19 +186,22 @@ final protected ILeaf getOrCreateLeafDefault(Code code, LeafType type, USymbol s return result; } - public ILeaf createLeaf(Code code, Display display, LeafType type, USymbol symbol) { - if (entityFactory.getLeafsget(code) != null) { + public ILeaf createLeaf(Ident idNewLong, Code code, Display display, LeafType type, USymbol symbol) { + checkNotNull(idNewLong); + if (entityFactory.getLeafStrict(idNewLong) != null) { return null; // throw new IllegalArgumentException("Already known: " + code); } - return createLeafInternal(code, display, type, symbol); + return createLeafInternal(idNewLong, code, display, type, symbol); } - final protected ILeaf createLeafInternal(Code code, Display display, LeafType type, USymbol symbol) { + final protected ILeaf createLeafInternal(Ident newIdent, Code code, Display display, LeafType type, + USymbol symbol) { + checkNotNull(newIdent); if (Display.isNull(display)) { - display = Display.getWithNewlines(code); + display = Display.getWithNewlines(code).withCreoleMode(CreoleMode.SIMPLE_LINE); } - final ILeaf leaf = entityFactory.createLeaf(code, display, type, getCurrentGroup(), getHides(), + final ILeaf leaf = entityFactory.createLeaf(newIdent, code, display, type, getCurrentGroup(), getHides(), getNamespaceSeparator()); entityFactory.addLeaf(leaf); this.lastEntity = leaf; @@ -148,11 +209,56 @@ final protected ILeaf createLeafInternal(Code code, Display display, LeafType ty return leaf; } + final public Ident buildLeafIdent(String id) { + return getLastID().add(id, getNamespaceSeparator()); + } + + final public Ident buildLeafIdentSpecial(String id) { + return buildFullyQualified(id); + } + + private Ident buildLeafIdentSpecialUnused(String id) { +// if (namespaceSeparator != null) { +// if (id.contains(namespaceSeparator)) { + return Ident.empty().add(id, "."); +// } +// } +// return getLastID().add(id, namespaceSeparator); + } + + final public Ident buildFullyQualified(String id) { + return entityFactory.buildFullyQualified(getLastID(), Ident.empty().add(id, getNamespaceSeparator())); + } + + final public Code buildCode(String s) { + if (this.V1972()) + throw new UnsupportedOperationException(); + return CodeImpl.of(s); + } + + protected final void checkNotNull(Object id) { + if (id == null) { + throw new IllegalArgumentException(); + } + } + public boolean leafExist(Code code) { - return entityFactory.getLeafsget(code) != null; + if (this.V1972()) + throw new UnsupportedOperationException(); + return entityFactory.getLeaf(code) != null; + } + + public boolean leafExistSmart(Ident ident) { + return entityFactory.getLeafSmart(ident) != null; + } + + public boolean leafExistStrict(Ident ident) { + return entityFactory.getLeafStrict(ident) != null; } final public Collection getChildrenGroups(IGroup parent) { + if (this.V1972()) + return getChildrenGroupsIdent1972(parent); final Collection result = new ArrayList(); for (IGroup gg : getGroups(false)) { if (gg.getParentContainer() == parent) { @@ -162,61 +268,191 @@ final public Collection getChildrenGroups(IGroup parent) { return Collections.unmodifiableCollection(result); } - final public void gotoGroup2(Code code, Display display, GroupType type, IGroup parent, NamespaceStrategy strategy) { + private Collection getChildrenGroupsIdent1972(IGroup parent) { + final Collection result = new ArrayList(); + for (IGroup gg : entityFactory.groups2()) { + if (gg.getIdent().parent().equals(parent.getIdent())) { + result.add(gg); + } + } + return Collections.unmodifiableCollection(result); + } + + final public void gotoGroup(Ident ident, Code code, Display display, GroupType type, IGroup parent, + NamespaceStrategy strategy) { + if (this.V1972()) { + gotoGroupInternalWithNamespace(ident, code, display, code, type, parent); + return; + + } if (strategy == NamespaceStrategy.MULTIPLE) { if (getNamespaceSeparator() != null) { - code = getFullyQualifiedCode(code.withSeparator(getNamespaceSeparator())); + code = getFullyQualifiedCode1972(code); } - gotoGroupInternal(code, display, code, type, parent); + gotoGroupInternalWithNamespace(ident, code, display, code, type, parent); } else if (strategy == NamespaceStrategy.SINGLE) { - gotoGroupInternal(code, display, null, type, parent); + final Ident newIdLong = buildLeafIdentSpecial(ident.toString(this.getNamespaceSeparator())); + gotoGroupExternal(newIdLong, code, display, null, type, parent); + stacks2.add(newIdLong); } else { throw new IllegalArgumentException(); } } - final protected void gotoGroupInternal(final Code code, Display display, final Code namespace2, GroupType type, - IGroup parent) { - IGroup result = entityFactory.getGroupsget(code); + protected final String getNamespace1972(Code fullyCode, String separator) { + String name = fullyCode.getName(); + if (separator == null) { + throw new IllegalArgumentException(toString()); + } + do { + final int x = name.lastIndexOf(separator); + if (x == -1) { + return null; + } + name = name.substring(0, x); + } while (entityFactory.getLeaf(buildCode(name)) != null); + return name; + } + + private void gotoGroupInternalWithNamespace(Ident idNewLong, Code code, Display display, Code namespaceNew, + GroupType type, IGroup parent) { + this.stacks.add(currentGroup); + this.stacks2.add(idNewLong); + + if (this.V1972()) { + gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent); + return; + } + if (getNamespaceSeparator() == null) { + gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent); + return; + } + + final String namespaceCurrent = getNamespace1972(code, getNamespaceSeparator()); + if (namespaceCurrent == null) { + gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent); + return; + } + final IGroup realParent = entityFactory.getGroup(buildCode(namespaceCurrent)); + if (realParent == null) { + gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent); + return; + } + display = Display.create(idNewLong.getLast()); + IGroup result = entityFactory.createGroup(idNewLong, code, display, namespaceNew, type, realParent, getHides(), + getNamespaceSeparator()); + + entityFactory.addGroup(result); + currentGroup = result; + + } + + public void endGroup() { + if (stacks2.size() > 0) { + // Thread.dumpStack(); + stacks2.remove(stacks2.size() - 1); + } + if (EntityUtils.groupRoot(currentGroup)) { + Log.error("No parent group"); + return; + } + if (stacks.size() > 0) { + currentGroup = stacks.remove(stacks.size() - 1); + } else { + currentGroup = currentGroup.getParentContainer(); + } + } + + private void gotoGroupInternal(Ident idNewLong, final Code code, Display display, final Code namespace, + GroupType type, IGroup parent) { + if (this.V1972()) { + gotoGroupInternal1972(idNewLong, code, display, namespace, type, parent); + return; + } + + IGroup result = entityFactory.getGroup(code); if (result != null) { currentGroup = result; return; } - if (entityFactory.getLeafsget(code) != null) { - result = entityFactory.muteToGroup(code, namespace2, type, parent); + if (entityFactory.getLeafStrict(idNewLong) != null) { + result = entityFactory.muteToGroup(code.getName(), namespace, type, parent); result.setDisplay(display); } else { - result = entityFactory.createGroup(code, display, namespace2, type, parent, getHides(), + result = entityFactory.createGroup(idNewLong, code, display, namespace, type, parent, getHides(), getNamespaceSeparator()); } entityFactory.addGroup(result); currentGroup = result; } + private void gotoGroupInternal1972(Ident idNewLong, final Code code, Display display, final Code namespace, + GroupType type, IGroup parent) { + IGroup result = entityFactory.getGroupStrict(idNewLong); + if (result != null) { + currentGroup = result; + return; + } + final boolean mutation; + if (getNamespaceSeparator() == null) + mutation = entityFactory.getLeafVerySmart(idNewLong) != null; + else + mutation = entityFactory.getLeafStrict(idNewLong) != null; + if (mutation) { + result = entityFactory.muteToGroup1972(idNewLong, namespace, type, parent); + result.setDisplay(display); + } else { + result = entityFactory.createGroup(idNewLong, code, display, namespace, type, parent, getHides(), + getNamespaceSeparator()); + } + entityFactory.addGroup(result); + currentGroup = result; + stacks2.set(stacks2.size() - 1, result.getIdent()); + } + + final protected void gotoGroupExternal(Ident newIdLong, final Code code, Display display, final Code namespace, + GroupType type, IGroup parent) { + IGroup result = entityFactory.getGroup(code); + if (result != null) { + currentGroup = result; + return; + } + if (entityFactory.getLeaf(code) != null) { + result = entityFactory.muteToGroup(code.getName(), namespace, type, parent); + result.setDisplay(display); + } else { + result = entityFactory.createGroup(newIdLong, code, display, namespace, type, parent, getHides(), + getNamespaceSeparator()); + } + entityFactory.addGroup(result); + // entityFactory.thisIsNotArealGroup(newIdLong); + currentGroup = result; + } + public final void gotoThisGroup(IGroup group) { currentGroup = group; } - final protected Code getFullyQualifiedCode(Code code) { - final String separator = code.getSeparator(); + final protected Code getFullyQualifiedCode1972(Code code) { + final String separator = getNamespaceSeparator(); if (separator == null) { throw new IllegalArgumentException(); } - final String full = code.getFullName(); + final String full = code.getName(); if (full.startsWith(separator)) { - return Code.of(full.substring(separator.length()), separator); + return buildCode(full.substring(separator.length())); } if (full.contains(separator)) { - return Code.of(full, separator); + return buildCode(full); } if (EntityUtils.groupRoot(currentGroup)) { - return Code.of(full, separator); + return buildCode(full); } - final Code namespace2 = currentGroup.getNamespace2(); - if (namespace2 == null) { - return Code.of(full, separator); + final Code namespace = currentGroup.getNamespace(); + if (namespace == null) { + return buildCode(full); } - return Code.of(namespace2.getFullName() + separator + full, separator); + return buildCode(namespace.getName() + separator + full); } public final IGroup getCurrentGroup() { @@ -224,7 +460,7 @@ public final IGroup getCurrentGroup() { } public final IGroup getGroup(Code code) { - final IGroup p = entityFactory.getGroupsget(code); + final IGroup p = entityFactory.getGroup(code); if (p == null) { throw new IllegalArgumentException(); // return null; @@ -232,25 +468,53 @@ public final IGroup getGroup(Code code) { return p; } - public void endGroup() { - if (EntityUtils.groupRoot(currentGroup)) { - Log.error("No parent group"); - return; + public final IGroup getGroupStrict(Ident ident) { + if (!this.V1972()) + throw new UnsupportedOperationException(); + final IGroup p = entityFactory.getGroupStrict(ident); + if (p == null) { + throw new IllegalArgumentException(); + // return null; } - currentGroup = currentGroup.getParentContainer(); + return p; + } + + public final IGroup getGroupVerySmart(Ident ident) { + if (!this.V1972()) + throw new UnsupportedOperationException(); + final IGroup p = entityFactory.getGroupVerySmart(ident); + if (p == null) { + throw new IllegalArgumentException(); + // return null; + } + return p; } public final boolean isGroup(Code code) { - return leafExist(code) == false && entityFactory.getGroupsget(code) != null; + if (this.V1972()) + return isGroupStrict((Ident) code); + return leafExist(code) == false && entityFactory.getGroup(code) != null; + } + + public final boolean isGroupStrict(Ident ident) { + if (!this.V1972()) + throw new UnsupportedOperationException(); + return leafExistStrict(ident) == false && entityFactory.getGroupStrict(ident) != null; + } + + public final boolean isGroupVerySmart(Ident ident) { + if (!this.V1972()) + throw new UnsupportedOperationException(); + return leafExistSmart(ident) == false && entityFactory.getGroupVerySmart(ident) != null; } public final Collection getGroups(boolean withRootGroup) { if (withRootGroup == false) { - return entityFactory.getGroupsvalues(); + return entityFactory.groups(); } final Collection result = new ArrayList(); result.add(getRootGroup()); - result.addAll(entityFactory.getGroupsvalues()); + result.addAll(entityFactory.groups()); return Collections.unmodifiableCollection(result); } @@ -258,16 +522,32 @@ public IGroup getRootGroup() { return entityFactory.getRootGroup(); } - public Collection getLeafsvalues() { - return entityFactory.getLeafsvalues(); + public SuperGroup getRootSuperGroup() { + return entityFactory.getRootSuperGroup(); + } + + public final Collection getLeafsvalues() { + return entityFactory.leafs2(); } public final int getLeafssize() { return getLeafsvalues().size(); } - public final ILeaf getLeafsget(Code code) { - return entityFactory.getLeafsget(code); + public final ILeaf getLeaf(Code code) { + return entityFactory.getLeaf(code); + } + + public final ILeaf getLeafStrict(Ident ident) { + return entityFactory.getLeafStrict(ident); + } + + public final ILeaf getLeafSmart(Ident ident) { + return entityFactory.getLeafSmart(ident); + } + + public /* final */ ILeaf getLeafVerySmart(Ident ident) { + return entityFactory.getLeafVerySmart(ident); } final public void addLink(Link link) { @@ -303,17 +583,6 @@ public int getNbImages() { return this.horizontalPages * this.verticalPages; } - // final public List createPng2(File pngFile) throws IOException, - // InterruptedException { - // final CucaDiagramPngMaker3 maker = new CucaDiagramPngMaker3(this); - // return maker.createPng(pngFile); - // } - // - // final public void createPng2(OutputStream os) throws IOException { - // final CucaDiagramPngMaker3 maker = new CucaDiagramPngMaker3(this); - // maker.createPng(os); - // } - abstract protected List getDotStrings(); final public String[] getDotStringSkek() { @@ -353,7 +622,7 @@ protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormat try { createFilesTxt(os, index, fileFormat); } catch (Throwable t) { - t.printStackTrace(new PrintStream(os)); + t.printStackTrace(SecurityUtils.createPrintStream(os)); } return ImageDataSimple.ok(); } @@ -372,11 +641,11 @@ protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormat throw new UnsupportedOperationException(); } - // final CucaDiagramFileMaker maker = OptionFlags.USE_HECTOR ? new - // CucaDiagramFileMakerHectorC1(this) - // : new CucaDiagramFileMakerSvek(this); - final CucaDiagramFileMaker maker = this.isUseJDot() ? new CucaDiagramFileMakerJDot(this, - fileFormatOption.getDefaultStringBounder()) : new CucaDiagramFileMakerSvek(this); + entityFactory.buildSuperGroups(); + + final CucaDiagramFileMaker maker = this.isUseJDot() + ? new CucaDiagramFileMakerJDot(this, fileFormatOption.getDefaultStringBounder()) + : new CucaDiagramFileMakerSvek(this); final ImageData result = maker.createFile(os, getDotStrings(), fileFormatOption); if (result == null) { @@ -405,14 +674,6 @@ private void createFilesTxt(OutputStream os, int index, FileFormat fileFormat) t maker.createFiles(os, index); } - // public final Rankdir getRankdir() { - // return rankdir; - // } - // - // public final void setRankdir(Rankdir rankdir) { - // this.rankdir = rankdir; - // } - public boolean isAutarkic(IGroup g) { if (g.getGroupType() == GroupType.PACKAGE) { return false; @@ -518,8 +779,8 @@ public final boolean showPortion(EntityPortion portion, IEntity entity) { return result; } - public final void hideOrShow(EntityGender gender, Set portions, boolean show) { - for (EntityPortion portion : portions) { + public final void hideOrShow(EntityGender gender, EntityPortion portions, boolean show) { + for (EntityPortion portion : portions.asSet()) { this.hideOrShows.add(new HideOrShow(gender, portion, show)); } } @@ -532,26 +793,6 @@ public void hideOrShow(Set visibilities, boolean show) { } } - // public void hideOrShow(IEntity leaf, boolean show) { - // leaf.setRemoved(!show); - // } - - // public void hideOrShow(Stereotype stereotype, boolean show) { - // if (show) { - // hiddenStereotype.remove(stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); - // } else { - // hiddenStereotype.add(stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); - // } - // } - // - // public void hideOrShow(LeafType leafType, boolean show) { - // if (show) { - // hiddenType.remove(leafType); - // } else { - // hiddenType.add(leafType); - // } - // } - public void hideOrShow2(String what, boolean show) { this.hides2.add(new HideOrShow2(what, show)); } @@ -603,17 +844,24 @@ final public Link getLastLink() { return null; } + final public List getTwoLastLinks() { + final List result = new ArrayList(); + final List links = getLinks(); + for (int i = links.size() - 1; i >= 0; i--) { + final Link link = links.get(i); + if (link.getEntity1().getLeafType() != LeafType.NOTE && link.getEntity2().getLeafType() != LeafType.NOTE) { + result.add(link); + if (result.size() == 2) { + return Collections.unmodifiableList(result); + } + } + } + return null; + } + private ILeaf lastEntity = null; final public ILeaf getLastEntity() { - // for (final Iterator it = getLeafs().values().iterator(); - // it.hasNext();) { - // final ILeaf ent = it.next(); - // if (it.hasNext() == false) { - // return ent; - // } - // } - // return null; return lastEntity; } @@ -626,7 +874,6 @@ public void applySingleStrategy() { for (IGroup g : getGroups(true)) { final List standalones = new ArrayList(); - // final SingleStrategy singleStrategy = g.getSingleStrategy(); for (ILeaf ent : g.getLeafsDirect()) { if (isStandalone(ent)) { @@ -639,10 +886,6 @@ public void applySingleStrategy() { final Magma magma = new Magma(this, standalones); magma.putInSquare(); magmaList.add(magma); - - // for (Link link : singleStrategy.generateLinks(standalones)) { - // addLink(link); - // } } for (IGroup g : getGroups(true)) { @@ -663,4 +906,11 @@ protected void incRawLayout() { entityFactory.incRawLayout(); } + public CommandExecutionResult constraintOnLinks(Link link1, Link link2, Display display) { + final LinkConstraint linkConstraint = new LinkConstraint(link1, link2, display); + link1.setLinkConstraint(linkConstraint); + link2.setLinkConstraint(linkConstraint); + return CommandExecutionResult.ok(); + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Display.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Display.java index c7e27e8da..a74a5cda8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Display.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Display.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,6 +36,8 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.EmbeddedDiagram; @@ -49,25 +51,27 @@ import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder.ModeUrl; 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.creole.CreoleMode; -import net.sourceforge.plantuml.creole.CreoleParser; +import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.creole.Sheet; import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.creole.SheetBlock2; import net.sourceforge.plantuml.graphic.CircledCharacter; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockSimple; import net.sourceforge.plantuml.graphic.TextBlockSprited; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.sequencediagram.MessageNumber; import net.sourceforge.plantuml.skin.VisibilityModifier; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Display implements Iterable { @@ -78,12 +82,16 @@ public class Display implements Iterable { public final static Display NULL = new Display(null, null, true, CreoleMode.FULL); - public Display withoutStereotype() { + public Display withoutStereotypeIfNeeded(Style usedStyle) { + final boolean showStereotype = usedStyle.value(PName.ShowStereotype).asBoolean(); + if (showStereotype) { + return this; + } final List copy = new ArrayList(displayData); final Display result = new Display(naturalHorizontalAlignment, isNull, defaultCreoleMode); for (Iterator it = copy.iterator(); it.hasNext();) { final CharSequence cs = it.next(); - if (cs instanceof Stereotype) { + if (cs instanceof Stereotype && usedStyle.getSignature().match(((Stereotype) cs))) { it.remove(); } } @@ -91,6 +99,16 @@ public Display withoutStereotype() { return result; } + public Stereotype getStereotypeIfAny() { + for (CharSequence cs : displayData) { + if (cs instanceof Stereotype) { + return (Stereotype) cs; + } + } + return null; + + } + public Display replaceBackslashT() { final Display result = new Display(this, defaultCreoleMode); for (int i = 0; i < result.displayData.size(); i++) { @@ -139,7 +157,7 @@ public static Display create(Collection other) { } public static Display getWithNewlines(Code s) { - return getWithNewlines(s.getFullName()); + return getWithNewlines(s.getName()); } public static Display getWithNewlines(String s) { @@ -264,6 +282,26 @@ public Display withPage(int page, int lastpage) { return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); } + public Display removeEndingStereotype() { + final Matcher2 m = patternStereotype.matcher(displayData.get(displayData.size() - 1)); + if (m.matches()) { + final List result = new ArrayList(this.displayData); + result.set(result.size() - 1, m.group(1)); + return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); + } + return this; + } + + public final static Pattern2 patternStereotype = MyPattern.cmpile("^(.*?)(?:\\<\\<\\s*(.*)\\s*\\>\\>)\\s*$"); + + public String getEndingStereotype() { + final Matcher2 m = patternStereotype.matcher(displayData.get(displayData.size() - 1)); + if (m.matches()) { + return m.group(2); + } + return null; + } + public Display underlined() { final List result = new ArrayList(); for (CharSequence line : displayData) { @@ -272,6 +310,23 @@ public Display underlined() { return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); } + public Display underlinedName() { + final Pattern p = Pattern.compile("^([^:]+?)(\\s*:.+)$"); + final List result = new ArrayList(); + for (CharSequence line : displayData) { + if (result.size() == 0) { + final Matcher m = p.matcher(line); + if (m.matches()) + result.add("" + m.group(1) + "" + m.group(2)); + else + result.add("" + line); + } else { + result.add("" + line); + } + } + return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); + } + public Display withCreoleMode(CreoleMode mode) { if (isNull) { throw new IllegalArgumentException(); @@ -405,97 +460,134 @@ public static boolean isNull(Display display) { public TextBlock create(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, ISkinSimple spriteContainer) { - return create(fontConfiguration, horizontalAlignment, spriteContainer, CreoleMode.FULL); + return create7(fontConfiguration, horizontalAlignment, spriteContainer, CreoleMode.FULL); } public TextBlock createWithNiceCreoleMode(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, ISkinSimple spriteContainer) { - return create(fontConfiguration, horizontalAlignment, spriteContainer, defaultCreoleMode); + return create7(fontConfiguration, horizontalAlignment, spriteContainer, defaultCreoleMode); } - public TextBlock create(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, + public TextBlock create7(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, ISkinSimple spriteContainer, CreoleMode creoleMode) { - return create(fontConfiguration, horizontalAlignment, spriteContainer, LineBreakStrategy.NONE, creoleMode, + return create0(fontConfiguration, horizontalAlignment, spriteContainer, LineBreakStrategy.NONE, creoleMode, null, null); } - public TextBlock create(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, + public TextBlock create8(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, ISkinSimple spriteContainer, CreoleMode modeSimpleLine, LineBreakStrategy maxMessageSize) { - return create(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, modeSimpleLine, null, + return create0(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, modeSimpleLine, null, null); } - public TextBlock create(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, + public TextBlock create9(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize) { - return create(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, defaultCreoleMode, null, + return create0(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, defaultCreoleMode, null, null); } - public TextBlock create(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, + public TextBlock create0(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, CreoleMode creoleMode, - UFont fontForStereotype, HtmlColor htmlColorForStereotype) { + UFont fontForStereotype, HColor htmlColorForStereotype) { if (maxMessageSize == null) { throw new IllegalArgumentException(); } if (getNaturalHorizontalAlignment() != null) { horizontalAlignment = getNaturalHorizontalAlignment(); } + final FontConfiguration stereotypeConfiguration = fontConfiguration.forceFont(fontForStereotype, + htmlColorForStereotype); if (size() > 0) { if (get(0) instanceof Stereotype) { return createStereotype(fontConfiguration, horizontalAlignment, spriteContainer, 0, fontForStereotype, - htmlColorForStereotype); + htmlColorForStereotype, maxMessageSize, creoleMode); } if (get(size() - 1) instanceof Stereotype) { return createStereotype(fontConfiguration, horizontalAlignment, spriteContainer, size() - 1, - fontForStereotype, htmlColorForStereotype); + fontForStereotype, htmlColorForStereotype, maxMessageSize, creoleMode); } if (get(0) instanceof MessageNumber) { - return createMessageNumber(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize); + return createMessageNumber(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, + stereotypeConfiguration); } } - return getCreole(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, creoleMode); + return getCreole(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, creoleMode, + stereotypeConfiguration); + } + + private TextBlock createStereotype(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, + SpriteContainer spriteContainer, int position, UFont fontForStereotype, HColor htmlColorForStereotype, + LineBreakStrategy maxMessageSize, CreoleMode creoleMode) { + final Stereotype stereotype = (Stereotype) get(position); + TextBlock circledCharacter = null; + if (stereotype.isSpotted()) { + circledCharacter = new CircledCharacter(stereotype.getCharacter(), stereotype.getRadius(), + stereotype.getCircledFont(), stereotype.getHtmlColor(), null, fontConfiguration.getColor()); + } else { + circledCharacter = stereotype.getSprite(spriteContainer); + } + final FontConfiguration stereotypeConfiguration = fontConfiguration.forceFont(fontForStereotype, + htmlColorForStereotype); + final TextBlock result = getCreole(fontConfiguration, horizontalAlignment, (ISkinSimple) spriteContainer, + maxMessageSize, creoleMode, stereotypeConfiguration); + if (circledCharacter != null) { + return new TextBlockSprited(circledCharacter, result); + } + return result; } private TextBlock getCreole(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, - ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, CreoleMode creoleMode) { - final Sheet sheet = new CreoleParser(fontConfiguration, horizontalAlignment, spriteContainer, creoleMode) + ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, CreoleMode creoleMode, + FontConfiguration stereotypeConfiguration) { + final Sheet sheet = Parser + .build(fontConfiguration, horizontalAlignment, spriteContainer, creoleMode, stereotypeConfiguration) .createSheet(this); - final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, maxMessageSize, spriteContainer == null ? 0 - : spriteContainer.getPadding()); + final double padding = spriteContainer == null ? 0 : spriteContainer.getPadding(); + final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, maxMessageSize, padding); return new SheetBlock2(sheetBlock1, sheetBlock1, new UStroke(1.5)); } private TextBlock createMessageNumber(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, - ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize) { - TextBlock tb1 = subList(0, 1).getCreole(fontConfiguration, horizontalAlignment, spriteContainer, - maxMessageSize, CreoleMode.FULL); + ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, FontConfiguration stereotypeConfiguration) { + TextBlock tb1 = subList(0, 1).getCreole(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, + CreoleMode.FULL, stereotypeConfiguration); tb1 = TextBlockUtils.withMargin(tb1, 0, 4, 0, 0); final TextBlock tb2 = subList(1, size()).getCreole(fontConfiguration, horizontalAlignment, spriteContainer, - maxMessageSize, CreoleMode.FULL); + maxMessageSize, CreoleMode.FULL, stereotypeConfiguration); return TextBlockUtils.mergeLR(tb1, tb2, VerticalAlignment.CENTER); } - private TextBlock createStereotype(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, - SpriteContainer spriteContainer, int position, UFont fontForStereotype, HtmlColor htmlColorForStereotype) { - final Stereotype stereotype = (Stereotype) get(position); - TextBlock circledCharacter = null; - if (stereotype.isSpotted()) { - circledCharacter = new CircledCharacter(stereotype.getCharacter(), stereotype.getRadius(), - stereotype.getCircledFont(), stereotype.getHtmlColor(), null, fontConfiguration.getColor()); - } else { - circledCharacter = stereotype.getSprite(spriteContainer); + public boolean hasSeveralGuideLines() { + return hasSeveralGuideLines(displayData); + } + + public static boolean hasSeveralGuideLines(String s) { + final List splitted = Arrays.asList(s.split("\\\\n")); + return hasSeveralGuideLines(splitted); + } + + private static boolean hasSeveralGuideLines(Collection all) { + if (all.size() <= 1) { + return false; } - if (circledCharacter != null) { - if (stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null) { - return new TextBlockSprited(circledCharacter, this.subList(1, this.size()), fontConfiguration, - horizontalAlignment, spriteContainer); + for (CharSequence cs : all) { + final String s = cs.toString(); + if (s.startsWith("< ")) { + return true; + } + if (s.startsWith("> ")) { + return true; + } + if (s.endsWith(" <")) { + return true; + } + if (s.endsWith(" >")) { + return true; } - return new TextBlockSprited(circledCharacter, this, fontConfiguration, horizontalAlignment, spriteContainer); } - return new TextBlockSimple(this, fontConfiguration, horizontalAlignment, spriteContainer, 0, fontForStereotype, - htmlColorForStereotype); + return false; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/DisplayPositionned.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/DisplayPositionned.java index e01d75aa9..135823213 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/DisplayPositionned.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/DisplayPositionned.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/DisplaySection.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/DisplaySection.java index dc2e7e60d..8f4f0c849 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/DisplaySection.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/DisplaySection.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,7 +34,6 @@ import java.util.Map; import net.sourceforge.plantuml.ISkinSimple; -import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.TextBlock; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Election.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Election.java index da907ffad..c8d756f3b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Election.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Election.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,6 +34,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; @@ -81,10 +82,11 @@ private List getAllCandidateContainsStrict(String shortName) { public Map getAllElected(Collection shortNames) { final Map memberWithPort = new HashMap(); - for (String shortName : shortNames) { + for (String shortName : new HashSet(shortNames)) { final Member m = getCandidate(shortName); if (m != null) { memberWithPort.put(m, shortName); + shortNames.remove(shortName); } } return Collections.unmodifiableMap(memberWithPort); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityGender.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityGender.java index 0975927fe..280f64074 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityGender.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityGender.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityGenderUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityGenderUtils.java index ae200e408..d065740ae 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityGenderUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityGenderUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -110,13 +110,5 @@ public boolean contains(IEntity test) { }; } -// static public EntityGender emptyMembers() { -// return new EntityGender() { -// public boolean contains(IEntity test) { -// return test.getBodier().getMethodsToDisplay().size() == 0 -// && test.getBodier().getFieldsToDisplay().size() == 0; -// } -// }; -// } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityPort.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityPort.java index 03a1ee220..927506e0f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityPort.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityPort.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,44 +30,41 @@ */ package net.sourceforge.plantuml.cucadiagram; +import net.sourceforge.plantuml.svek.Ports; + public class EntityPort { - private final String uid; - private final String portName; + private final String entityUid; + private final String portId; - public EntityPort(String uid, String portName) { - this.uid = uid; - this.portName = portName; + public EntityPort(String entityUid, String portName) { + this.entityUid = entityUid; + this.portId = portName == null ? null : Ports.encodePortNameToId(portName); } public String getFullString() { - if (portName != null) { - return uid + ":" + portName; + if (portId != null) { + return entityUid + ":" + portId; } - return uid; + return entityUid; } private boolean isShielded() { - return uid.endsWith(":h"); + return entityUid.endsWith(":h"); } public String getPrefix() { if (isShielded()) { - return uid.substring(0, uid.length() - 2); + return entityUid.substring(0, entityUid.length() - 2); } - return uid; + return entityUid; } public boolean startsWith(String centerId) { - return uid.startsWith(centerId); + return entityUid.startsWith(centerId); } public boolean equalsId(EntityPort other) { - return this.uid.equals(other.uid); - } - - private String getPortName() { - return portName; + return this.entityUid.equals(other.entityUid); } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityPortion.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityPortion.java index 466cd3e14..ed4d7afae 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityPortion.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityPortion.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,6 +30,16 @@ */ package net.sourceforge.plantuml.cucadiagram; +import java.util.EnumSet; +import java.util.Set; + public enum EntityPortion { - FIELD, METHOD, CIRCLED_CHARACTER, STEREOTYPE, LOLLIPOP, ENTIRELY + FIELD, METHOD, MEMBER, CIRCLED_CHARACTER, STEREOTYPE; + + public Set asSet() { + if (this == MEMBER) { + return EnumSet. of(FIELD, METHOD); + } + return EnumSet. of(this); + } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityPosition.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityPosition.java index 94232df81..052b82e53 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityPosition.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityPosition.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -27,6 +27,7 @@ * * * Original Author: Arnaud Roques + * Contribution : Hisashi Miyashita */ package net.sourceforge.plantuml.cucadiagram; @@ -45,7 +46,7 @@ public enum EntityPosition { - NORMAL, ENTRY_POINT, EXIT_POINT, INPUT_PIN, OUTPUT_PIN, EXPANSION_INPUT, EXPANSION_OUTPUT; + NORMAL, ENTRY_POINT, EXIT_POINT, INPUT_PIN, OUTPUT_PIN, EXPANSION_INPUT, EXPANSION_OUTPUT, PORT, PORTIN, PORTOUT; public static final double RADIUS = 6; @@ -64,24 +65,24 @@ public void drawSymbol(UGraphic ug, Rankdir rankdir) { drawLine(ug, getPointOnCircle(xc, yc, -Math.PI / 4, radius), getPointOnCircle(xc, yc, Math.PI - Math.PI / 4, radius)); } - } else if (this == INPUT_PIN || this == OUTPUT_PIN) { + } else if (this == INPUT_PIN || this == OUTPUT_PIN || this == PORT) { final Shadowable rectangle = new URectangle(RADIUS * 2, RADIUS * 2); ug.draw(rectangle); } else if (this == EXPANSION_INPUT || this == EXPANSION_OUTPUT) { if (rankdir == Rankdir.TOP_TO_BOTTOM) { final Shadowable rectangle = new URectangle(RADIUS * 2 * 4, RADIUS * 2); ug.draw(rectangle); - final ULine vline = new ULine(0, RADIUS * 2); - ug.apply(new UTranslate(RADIUS * 2, 0)).draw(vline); - ug.apply(new UTranslate(RADIUS * 2 * 2, 0)).draw(vline); - ug.apply(new UTranslate(RADIUS * 2 * 3, 0)).draw(vline); + final ULine vline = ULine.vline(RADIUS * 2); + ug.apply(UTranslate.dx(RADIUS * 2)).draw(vline); + ug.apply(UTranslate.dx(RADIUS * 2 * 2)).draw(vline); + ug.apply(UTranslate.dx(RADIUS * 2 * 3)).draw(vline); } else { final Shadowable rectangle = new URectangle(RADIUS * 2, RADIUS * 2 * 4); - ug.apply(new UTranslate(0, 0)).draw(rectangle); - final ULine hline = new ULine(RADIUS * 2, 0); - ug.apply(new UTranslate(0, RADIUS * 2)).draw(hline); - ug.apply(new UTranslate(0, RADIUS * 2 * 2)).draw(hline); - ug.apply(new UTranslate(0, RADIUS * 2 * 3)).draw(hline); + ug.apply(UTranslate.dy(0)).draw(rectangle); + final ULine hline = ULine.hline(RADIUS * 2); + ug.apply(UTranslate.dy(RADIUS * 2)).draw(hline); + ug.apply(UTranslate.dy(RADIUS * 2 * 2)).draw(hline); + ug.apply(UTranslate.dy(RADIUS * 2 * 3)).draw(hline); } } @@ -121,6 +122,9 @@ public ShapeType getShapeType() { } public static EntityPosition fromStereotype(String label) { + if ("<>".equalsIgnoreCase(label)) { + return PORT; + } if ("<>".equalsIgnoreCase(label)) { return ENTRY_POINT; } @@ -143,11 +147,19 @@ public static EntityPosition fromStereotype(String label) { } public static EnumSet getInputs() { - return EnumSet.of(ENTRY_POINT, INPUT_PIN, EXPANSION_INPUT); + return EnumSet.of(ENTRY_POINT, INPUT_PIN, EXPANSION_INPUT, PORTIN); } public static EnumSet getOutputs() { - return EnumSet.of(EXIT_POINT, OUTPUT_PIN, EXPANSION_OUTPUT); + return EnumSet.of(EXIT_POINT, OUTPUT_PIN, EXPANSION_OUTPUT, PORTOUT); + } + + public static EnumSet getSame() { + return EnumSet.of(PORT); + } + + public boolean isPort() { + return this == PORT || this == PORTIN || this == PORTOUT; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityUtils.java index 3d490a2f2..2375cd716 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/EntityUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/GroupHierarchy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/GroupHierarchy.java index 6101e05b0..fa04bc656 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/GroupHierarchy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/GroupHierarchy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,10 +31,17 @@ package net.sourceforge.plantuml.cucadiagram; import java.util.Collection; +import java.util.Set; public interface GroupHierarchy { + public IGroup getRootGroup(); + + public SuperGroup getRootSuperGroup(); + public Collection getChildrenGroups(IGroup parent); - + + public Set getAllSuperGroups(); + public boolean isEmpty(IGroup g); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/GroupPrinter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/GroupPrinter.java index d37dfbd38..7664c4090 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/GroupPrinter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/GroupPrinter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,10 +30,11 @@ */ package net.sourceforge.plantuml.cucadiagram; -import java.io.File; import java.io.IOException; import java.io.PrintWriter; +import net.sourceforge.plantuml.security.SFile; + public class GroupPrinter { private final PrintWriter pw; @@ -46,7 +47,7 @@ private void printGroup(IGroup group) { pw.println(""); pw.println(""); pw.println(""); pw.println("
"); - pw.println(group.getCode()); + pw.println(group.getCodeGetName()); pw.println("
"); if (group.getLeafsDirect().size() == 0) { @@ -75,12 +76,12 @@ private void printGroup(IGroup group) { } private void printLeaf(ILeaf leaf) { - pw.println("
  • " + leaf.getCode()); + pw.println("
  • " + leaf.getCodeGetName()); } - public static void print(File f, IGroup rootGroup) { + public static void print(SFile f, IGroup rootGroup) { try { - final PrintWriter pw = new PrintWriter(f); + final PrintWriter pw = f.createPrintWriter(); pw.println(""); new GroupPrinter(pw).printGroup(rootGroup); pw.println(""); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java index 8f0619c0b..edce46557 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -42,7 +42,6 @@ import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.ColorType; @@ -51,6 +50,7 @@ import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.svek.SingleStrategy; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class GroupRoot implements IGroup { @@ -62,7 +62,7 @@ public GroupRoot(EntityFactory entityFactory) { public Collection getLeafsDirect() { final List result = new ArrayList(); - for (ILeaf ent : entityFactory.getLeafsvalues()) { + for (ILeaf ent : entityFactory.leafs()) { if (ent.getParentContainer() == this) { result.add(ent); } @@ -70,6 +70,11 @@ public Collection getLeafsDirect() { return Collections.unmodifiableCollection(result); } + + @Override + public String toString() { + return "ROOT"; + } public boolean isGroup() { return true; @@ -115,11 +120,11 @@ public TextBlock getBody(PortionShower portionShower, FontParam fontParam, ISkin } public Code getCode() { - return Code.of("__ROOT__"); + return CodeImpl.of("__ROOT__"); } - public LongCode getLongCode() { - return null; + public String getCodeGetName() { + return getCode().getName(); } public void addUrl(Url url) { @@ -138,9 +143,18 @@ public boolean containsLeafRecurse(ILeaf entity) { public Collection getChildren() { final List result = new ArrayList(); - for (IGroup ent : entityFactory.getGroupsvalues()) { - if (ent.getParentContainer() == this) { - result.add(ent); + if (entityFactory.namespaceSeparator.V1972()) { + for (IGroup ent : entityFactory.groups()) { + if (ent.getIdent().size() == 1) { + result.add(ent); + } + } + + } else { + for (IGroup ent : entityFactory.groups()) { + if (ent.getParentContainer() == this) { + result.add(ent); + } } } return Collections.unmodifiableCollection(result); @@ -158,7 +172,7 @@ public GroupType getGroupType() { return null; } - public Code getNamespace2() { + public Code getNamespace() { throw new UnsupportedOperationException(); } @@ -237,7 +251,7 @@ public void setColors(Colors colors) { throw new UnsupportedOperationException(); } - public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) { + public void setSpecificColorTOBEREMOVED(ColorType type, HColor color) { throw new UnsupportedOperationException(); } @@ -264,4 +278,16 @@ public void setLegend(DisplayPositionned legend) { public DisplayPositionned getLegend() { throw new UnsupportedOperationException(); } + + public Ident getIdent() { + return Ident.empty(); + } + + public boolean isAloneAndUnlinked() { + throw new UnsupportedOperationException(); + } + + public void setThisIsTogether() { + throw new UnsupportedOperationException(); + } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/GroupType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/GroupType.java index f4528ea1d..fe6447e64 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/GroupType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/GroupType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/HideOrShow2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/HideOrShow2.java index 5fdc14279..84d2bacdf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/HideOrShow2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/HideOrShow2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,6 +35,11 @@ public class HideOrShow2 { private final String what; private final boolean show; + @Override + public String toString() { + return what + " (" + show + ")"; + } + private boolean isApplyable(ILeaf leaf) { if (what.startsWith("$")) { return isApplyableTag(leaf, what.substring(1)); @@ -42,11 +47,21 @@ private boolean isApplyable(ILeaf leaf) { if (what.startsWith("<<") && what.endsWith(">>")) { return isApplyableStereotype(leaf, what.substring(2, what.length() - 2).trim()); } - final String fullName = leaf.getCode().getFullName(); + if (what.equalsIgnoreCase("@unlinked")) { + return isApplyableUnlinked(leaf); + } + final String fullName = leaf.getCodeGetName(); // System.err.println("fullName=" + fullName); return match(fullName, what); } + private boolean isApplyableUnlinked(ILeaf leaf) { + if (leaf.isAloneAndUnlinked()) { + return true; + } + return false; + } + private boolean isApplyableStereotype(ILeaf leaf, String pattern) { final Stereotype stereotype = leaf.getStereotype(); if (stereotype == null) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/IEntity.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/IEntity.java index 8aedad3fe..4809dd4da 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/IEntity.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/IEntity.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -44,7 +44,9 @@ public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, Li public Code getCode(); - public LongCode getLongCode(); + public String getCodeGetName(); + + public Ident getIdent(); public USymbol getUSymbol(); @@ -87,5 +89,10 @@ public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, Li public void addStereotag(Stereotag tag); public Set stereotags(); + + public boolean isAloneAndUnlinked(); + + public void setThisIsTogether(); + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/IGroup.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/IGroup.java index 916493c2f..4cc2d0915 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/IGroup.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/IGroup.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -52,7 +52,7 @@ public interface IGroup extends IEntity { public GroupType getGroupType(); - public Code getNamespace2(); + public Code getNamespace(); public PackageStyle getPackageStyle(); @@ -69,4 +69,5 @@ public interface IGroup extends IEntity { public void setLegend(DisplayPositionned legend); public DisplayPositionned getLegend(); + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/ILeaf.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/ILeaf.java index b9d3ea8bb..7cd8dfff4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/ILeaf.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/ILeaf.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Ident.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Ident.java index 9eb07a690..d0860276f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Ident.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Ident.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,45 +30,263 @@ */ package net.sourceforge.plantuml.cucadiagram; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory; -public class Ident implements Comparable { +public class Ident implements Code { - private final String ident; + private final List parts; - private Ident(String ident) { - if (ident == null) { - throw new IllegalArgumentException(); + private Ident(List parts) { + this.parts = parts; + } + + @Override + public String toString() { + return parts.toString(); + } + + public boolean startsWith(Ident other) { + if (other.parts.size() > this.parts.size()) { + return false; } - this.ident = ident; + for (int i = 0; i < other.parts.size(); i++) { + if (other.parts.get(i).equals(this.parts.get(i)) == false) { + return false; + } + } + return true; } - public static Ident of(String code) { - return new Ident(code); + public String forXmi() { + final StringBuilder sb = new StringBuilder(); + for (String s : parts) { + if (sb.length() > 0) { + sb.append("."); + } + sb.append(s); + } + return sb.toString(); } - @Override - public String toString() { - return ident; + public Ident add(Ident added) { + final List copy = new ArrayList(parts); + copy.addAll(added.parts); + return new Ident(copy); } - @Override - public int hashCode() { - return ident.hashCode(); + public static Ident empty() { + return new Ident(Collections.emptyList()); + } + + public String getLast() { + if (parts.size() == 0) { + return ""; + } + return parts.get(parts.size() - 1); + } + + public Code toCode(CucaDiagram diagram) { + if (diagram.V1972()) + return this; + return CodeImpl.of(getLast()); + } + + public Ident eventuallyRemoveStartingAndEndingDoubleQuote(String format) { + final List copy = new ArrayList(parts); + final int pos = copy.size() - 1; + copy.set(pos, StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(copy.get(pos), format)); + return new Ident(copy); + } + + public Ident removeStartingParenthesis() { + final List copy = new ArrayList(parts); + final int pos = copy.size() - 1; + final String last = copy.get(pos); + if (last.startsWith("()") == false) { + throw new IllegalStateException(); + } + copy.set(pos, StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(last.substring(2).trim())); + return new Ident(copy); + } + + public Ident addSuffix(String suffix) { + final List copy = new ArrayList(parts); + final int pos = copy.size() - 1; + copy.set(pos, copy.get(pos) + suffix); + return new Ident(copy); + // return new Code(fullName + suffix); + } + + public Ident removeMemberPart() { + final String last = getLast(); + final int x = last.lastIndexOf("::"); + if (x == -1) { + return null; + } + final List copy = new ArrayList(parts); + final int pos = copy.size() - 1; + copy.set(pos, last.substring(0, x)); + return new Ident(copy); + } + + public String getPortMember() { + final String last = getLast(); + final int x = last.lastIndexOf("::"); + if (x == -1) { + return null; + } + return last.substring(x + 2); + } + + static private Ident from(String full, String separator) { + final Ident result = new Ident(new ArrayList()); + if (isOdd(full, separator)) { + result.parts.add(full); + return result; + } + while (true) { + int idx = full.indexOf(separator); + if (idx == -1) { + result.parts.add(full); + result.checkResult(separator); + return result; + } + if (idx > 0) { + result.parts.add(full.substring(0, idx)); + } + full = full.substring(idx + separator.length()); + } + } + + private static boolean isOdd(String full, String separator) { + return separator == null || full.contains(separator + separator) || full.endsWith(separator); + } + + private void checkResult(String separator) { + for (String s : this.parts) { + if (s.length() == 0) { + throw new IllegalStateException(toString()); + } + if (separator != null && s.contains(separator) && s.endsWith(separator) == false + && s.contains(separator + separator) == false) { + throw new IllegalStateException(toString()); + } + } + } + + public Ident add(String sup, String separator) { + this.checkResult(separator); + final Ident added = from(sup, separator); + final List list = new ArrayList(this.parts.size() + added.parts.size()); + list.addAll(this.parts); + list.addAll(added.parts); + final Ident result = new Ident(list); + result.checkResult(separator); + return result; + } + + public Ident parent() { + if (parts.size() == 0) { + throw new IllegalArgumentException(); + } + return new Ident(parts.subList(0, parts.size() - 1)); } @Override public boolean equals(Object obj) { final Ident other = (Ident) obj; - return this.ident.equals(other.ident); + return this.parts.equals(other.parts); + } + + @Override + public int hashCode() { + return parts.hashCode(); + } + + public String toString(String sep) { + if (sep == null) { + sep = "."; + } + final StringBuilder sb = new StringBuilder(); + for (String s : parts) { + if (sb.length() > 0) { + sb.append(sep); + } + sb.append(s); + } + return sb.toString(); + } + + public void checkSameAs(Code code, String separator, CucaDiagram diagram) { + if (diagram.V1972()) { + return; + } + final String last = parts.get(parts.size() - 1); + if (separator == null) { + if (code.getName().equals(last) != true && code.getName().equals(toString(separator)) == false) { + System.err.println("code1=" + code); + System.err.println("this1=" + this); + EntityFactory.bigError(); + } + } else { + if (getLastPart(code.getName(), separator).equals(last) != true + && code.getName().equals(toString(separator)) == false) { + System.err.println("code2=" + code); + System.err.println("this2=" + this); + EntityFactory.bigError(); + } + } + } + + private String getLastPart(String fullName, String separator) { + if (separator == null) { + return fullName; + } + final int x = fullName.lastIndexOf(separator); + if (x == -1) { + return fullName; + } + return fullName.substring(x + separator.length()); + } + + // public int compareTo(Code o) { + // throw new UnsupportedOperationException(); + // } + + public String getName() { + return getLast(); + } + + public boolean isRoot() { + return parts.size() == 0; + } + + public Ident move(Ident from, Ident to) { + if (this.startsWith(from) == false) { + throw new IllegalArgumentException(); + } + final List result = new ArrayList(to.parts); + for (int i = from.parts.size(); i < this.parts.size(); i++) { + result.add(this.parts.get(i)); + } + return new Ident(result); + } + + public int size() { + return parts.size(); } - public int compareTo(Ident other) { - return this.ident.compareTo(other.ident); + public Ident getPrefix(int toIndex) { + return new Ident(this.parts.subList(0, toIndex)); } - private Ident eventuallyRemoveStartingAndEndingDoubleQuote() { - return Ident.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(ident)); + public Ident getSuffix(int fromIndex) { + return new Ident(this.parts.subList(fromIndex, this.parts.size())); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LeafType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LeafType.java index 6b367deed..19a4fded4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LeafType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LeafType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -27,6 +27,8 @@ * * * Original Author: Arnaud Roques + * Contribution : Hisashi Miyashita + * Contribution : Serge Wenger */ package net.sourceforge.plantuml.cucadiagram; @@ -36,7 +38,7 @@ public enum LeafType { EMPTY_PACKAGE, - ABSTRACT_CLASS, CLASS, INTERFACE, ANNOTATION, LOLLIPOP_FULL, LOLLIPOP_HALF, NOTE, TIPS, OBJECT, ASSOCIATION, ENUM, CIRCLE, + ABSTRACT_CLASS, CLASS, INTERFACE, ANNOTATION, LOLLIPOP_FULL, LOLLIPOP_HALF, NOTE, TIPS, OBJECT, MAP, ASSOCIATION, ENUM, CIRCLE, USECASE, @@ -46,11 +48,13 @@ public enum LeafType { ACTIVITY, BRANCH, SYNCHRO_BAR, CIRCLE_START, CIRCLE_END, POINT_FOR_ASSOCIATION, ACTIVITY_CONCURRENT, - STATE, STATE_CONCURRENT, PSEUDO_STATE, STATE_CHOICE, STATE_FORK_JOIN, + STATE, STATE_CONCURRENT, PSEUDO_STATE, DEEP_HISTORY, STATE_CHOICE, STATE_FORK_JOIN, BLOCK, ENTITY, DOMAIN, REQUIREMENT, + + PORT, PORTIN, PORTOUT, STILL_UNKNOWN; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Link.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Link.java index eeb48b296..7adf591ef 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Link.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Link.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,7 +41,6 @@ import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.USymbolInterface; @@ -49,7 +48,9 @@ import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.svek.Bibliotekon; +import net.sourceforge.plantuml.ugraphic.UComment; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.UniqueSequence; public class Link extends WithLinkType implements Hideable, Removeable { @@ -84,7 +85,7 @@ public final StyleBuilder getStyleBuilder() { private boolean constraint = true; private boolean inverted = false; - private LinkArrow linkArrow = LinkArrow.NONE; + private LinkArrow linkArrow = LinkArrow.NONE_OR_SEVERAL; private boolean opale; private boolean horizontalSolitary; @@ -94,6 +95,27 @@ public final StyleBuilder getStyleBuilder() { private Url url; + public String idCommentForSvg() { + if (type.looksLikeRevertedForSvg()) { + final String comment = getEntity1().getCodeGetName() + "<-" + getEntity2().getCodeGetName(); + return comment; + } + if (type.looksLikeNoDecorAtAllSvg()) { + final String comment = getEntity1().getCodeGetName() + "-" + getEntity2().getCodeGetName(); + return comment; + } + final String comment = getEntity1().getCodeGetName() + "->" + getEntity2().getCodeGetName(); + return comment; + } + + public UComment commentForSvg() { + if (type.looksLikeRevertedForSvg()) { + return new UComment( + "reverse link " + getEntity1().getCodeGetName() + " to " + getEntity2().getCodeGetName()); + } + return new UComment("link " + getEntity1().getCodeGetName() + " to " + getEntity2().getCodeGetName()); + } + public Link(IEntity cl1, IEntity cl2, LinkType type, Display label, int length, StyleBuilder styleBuilder) { this(cl1, cl2, type, label, length, null, null, null, null, null, styleBuilder); } @@ -104,7 +126,7 @@ public Link(IEntity cl1, IEntity cl2, LinkType type, Display label, int length, } public Link(IEntity cl1, IEntity cl2, LinkType type, Display label, int length, String qualifier1, - String qualifier2, String labeldistance, String labelangle, HtmlColor specificColor, + String qualifier2, String labeldistance, String labelangle, HColor specificColor, StyleBuilder styleBuilder) { if (length < 1) { throw new IllegalArgumentException(); @@ -168,6 +190,7 @@ public Link getInv() { result.port1 = this.port2; result.port2 = this.port1; result.url = this.url; + result.linkConstraint = this.linkConstraint; return result; } @@ -225,11 +248,11 @@ public IEntity getEntity2() { } public EntityPort getEntityPort1(Bibliotekon bibliotekon) { - return new EntityPort(bibliotekon.getShapeUid((ILeaf) cl1), port1); + return new EntityPort(bibliotekon.getNodeUid((ILeaf) cl1), port1); } public EntityPort getEntityPort2(Bibliotekon bibliotekon) { - return new EntityPort(bibliotekon.getShapeUid((ILeaf) cl2), port2); + return new EntityPort(bibliotekon.getNodeUid((ILeaf) cl2), port2); } @Override @@ -446,7 +469,8 @@ public final boolean isInverted() { public boolean hasEntryPoint() { return (getEntity1().isGroup() == false && ((ILeaf) getEntity1()).getEntityPosition() != EntityPosition.NORMAL) - || (getEntity2().isGroup() == false && ((ILeaf) getEntity2()).getEntityPosition() != EntityPosition.NORMAL); + || (getEntity2().isGroup() == false + && ((ILeaf) getEntity2()).getEntityPosition() != EntityPosition.NORMAL); } public boolean hasTwoEntryPointsSameContainer() { @@ -542,4 +566,14 @@ public UmlDiagramType getUmlDiagramType() { return umlType; } + private LinkConstraint linkConstraint; + + public void setLinkConstraint(LinkConstraint linkConstraint) { + this.linkConstraint = linkConstraint; + } + + public final LinkConstraint getLinkConstraint() { + return linkConstraint; + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkArrow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkArrow.java index 7f53c43d8..8dee513af 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkArrow.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkArrow.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,9 +30,12 @@ */ package net.sourceforge.plantuml.cucadiagram; +import net.sourceforge.plantuml.Direction; +import net.sourceforge.plantuml.svek.GuideLine; + public enum LinkArrow { - NONE, DIRECT_NORMAL, BACKWARD; + NONE_OR_SEVERAL, DIRECT_NORMAL, BACKWARD; public LinkArrow reverse() { if (this == DIRECT_NORMAL) { @@ -41,7 +44,22 @@ public LinkArrow reverse() { if (this == BACKWARD) { return DIRECT_NORMAL; } - return NONE; + return NONE_OR_SEVERAL; + } + + public GuideLine mute(final GuideLine guide) { + switch (this) { + case DIRECT_NORMAL: + return guide; + case BACKWARD: + return new GuideLine() { + public Direction getArrowDirection() { + return guide.getArrowDirection().getInv(); + } + }; + + } + throw new UnsupportedOperationException(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkConstraint.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkConstraint.java new file mode 100644 index 000000000..fe6388e15 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkConstraint.java @@ -0,0 +1,100 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.cucadiagram; + +import java.awt.geom.Dimension2D; +import java.awt.geom.Point2D; + +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; +import net.sourceforge.plantuml.graphic.TextBlock; +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.HColorUtils; + +public class LinkConstraint { + + private final Link link1; + private final Link link2; + private final Display display; + + private double x1; + private double y1; + private double x2; + private double y2; + + public LinkConstraint(Link link1, Link link2, Display display) { + this.link1 = link1; + this.link2 = link2; + this.display = display; + } + + public void setPosition(Link link, Point2D pt) { + if (link == link1) { + x1 = pt.getX(); + y1 = pt.getY(); + } else if (link == link2) { + x2 = pt.getX(); + y2 = pt.getY(); + } else { + throw new IllegalArgumentException(); + } + } + + public void drawMe(UGraphic ug, ISkinParam skinParam) { + if (x1 == 0 && y1 == 0) { + return; + } + if (x2 == 0 && y2 == 0) { + return; + } + ug = ug.apply(HColorUtils.BLACK); +// ug.apply(new UTranslate(x1, y1)).draw(new URectangle(10, 10)); +// ug.apply(new UTranslate(x2, y2)).draw(new URectangle(10, 10)); + + final ULine line = new ULine(x2 - x1, y2 - y1); + ug = ug.apply(new UStroke(3, 3, 1)); + ug.apply(new UTranslate(x1, y1)).draw(line); + + final TextBlock label = display.create(new FontConfiguration(skinParam, FontParam.ARROW, null), + HorizontalAlignment.CENTER, skinParam); + final Dimension2D dimLabel = label.calculateDimension(ug.getStringBounder()); + final double x = (x1 + x2) / 2 - dimLabel.getWidth() / 2; + final double y = (y1 + y2) / 2 - dimLabel.getHeight() / 2; + label.drawU(ug.apply(new UTranslate(x, y))); + + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java index 74555505c..a422f44d7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -27,11 +27,11 @@ * * * Original Author: Arnaud Roques + * Contribution : Hisashi Miyashita */ package net.sourceforge.plantuml.cucadiagram; import net.sourceforge.plantuml.OptionFlags; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.svek.extremity.ExtremityFactory; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryArrow; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryArrowAndCircle; @@ -43,27 +43,32 @@ import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryCrowfoot; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryDiamond; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryDoubleLine; +import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryExtendsLike; +import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryHalfArrow; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryLineCrowfoot; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryNotNavigable; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryParenthesis; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryPlus; import net.sourceforge.plantuml.svek.extremity.ExtremityFactorySquarre; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryTriangle; +import net.sourceforge.plantuml.ugraphic.color.HColor; public enum LinkDecor { - NONE(2, false, 0), EXTENDS(30, false, 2), COMPOSITION(15, true, 1.3), AGREGATION(15, false, 1.3), NOT_NAVIGABLE(1, - false, 0.5), + NONE(2, false, 0), EXTENDS(30, false, 2), COMPOSITION(15, true, 1.3), AGREGATION(15, false, 1.3), + NOT_NAVIGABLE(1, false, 0.5), + + REDEFINES(30, false, 2), DEFINEDBY(30, false, 2), + + CROWFOOT(10, true, 0.8), CIRCLE_CROWFOOT(14, false, 0.8), CIRCLE_LINE(10, false, 0.8), DOUBLE_LINE(7, false, 0.7), + LINE_CROWFOOT(10, false, 0.8), - CROWFOOT(10, true, 0.8), CIRCLE_CROWFOOT(14, false, 0.8), CIRCLE_LINE(10, false, 0.8), - DOUBLE_LINE(7, false, 0.7), LINE_CROWFOOT(10, false, 0.8), - ARROW(10, true, 0.5), ARROW_TRIANGLE(10, true, 0.8), ARROW_AND_CIRCLE(10, false, 0.5), - CIRCLE(0, false, 0.5), CIRCLE_CONNECT(0, false, 0.5), PARENTHESIS(0, false, OptionFlags.USE_INTERFACE_EYE2 ? 0.5 - : 1.0), SQUARE(0, false, 0.5), + CIRCLE(0, false, 0.5), CIRCLE_FILL(0, false, 0.5), CIRCLE_CONNECT(0, false, 0.5), + PARENTHESIS(0, false, OptionFlags.USE_INTERFACE_EYE2 ? 0.5 : 1.0), SQUARE(0, false, 0.5), - CIRCLE_CROSS(0, false, 0.5), PLUS(0, false, 1.5), SQUARRE_toberemoved(30, false, 0); + CIRCLE_CROSS(0, false, 0.5), PLUS(0, false, 1.5), HALF_ARROW(0, false, 1.5), SQUARRE_toberemoved(30, false, 0); private final double arrowSize; private final int margin; @@ -87,44 +92,56 @@ public double getArrowSize() { return arrowSize; } - public ExtremityFactory getExtremityFactory(HtmlColor backgroundColor) { - if (this == LinkDecor.PLUS) { + public boolean isExtendsLike() { + return this == EXTENDS || this == REDEFINES || this == DEFINEDBY; + } + + public ExtremityFactory getExtremityFactory(HColor backgroundColor) { + switch (this) { + case PLUS: return new ExtremityFactoryPlus(); - } else if (this == LinkDecor.ARROW_TRIANGLE) { + case REDEFINES: + return new ExtremityFactoryExtendsLike(backgroundColor, false); + case DEFINEDBY: + return new ExtremityFactoryExtendsLike(backgroundColor, true); + case HALF_ARROW: + return new ExtremityFactoryHalfArrow(); + case ARROW_TRIANGLE: return new ExtremityFactoryTriangle(); - } else if (this == LinkDecor.CROWFOOT) { + case CROWFOOT: return new ExtremityFactoryCrowfoot(); - } else if (this == LinkDecor.CIRCLE_CROWFOOT) { + case CIRCLE_CROWFOOT: return new ExtremityFactoryCircleCrowfoot(); - } else if (this == LinkDecor.LINE_CROWFOOT) { + case LINE_CROWFOOT: return new ExtremityFactoryLineCrowfoot(); - } else if (this == LinkDecor.CIRCLE_LINE) { + case CIRCLE_LINE: return new ExtremityFactoryCircleLine(); - } else if (this == LinkDecor.DOUBLE_LINE) { + case DOUBLE_LINE: return new ExtremityFactoryDoubleLine(); - } else if (this == LinkDecor.CIRCLE_CROSS) { + case CIRCLE_CROSS: return new ExtremityFactoryCircleCross(); - } else if (this == LinkDecor.ARROW) { + case ARROW: return new ExtremityFactoryArrow(); - } else if (this == LinkDecor.ARROW_AND_CIRCLE) { + case ARROW_AND_CIRCLE: return new ExtremityFactoryArrowAndCircle(); - } else if (this == LinkDecor.NOT_NAVIGABLE) { + case NOT_NAVIGABLE: return new ExtremityFactoryNotNavigable(); - } else if (this == LinkDecor.AGREGATION) { + case AGREGATION: return new ExtremityFactoryDiamond(false, backgroundColor); - } else if (this == LinkDecor.COMPOSITION) { + case COMPOSITION: return new ExtremityFactoryDiamond(true, backgroundColor); - } else if (this == LinkDecor.CIRCLE) { - return new ExtremityFactoryCircle(); - } else if (this == LinkDecor.SQUARE) { + case CIRCLE: + return new ExtremityFactoryCircle(false); + case CIRCLE_FILL: + return new ExtremityFactoryCircle(true); + case SQUARE: return new ExtremityFactorySquarre(); - } else if (this == LinkDecor.PARENTHESIS) { + case PARENTHESIS: return new ExtremityFactoryParenthesis(); - } else if (this == LinkDecor.CIRCLE_CONNECT) { + case CIRCLE_CONNECT: return new ExtremityFactoryCircleConnect(); + default: + return null; } - - return null; } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkHat.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkHat.java index e230e1b8a..e213de0df 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkHat.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkHat.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkMiddleDecor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkMiddleDecor.java index aab64fd86..419ddd112 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkMiddleDecor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkMiddleDecor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,17 +30,17 @@ */ package net.sourceforge.plantuml.cucadiagram; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.svek.extremity.MiddleCircleCircledMode; import net.sourceforge.plantuml.svek.extremity.MiddleFactory; import net.sourceforge.plantuml.svek.extremity.MiddleFactoryCircle; import net.sourceforge.plantuml.svek.extremity.MiddleFactoryCircleCircled; +import net.sourceforge.plantuml.ugraphic.color.HColor; public enum LinkMiddleDecor { NONE, CIRCLE, CIRCLE_CIRCLED, CIRCLE_CIRCLED1, CIRCLE_CIRCLED2; - public MiddleFactory getMiddleFactory(HtmlColor backColor) { + public MiddleFactory getMiddleFactory(HColor backColor) { if (this == CIRCLE) { return new MiddleFactoryCircle(backColor); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkStyle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkStyle.java index 2a358d6ad..d1132fd52 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkStyle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkStyle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkType.java index 03765d2d5..4523da899 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LinkType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -27,6 +27,7 @@ * * * Original Author: Arnaud Roques + * Contribution : Hisashi Miyashita */ package net.sourceforge.plantuml.cucadiagram; @@ -45,6 +46,23 @@ public boolean isDoubleDecorated() { return decor1 != LinkDecor.NONE && decor2 != LinkDecor.NONE; } + public boolean looksLikeRevertedForSvg() { + if (this.decor1 == LinkDecor.NONE && this.decor2 != LinkDecor.NONE) { + return true; + } + return false; + } + + public boolean looksLikeNoDecorAtAllSvg() { + if (this.decor1 == LinkDecor.NONE && this.decor2 == LinkDecor.NONE) { + return true; + } + if (this.decor1 != LinkDecor.NONE && this.decor2 != LinkDecor.NONE) { + return true; + } + return false; + } + public LinkType(LinkDecor decor1, LinkDecor decor2) { this(LinkHat.NONE, decor1, decor2, LinkHat.NONE); } @@ -94,18 +112,6 @@ private LinkType(LinkHat hat1, LinkDecor decor1, LinkStyle style, LinkMiddleDeco this.hat2 = hat2; } - // private boolean isDashed() { - // return style == LinkStyle.DASHED; - // } - // - // private boolean isDotted() { - // return style == LinkStyle.DOTTED; - // } - // - // private boolean isBold() { - // return style == LinkStyle.BOLD; - // } - public boolean isInvisible() { return style.isInvisible(); } @@ -126,14 +132,6 @@ public LinkType goBold() { return new LinkType(hat1, decor1, LinkStyle.BOLD(), middleDecor, decor2, hat2); } - // public LinkType getInterfaceProvider() { - // return new LinkType(hat1, decor1, LinkStyle.__toremove_INTERFACE_PROVIDER, middleDecor, decor2, hat2); - // } - // - // public LinkType getInterfaceUser() { - // return new LinkType(hat1, decor1, LinkStyle.__toremove_INTERFACE_USER, middleDecor, decor2, hat2); - // } - public LinkType getInversed() { return new LinkType(hat2, decor2, style, middleDecor, decor1, hat1); } @@ -202,8 +200,13 @@ public final LinkDecor getDecor2() { return decor2; } - public boolean isExtendsOrAggregationOrCompositionOrPlus() { - return isExtends() || isAggregationOrComposition() || isPlus(); + private boolean isExtendsOrAggregationOrCompositionOrPlus() { + return isExtends() || isAggregationOrComposition() || isPlus() || isOf(LinkDecor.DEFINEDBY) + || isOf(LinkDecor.REDEFINES); + } + + private boolean isOf(LinkDecor ld) { + return decor1 == ld || decor2 == ld; } private boolean isExtends() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LongCode.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LongCode.java deleted file mode 100644 index 023754f92..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/LongCode.java +++ /dev/null @@ -1,87 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.cucadiagram; - -import net.sourceforge.plantuml.StringUtils; - -public class LongCode implements Comparable { - - private final String fullName; - private final String separator; - - private LongCode(String fullName, String separator) { - if (fullName == null) { - throw new IllegalArgumentException(); - } - this.fullName = fullName; - this.separator = separator; - } - - public String getNamespaceSeparator() { - return separator; - } - - public static LongCode of(String code, String separator) { - if (code == null) { - throw new IllegalStateException(); - } - return new LongCode(code, separator); - } - - public final String getFullName() { - return fullName; - } - - @Override - public String toString() { - return fullName + "(" + separator + ")"; - } - - @Override - public int hashCode() { - return fullName.hashCode(); - } - - @Override - public boolean equals(Object obj) { - final LongCode other = (LongCode) obj; - return this.fullName.equals(other.fullName); - } - - public int compareTo(LongCode other) { - return this.fullName.compareTo(other.fullName); - } - - private LongCode eventuallyRemoveStartingAndEndingDoubleQuote() { - return LongCode.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(fullName), separator); - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Magma.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Magma.java index 99e975aef..4bc5cc0c9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Magma.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Magma.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/MagmaList.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/MagmaList.java index 5eab5bf89..bd1a830a0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/MagmaList.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/MagmaList.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Member.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Member.java index 5b304f342..96354fb44 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Member.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Member.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,20 +30,171 @@ */ package net.sourceforge.plantuml.cucadiagram; +import net.sourceforge.plantuml.Guillemet; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.UrlBuilder; +import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +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.skin.VisibilityModifier; -public interface Member { +public class Member { - public Url getUrl(); + private final String display; + private final boolean staticModifier; + private final boolean abstractModifier; + private final Url url; + private final boolean hasUrl; - public String getDisplay(boolean withVisibilityChar); + private final VisibilityModifier visibilityModifier; - public boolean hasUrl(); + @Override + public String toString() { + return super.toString() + " " + display; + } - public VisibilityModifier getVisibilityModifier(); + public Member(String tmpDisplay, boolean isMethod, boolean manageModifier) { + tmpDisplay = tmpDisplay.replaceAll("(?i)\\{(method|field)\\}\\s*", ""); + if (manageModifier) { + final Pattern2 finalUrl = MyPattern.cmpile("^(.*?)(?:\\[(" + UrlBuilder.getRegexp() + ")\\])?$"); + final Matcher2 matcher = finalUrl.matcher(tmpDisplay); + if (matcher.matches() == false) { + throw new IllegalStateException(); + } + tmpDisplay = matcher.group(1); + final String urlString = matcher.group(2); + if (urlString == null) { + this.url = null; + } else { + this.url = new UrlBuilder(null, ModeUrl.STRICT).getUrl(urlString); + } + } else { + this.url = null; + } + this.hasUrl = this.url != null; + final String lower = StringUtils.goLowerCase(tmpDisplay); - public boolean isStatic(); + if (manageModifier) { + this.staticModifier = lower.contains("{static}") || lower.contains("{classifier}"); + this.abstractModifier = lower.contains("{abstract}"); + String displayClean = tmpDisplay.replaceAll("(?i)\\{(static|classifier|abstract)\\}\\s*", "").trim(); + if (displayClean.length() == 0) { + displayClean = " "; + } - public boolean isAbstract(); + if (VisibilityModifier.isVisibilityCharacter(displayClean)) { + visibilityModifier = VisibilityModifier.getVisibilityModifier(displayClean, isMethod == false); + this.display = StringUtils.trin(Guillemet.GUILLEMET.manageGuillemet(displayClean.substring(1))); + } else { + this.display = Guillemet.GUILLEMET.manageGuillemet(displayClean); + visibilityModifier = null; + } + } else { + this.staticModifier = false; + this.visibilityModifier = null; + this.abstractModifier = false; + tmpDisplay = StringUtils.trin(tmpDisplay); + this.display = tmpDisplay.length() == 0 ? " " : Guillemet.GUILLEMET.manageGuillemet(StringUtils + .trin(tmpDisplay)); + } + } + + public String getDisplay(boolean withVisibilityChar) { + if (withVisibilityChar) { + return getDisplayWithVisibilityChar(); + } + return getDisplayWithoutVisibilityChar(); + } + + private String getDisplayWithoutVisibilityChar() { + // assert display.length() == 0 || VisibilityModifier.isVisibilityCharacter(display.charAt(0)) == false; + return display; + } + + private String getDisplayWithVisibilityChar() { + if (isPrivate()) { + return "-" + display; + } + if (isPublic()) { + return "+" + display; + } + if (isPackagePrivate()) { + return "~" + display; + } + if (isProtected()) { + return "#" + display; + } + if (isIEMandatory()) { + return "*" + display; + } + return display; + } + + @Override + public boolean equals(Object obj) { + final Member other = (Member) obj; + return this.display.equals(other.display); + } + + @Override + public int hashCode() { + return display.hashCode(); + } + + public final boolean isStatic() { + return staticModifier; + } + + public final boolean isAbstract() { + return abstractModifier; + } + + private boolean isPrivate() { + return visibilityModifier == VisibilityModifier.PRIVATE_FIELD + || visibilityModifier == VisibilityModifier.PRIVATE_METHOD; + } + + private boolean isProtected() { + return visibilityModifier == VisibilityModifier.PROTECTED_FIELD + || visibilityModifier == VisibilityModifier.PROTECTED_METHOD; + } + + private boolean isPublic() { + return visibilityModifier == VisibilityModifier.PUBLIC_FIELD + || visibilityModifier == VisibilityModifier.PUBLIC_METHOD; + } + + private boolean isPackagePrivate() { + return visibilityModifier == VisibilityModifier.PACKAGE_PRIVATE_FIELD + || visibilityModifier == VisibilityModifier.PACKAGE_PRIVATE_METHOD; + } + + private boolean isIEMandatory() { + return visibilityModifier == VisibilityModifier.IE_MANDATORY; + } + + public final VisibilityModifier getVisibilityModifier() { + return visibilityModifier; + } + + public final Url getUrl() { + return url; + } + + public boolean hasUrl() { + return hasUrl; + } + + public static boolean isMethod(String s) { + // s = UrlBuilder.purgeUrl(s); + if (s.contains("{method}")) { + return true; + } + if (s.contains("{field}")) { + return false; + } + return s.contains("(") || s.contains(")"); + } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/MemberImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/MemberImpl.java deleted file mode 100644 index fb55f1c94..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/MemberImpl.java +++ /dev/null @@ -1,194 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.cucadiagram; - -import net.sourceforge.plantuml.Guillemet; -import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; -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.skin.VisibilityModifier; - -public class MemberImpl implements Member { - - private final String display; - private final boolean staticModifier; - private final boolean abstractModifier; - private final Url url; - private final boolean hasUrl; - - private final VisibilityModifier visibilityModifier; - - public MemberImpl(String tmpDisplay, boolean isMethod, boolean manageModifier) { - tmpDisplay = tmpDisplay.replaceAll("(?i)\\{(method|field)\\}\\s*", ""); - if (manageModifier) { - final Pattern2 finalUrl = MyPattern.cmpile("^(.*?)(?:\\[(" + UrlBuilder.getRegexp() + ")\\])?$"); - final Matcher2 matcher = finalUrl.matcher(tmpDisplay); - if (matcher.matches() == false) { - throw new IllegalStateException(); - } - tmpDisplay = matcher.group(1); - final String urlString = matcher.group(2); - if (urlString == null) { - this.url = null; - } else { - this.url = new UrlBuilder(null, ModeUrl.STRICT).getUrl(urlString); - } - } else { - this.url = null; - } - this.hasUrl = this.url != null; - final String lower = StringUtils.goLowerCase(tmpDisplay); - - if (manageModifier) { - this.staticModifier = lower.contains("{static}") || lower.contains("{classifier}"); - this.abstractModifier = lower.contains("{abstract}"); - String displayClean = tmpDisplay.replaceAll("(?i)\\{(static|classifier|abstract)\\}\\s*", "").trim(); - if (displayClean.length() == 0) { - displayClean = " "; - } - - if (VisibilityModifier.isVisibilityCharacter(displayClean)) { - visibilityModifier = VisibilityModifier.getVisibilityModifier(displayClean, isMethod == false); - this.display = StringUtils.trin(Guillemet.GUILLEMET.manageGuillemet(displayClean.substring(1))); - } else { - this.display = Guillemet.GUILLEMET.manageGuillemet(displayClean); - visibilityModifier = null; - } - } else { - this.staticModifier = false; - this.visibilityModifier = null; - this.abstractModifier = false; - tmpDisplay = StringUtils.trin(tmpDisplay); - this.display = tmpDisplay.length() == 0 ? " " : Guillemet.GUILLEMET.manageGuillemet(StringUtils.trin(tmpDisplay)); - } - } - - public String getDisplay(boolean withVisibilityChar) { - if (withVisibilityChar) { - return getDisplayWithVisibilityChar(); - } - return getDisplayWithoutVisibilityChar(); - } - - private String getDisplayWithoutVisibilityChar() { - // assert display.length() == 0 || VisibilityModifier.isVisibilityCharacter(display.charAt(0)) == false; - return display; - } - - private String getDisplayWithVisibilityChar() { - if (isPrivate()) { - return "-" + display; - } - if (isPublic()) { - return "+" + display; - } - if (isPackagePrivate()) { - return "~" + display; - } - if (isProtected()) { - return "#" + display; - } - if (isIEMandatory()) { - return "*" + display; - } - return display; - } - - @Override - public boolean equals(Object obj) { - final MemberImpl other = (MemberImpl) obj; - return this.display.equals(other.display); - } - - @Override - public int hashCode() { - return display.hashCode(); - } - - public final boolean isStatic() { - return staticModifier; - } - - public final boolean isAbstract() { - return abstractModifier; - } - - private boolean isPrivate() { - return visibilityModifier == VisibilityModifier.PRIVATE_FIELD - || visibilityModifier == VisibilityModifier.PRIVATE_METHOD; - } - - private boolean isProtected() { - return visibilityModifier == VisibilityModifier.PROTECTED_FIELD - || visibilityModifier == VisibilityModifier.PROTECTED_METHOD; - } - - private boolean isPublic() { - return visibilityModifier == VisibilityModifier.PUBLIC_FIELD - || visibilityModifier == VisibilityModifier.PUBLIC_METHOD; - } - - private boolean isPackagePrivate() { - return visibilityModifier == VisibilityModifier.PACKAGE_PRIVATE_FIELD - || visibilityModifier == VisibilityModifier.PACKAGE_PRIVATE_METHOD; - } - - private boolean isIEMandatory() { - return visibilityModifier == VisibilityModifier.IE_MANDATORY; - } - - public final VisibilityModifier getVisibilityModifier() { - return visibilityModifier; - } - - public final Url getUrl() { - return url; - } - - public boolean hasUrl() { - return hasUrl; - } - - public static boolean isMethod(String s) { - // s = UrlBuilder.purgeUrl(s); - if (s.contains("{method}")) { - return true; - } - if (s.contains("{field}")) { - return false; - } - return s.contains("(") || s.contains(")"); - } -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java index d27ade52e..def7d934a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,12 +39,12 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -54,6 +54,9 @@ import net.sourceforge.plantuml.graphic.TextBlockWithUrl; import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.Ports; import net.sourceforge.plantuml.svek.WithPorts; import net.sourceforge.plantuml.ugraphic.PlacementStrategy; @@ -62,6 +65,7 @@ import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2Left; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULayoutGroup; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.CharHidder; public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockWidth, TextBlock, WithPorts { @@ -72,30 +76,26 @@ public TextBlock asBlockMemberImpl() { private final FontParam fontParam; private final ISkinParam skinParam; - private final HtmlColor color; - private final HtmlColor hyperlinkColor; - private final boolean useUnderlineForHyperlink; private final Rose rose = new Rose(); private final List members = new ArrayList(); private final HorizontalAlignment align; private final Stereotype stereotype; private final ILeaf leaf; + private final SName diagramType; public MethodsOrFieldsArea(List members, FontParam fontParam, ISkinParam skinParam, Stereotype stereotype, - ILeaf leaf) { - this(members, fontParam, skinParam, HorizontalAlignment.LEFT, stereotype, leaf); + ILeaf leaf, SName diagramType) { + this(members, fontParam, skinParam, HorizontalAlignment.LEFT, stereotype, leaf, diagramType); } public MethodsOrFieldsArea(List members, FontParam fontParam, ISkinParam skinParam, - HorizontalAlignment align, Stereotype stereotype, ILeaf leaf) { + HorizontalAlignment align, Stereotype stereotype, ILeaf leaf, SName diagramType) { + this.diagramType = diagramType; this.leaf = leaf; this.stereotype = stereotype; this.align = align; this.skinParam = skinParam; this.fontParam = fontParam; - this.color = rose.getFontColor(skinParam, fontParam); - this.hyperlinkColor = skinParam.getHyperlinkColor(); - this.useUnderlineForHyperlink = skinParam.useUnderlineForHyperlink(); this.members.addAll(members); } @@ -154,14 +154,24 @@ private TextBlock createTextBlock(Member m) { if (withVisibilityChar && s.startsWith("#")) { s = CharHidder.addTileAtBegin(s); } - FontConfiguration config = new FontConfiguration(skinParam, fontParam, stereotype); + FontConfiguration config; + if (SkinParam.USE_STYLES()) { +// final Style style = StyleSignature.of(SName.root, SName.element, SName.componentDiagram, SName.component) +// .getMergedStyle(skinParam.getCurrentStyleBuilder()); + final Style style = fontParam.getStyleDefinition(diagramType) + .getMergedStyle(skinParam.getCurrentStyleBuilder()); + config = new FontConfiguration(style, skinParam, stereotype, fontParam); + } else { + config = new FontConfiguration(skinParam, fontParam, stereotype); + } if (m.isAbstract()) { config = config.italic(); } if (m.isStatic()) { config = config.underline(); } - TextBlock bloc = Display.getWithNewlines(s).create(config, align, skinParam, CreoleMode.SIMPLE_LINE, + + TextBlock bloc = Display.getWithNewlines(s).create8(config, align, skinParam, CreoleMode.SIMPLE_LINE, skinParam.wrapWidth()); bloc = TextBlockUtils.fullInnerPosition(bloc, m.getDisplay(false)); return new TextBlockTracer(m, bloc); @@ -183,7 +193,7 @@ public void drawU(UGraphic ug) { } bloc.drawU(ug); if (url != null) { - ug.closeAction(); + ug.closeUrl(); } } @@ -205,9 +215,10 @@ private TextBlock getUBlock(final VisibilityModifier modifier, Url url) { public void drawU(UGraphic ug) { } - + @Override - public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) { + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, + InnerStrategy strategy) { return null; } @@ -216,9 +227,9 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { } }; } - final HtmlColor back = modifier.getBackground() == null ? null : rose.getHtmlColor(skinParam, - modifier.getBackground()); - final HtmlColor fore = rose.getHtmlColor(skinParam, modifier.getForeground()); + final HColor back = modifier.getBackground() == null ? null + : rose.getHtmlColor(skinParam, modifier.getBackground()); + final HColor fore = rose.getHtmlColor(skinParam, modifier.getForeground()); final TextBlock uBlock = modifier.getUBlock(skinParam.classAttributeIconSize(), fore, back, url != null); return TextBlockWithUrl.withUrl(uBlock, url); @@ -247,8 +258,8 @@ public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, private ULayoutGroup getLayout(final StringBounder stringBounder) { final ULayoutGroup group; if (hasSmallIcon()) { - group = new ULayoutGroup(new PlacementStrategyVisibility(stringBounder, - skinParam.getCircledCharacterRadius() + 3)); + group = new ULayoutGroup( + new PlacementStrategyVisibility(stringBounder, skinParam.getCircledCharacterRadius() + 3)); for (Member att : members) { final TextBlock bloc = createTextBlock(att); final VisibilityModifier modifier = att.getVisibilityModifier(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/NamespaceStrategy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/NamespaceStrategy.java index f561eef92..7760225d2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/NamespaceStrategy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/NamespaceStrategy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/NoteLinkStrategy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/NoteLinkStrategy.java index b9cd854fb..98dcb4655 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/NoteLinkStrategy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/NoteLinkStrategy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/PortionShower.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/PortionShower.java index f544ea1ed..8f2d18d1e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/PortionShower.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/PortionShower.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Rankdir.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Rankdir.java index 32344e192..a68505bd7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Rankdir.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Rankdir.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/RuleType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/RuleType.java index 485b15bca..3aade552b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/RuleType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/RuleType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/SquareLinker.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/SquareLinker.java index 92facd79e..72e69d830 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/SquareLinker.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/SquareLinker.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/SquareMaker.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/SquareMaker.java index b7c54ff5b..0c4202959 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/SquareMaker.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/SquareMaker.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Stereotag.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Stereotag.java index f68c5773b..56d5986c6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Stereotag.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Stereotag.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java index 66dce1d58..435f3fc31 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -48,17 +48,17 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.creole.CommandCreoleImg; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.sprite.Sprite; +import net.sourceforge.plantuml.sprite.SpriteUtils; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; -import net.sourceforge.plantuml.ugraphic.sprite.SpriteUtils; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class Stereotype implements CharSequence { private final static RegexComposed circleChar = new RegexConcat( // @@ -98,12 +98,12 @@ public class Stereotype implements CharSequence { private final boolean automaticPackageStyle; private String label; - private HtmlColor htmlColor; + private HColor htmlColor; private char character; private String spriteName; private double spriteScale; - public Stereotype(String label, double radius, UFont circledFont, IHtmlColorSet htmlColorSet) { + public Stereotype(String label, double radius, UFont circledFont, HColorSet htmlColorSet) { this(label, radius, circledFont, true, htmlColorSet); } @@ -117,14 +117,14 @@ public Stereotype(String label, boolean automaticPackageStyle) { if (label.startsWith("<<$") && label.endsWith(">>")) { final RegexResult mCircleSprite = circleSprite.matcher(label); this.spriteName = mCircleSprite.get("NAME", 0); - this.spriteScale = CommandCreoleImg.getScale(mCircleSprite.get("SCALE", 0), 1); + this.spriteScale = Parser.getScale(mCircleSprite.get("SCALE", 0), 1); } else { this.spriteName = null; } } public Stereotype(String label, double radius, UFont circledFont, boolean automaticPackageStyle, - IHtmlColorSet htmlColorSet) { + HColorSet htmlColorSet) { if (label == null) { throw new IllegalArgumentException(); } @@ -148,11 +148,11 @@ public Stereotype(String label, double radius, UFont circledFont, boolean automa local = null; } final String colName = mCircleSprite.get("COLOR", 0); - final HtmlColor col = htmlColorSet.getColorIfValid(colName); - this.htmlColor = col == null ? HtmlColorUtils.BLACK : col; + final HColor col = htmlColorSet.getColorIfValid(colName); + this.htmlColor = col == null ? HColorUtils.BLACK : col; this.spriteName = mCircleSprite.get("NAME", 0); this.character = '\0'; - this.spriteScale = CommandCreoleImg.getScale(mCircleSprite.get("SCALE", 0), 1); + this.spriteScale = Parser.getScale(mCircleSprite.get("SCALE", 0), 1); } else if (mCircleChar != null) { if (StringUtils.isNotEmpty(mCircleChar.get("LABEL", 0))) { local = "<<" + mCircleChar.get("LABEL", 0) + ">>"; @@ -177,7 +177,7 @@ public Stereotype(String label) { this(label, true); } - public HtmlColor getHtmlColor() { + public HColor getHtmlColor() { return htmlColor; } @@ -261,7 +261,7 @@ public String getLabel(Guillemet guillemet) { public List getLabels(Guillemet guillemet) { final String labelLocal = getLabel(Guillemet.DOUBLE_COMPARATOR); if (labelLocal == null) { - return null; + return Collections.emptyList(); } return cutLabels(labelLocal, guillemet); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/SuperGroup.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/SuperGroup.java new file mode 100644 index 000000000..b4030e4b2 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/SuperGroup.java @@ -0,0 +1,48 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.cucadiagram; + +import java.util.HashSet; +import java.util.Set; + +public class SuperGroup { + + private final Set groups = new HashSet(); + + public SuperGroup(IGroup g) { + this.groups.add(g); + } + + public IGroup getFirstGroup() { + return groups.iterator().next(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/TextBlockMap.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/TextBlockMap.java new file mode 100644 index 000000000..454213bb5 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/TextBlockMap.java @@ -0,0 +1,203 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.cucadiagram; + +import java.awt.geom.Dimension2D; +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.svek.Ports; +import net.sourceforge.plantuml.svek.WithPorts; +import net.sourceforge.plantuml.ugraphic.UEllipse; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.ULine; +import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; + +public class TextBlockMap extends AbstractTextBlock implements WithPorts { + + private final FontParam fontParam; + private final ISkinParam skinParam; + private final Map blocksMap = new LinkedHashMap(); + private final List keys = new ArrayList(); + private double totalWidth; + + public TextBlockMap(FontParam fontParam, ISkinParam skinParam, Map map) { + this.fontParam = fontParam; + this.skinParam = skinParam; + for (Map.Entry ent : map.entrySet()) { + final String key = ent.getKey(); + this.keys.add(key); + final String value = ent.getValue(); + final TextBlock block1 = getTextBlock(key); + final TextBlock block2 = getTextBlock(value); + this.blocksMap.put(block1, block2); + } + } + + public Ports getPorts(StringBounder stringBounder) { + final Ports ports = new Ports(); + int i = 0; + double y = 0; + for (Map.Entry ent : blocksMap.entrySet()) { + final TextBlock key = ent.getKey(); + final TextBlock value = ent.getValue(); + final double height = getHeightOfRow(stringBounder, key, value); + ports.add(keys.get(i), y, height); + y += height; + i++; + } + return ports; + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return new Dimension2DDouble(getWidthColA(stringBounder) + getWidthColB(stringBounder), + getTotalHeight(stringBounder)); + } + + private double getWidthColA(StringBounder stringBounder) { + return getMaxWidth(stringBounder, blocksMap.keySet()); + } + + private double getWidthColB(StringBounder stringBounder) { + return getMaxWidth(stringBounder, blocksMap.values()); + } + + private double getMaxWidth(StringBounder stringBounder, Collection blocks) { + double width = 0; + for (TextBlock block : blocks) { + width = Math.max(width, block.calculateDimension(stringBounder).getWidth()); + } + return width; + } + + public void drawU(final UGraphic ug) { + final StringBounder stringBounder = ug.getStringBounder(); + final Dimension2D fullDim = calculateDimension(stringBounder); + final double trueWidth = Math.max(fullDim.getWidth(), totalWidth); + final double widthColA = getWidthColA(stringBounder); + final double widthColB = getWidthColB(stringBounder); + double y = 0; + for (Map.Entry ent : blocksMap.entrySet()) { + final TextBlock key = ent.getKey(); + final TextBlock value = ent.getValue(); + final UGraphic ugline = ug.apply(UTranslate.dy(y)); + ugline.draw(ULine.hline(trueWidth)); + final double heightOfRow = getHeightOfRow(stringBounder, key, value); + if (value instanceof Point) { +// final Dimension2D dimPoint = value.calculateDimension(stringBounder); +// final double xp = widthColA + (widthColB - dimPoint.getWidth()) / 2; +// final double yp = (heightOfRow - dimPoint.getHeight()) / 2; +// value.drawU(ugline.apply(new UTranslate(xp, yp))); + final double posColA = (trueWidth - key.calculateDimension(stringBounder).getWidth()) / 2; + key.drawU(ugline.apply(UTranslate.dx(posColA))); + } else { + final double posColA = (widthColA - key.calculateDimension(stringBounder).getWidth()) / 2; + key.drawU(ugline.apply(UTranslate.dx(posColA))); + value.drawU(ugline.apply(UTranslate.dx(widthColA))); + ugline.apply(UTranslate.dx(widthColA)).draw(ULine.vline(heightOfRow)); + } + y += heightOfRow; + } + // ug.apply(UTranslate.dx(widthColA)).draw(ULine.vline(fullDim.getHeight())); + } + + private double getTotalHeight(StringBounder stringBounder) { + double height = 0; + for (Map.Entry ent : blocksMap.entrySet()) { + final TextBlock key = ent.getKey(); + final TextBlock value = ent.getValue(); + height += getHeightOfRow(stringBounder, key, value); + } + return height; + } + + private double getHeightOfRow(StringBounder stringBounder, TextBlock key, TextBlock value) { + return Math.max(key.calculateDimension(stringBounder).getHeight(), + value.calculateDimension(stringBounder).getHeight()); + } + + private TextBlock getTextBlock(String key) { + if (key.equals("\0")) { + return new Point(getFontConfiguration().getColor()); + } + final Display display = Display.getWithNewlines(key); + TextBlock result = display.create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam); + result = TextBlockUtils.withMargin(result, 5, 2); + return result; + } + + static class Point extends AbstractTextBlock { + + private final HColor color; + + public Point(HColor color) { + this.color = color; + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return new Dimension2DDouble(getDiameter(), getDiameter()); + } + + public void drawU(UGraphic ug) { + final UShape point = new UEllipse(getDiameter(), getDiameter()); + ug = ug.apply(color).apply(color.bg()); + ug.draw(point); + } + + private double getDiameter() { + return 7; + } + + } + + private FontConfiguration getFontConfiguration() { + return new FontConfiguration(skinParam, fontParam, null); + } + + public void setTotalWidth(double totalWidth) { + this.totalWidth = totalWidth; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/UnparsableGraphvizException.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/UnparsableGraphvizException.java index 0717db7dc..83c35c87f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/UnparsableGraphvizException.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/UnparsableGraphvizException.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/WithLinkType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/WithLinkType.java index 6939bb748..52dd86089 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/WithLinkType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/WithLinkType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,10 +35,10 @@ import java.util.List; import java.util.StringTokenizer; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public abstract class WithLinkType { @@ -50,15 +50,15 @@ public abstract class WithLinkType { private List supplementary = new ArrayList(); - public final HtmlColor getSpecificColor() { + public final HColor getSpecificColor() { return colors.getColor(ColorType.LINE); } - public final void setSpecificColor(HtmlColor specificColor) { + public final void setSpecificColor(HColor specificColor) { setSpecificColor(specificColor, 0); } - public final void setSpecificColor(HtmlColor specificColor, int i) { + public final void setSpecificColor(HColor specificColor, int i) { if (i == 0) { colors = colors.add(ColorType.LINE, specificColor); } else { @@ -142,7 +142,7 @@ private void applyOneStyle(String arrowStyle, int i) { } else if (s.startsWith("thickness=")) { this.goThickness(Double.parseDouble(s.substring("thickness=".length()))); } else { - final HtmlColor tmp = HtmlColorSet.getInstance().getColorIfValid(s); + final HColor tmp = HColorSet.instance().getColorIfValid(s); setSpecificColor(tmp, i); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/AbstractGraphviz.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/AbstractGraphviz.java index 943e73c64..fa6cd92a6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/AbstractGraphviz.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/AbstractGraphviz.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,6 +39,7 @@ import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.security.SFile; abstract class AbstractGraphviz implements Graphviz { @@ -53,8 +54,8 @@ static boolean isWindows() { private static String findExecutableOnPath(String name) { final String path = System.getenv("PATH"); if (path != null) { - for (String dirname : path.split(File.pathSeparator)) { - File file = new File(dirname, name); + for (String dirname : path.split(SFile.pathSeparator)) { + final File file = new File(dirname, name); if (file.isFile() && file.canExecute()) { return file.getAbsolutePath(); } @@ -93,7 +94,8 @@ final public ProcessState createFile3(OutputStream os) { } if (getExeState() != ExeState.OK) { - // createPngNoGraphviz(os, new FileFormatOption(FileFormat.valueOf(type[0].goUpperCase()))); + // createPngNoGraphviz(os, new + // FileFormatOption(FileFormat.valueOf(type[0].goUpperCase()))); throw new IllegalStateException(); } final String cmd[] = getCommandLine(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramSimplifierActivity.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramSimplifierActivity.java index 829f12c1d..6ea08301b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramSimplifierActivity.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramSimplifierActivity.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramSimplifierState.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramSimplifierState.java index 7b38b53ce..fcc80d6cd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramSimplifierState.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramSimplifierState.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java index f9ab91ab3..1f6dcc19c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,10 +31,8 @@ package net.sourceforge.plantuml.cucadiagram.dot; import java.awt.geom.Point2D; -import java.io.File; import java.io.IOException; import java.io.OutputStream; -import java.io.PrintStream; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -56,6 +54,8 @@ import net.sourceforge.plantuml.posimo.Cluster; import net.sourceforge.plantuml.posimo.GraphvizSolverB; import net.sourceforge.plantuml.posimo.Path; +import net.sourceforge.plantuml.security.SFile; +import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt; @@ -105,19 +105,20 @@ public CucaDiagramTxtMaker(CucaDiagram diagram, FileFormat fileFormat) throws IO for (Link link : diagram.getLinks()) { final Block b1 = blocks.get(link.getEntity1()); final Block b2 = blocks.get(link.getEntity2()); - paths.add(new Path(b1, b2, null, link.getLength())); + paths.add(new Path(b1, b2, null, link.getLength(), link.isInvis())); } solver.solve(root, paths); for (Path p : paths) { + if (p.isInvis()) { + continue; + } p.getDotPath().draw(globalUg.getCharArea(), getXPixelPerChar(), getYPixelPerChar()); } for (IEntity ent : diagram.getLeafsvalues()) { final Block b = blocks.get(ent); final Point2D p = b.getPosition(); - printClass( - ent, - (UGraphicTxt) globalUg.apply(new UTranslate(p.getX() / getXPixelPerChar(), p.getY() - / getYPixelPerChar()))); + printClass(ent, (UGraphicTxt) globalUg + .apply(new UTranslate(p.getX() / getXPixelPerChar(), p.getY() / getYPixelPerChar()))); } } @@ -146,11 +147,11 @@ private void printClass(final IEntity ent, UGraphicTxt ug) { } } - public List createFiles(File suggestedFile) throws IOException { + public List createFiles(SFile suggestedFile) throws IOException { if (fileFormat == FileFormat.UTXT) { - globalUg.getCharArea().print(new PrintStream(suggestedFile, "UTF-8")); + globalUg.getCharArea().print(suggestedFile.createPrintStream("UTF-8")); } else { - globalUg.getCharArea().print(new PrintStream(suggestedFile)); + globalUg.getCharArea().print(suggestedFile.createPrintStream()); } return Collections.singletonList(suggestedFile); } @@ -190,7 +191,7 @@ private int getWidth(IEntity entity) { } public void createFiles(OutputStream os, int index) { - globalUg.getCharArea().print(new PrintStream(os)); + globalUg.getCharArea().print(SecurityUtils.createPrintStream(os)); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/DebugTrace.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/DebugTrace.java index 464737340..3c11f129c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/DebugTrace.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/DebugTrace.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,20 +30,21 @@ */ package net.sourceforge.plantuml.cucadiagram.dot; -import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; +import net.sourceforge.plantuml.security.SFile; + public class DebugTrace { - private static final File out = new File("debug" + System.currentTimeMillis() + ".txt"); + private static final SFile out = new SFile("debug" + System.currentTimeMillis() + ".txt"); private static PrintWriter pw; private synchronized static PrintWriter getPrintWriter() { if (pw == null) { try { - pw = new PrintWriter(out); + pw = out.createPrintWriter(); } catch (FileNotFoundException e) { } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/DotData.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/DotData.java index 5c633ea23..9a25d78bb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/DotData.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/DotData.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -46,11 +46,10 @@ import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Link; -import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.PortionShower; import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory; import net.sourceforge.plantuml.svek.DotMode; -import net.sourceforge.plantuml.ugraphic.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; final public class DotData implements PortionShower { @@ -70,6 +69,10 @@ final public class DotData implements PortionShower { private final ColorMapper colorMapper; private final EntityFactory entityFactory; + public EntityFactory getEntityFactory() { + return entityFactory; + } + public DotData(IGroup topParent, List links, Collection leafs, UmlDiagramType umlDiagramType, ISkinParam skinParam, GroupHierarchy groupHierarchy, PortionShower portionShower, ColorMapper colorMapper, EntityFactory entityFactory, boolean isHideEmptyDescriptionForState, DotMode dotMode, @@ -143,6 +146,10 @@ public IGroup getRootGroup() { return entityFactory.getRootGroup(); } + public boolean isDegeneratedWithFewEntities(int nb) { + return entityFactory.groups().size() == 0 && getLinks().size() == 0 && getLeafs().size() == nb; + } + public final boolean isHideEmptyDescriptionForState() { return isHideEmptyDescriptionForState; } @@ -162,7 +169,7 @@ public Pragma getPragma() { public void removeIrrelevantSametail() { final Map sametails = new HashMap(); for (Link link : links) { - if (link.getType().getDecor2() == LinkDecor.EXTENDS) { + if (link.getType().getDecor2().isExtendsLike()) { link.setSametail(link.getEntity1().getUid()); } final String sametail = link.getSametail(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/DotMaker2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/DotMaker2.java index 986a3e16d..49db3b304 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/DotMaker2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/DotMaker2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/DotSplines.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/DotSplines.java index 207d63993..9c91531f0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/DotSplines.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/DotSplines.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/ExeState.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/ExeState.java index 8e38e7ef7..176f9afe3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/ExeState.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/ExeState.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/Graphviz.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/Graphviz.java index 1d9d841db..5a5230a70 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/Graphviz.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/Graphviz.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizLinux.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizLinux.java index 14bd3d1c2..652b69774 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizLinux.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizLinux.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java index 6738adaa8..f6964ba56 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,8 +33,6 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -42,6 +40,9 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.security.SFile; +import net.sourceforge.plantuml.security.SecurityProfile; +import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.vizjs.GraphvizJs; import net.sourceforge.plantuml.vizjs.VizJsEngine; @@ -51,7 +52,7 @@ public class GraphvizUtils { private static int DOT_VERSION_LIMIT = 226; private static boolean isWindows() { - return File.separatorChar == '\\'; + return SFile.separatorChar == '\\'; } private static String dotExecutable; @@ -127,7 +128,7 @@ public static int getenvImageLimit() { if (local != null) { return local; } - final String env = getenv("PLANTUML_LIMIT_SIZE"); + final String env = SecurityUtils.getenv("PLANTUML_LIMIT_SIZE"); if (StringUtils.isNotEmpty(env) && env.matches("\\d+")) { return Integer.parseInt(env); } @@ -135,19 +136,11 @@ public static int getenvImageLimit() { } public static String getenvDefaultConfigFilename() { - return getenv("PLANTUML_DEFAULT_CONFIG_FILENAME"); + return SecurityUtils.getenv("PLANTUML_DEFAULT_CONFIG_FILENAME"); } public static String getenvLogData() { - return getenv("PLANTUML_LOGDATA"); - } - - public static String getenv(String name) { - final String env = System.getProperty(name); - if (StringUtils.isNotEmpty(env)) { - return env; - } - return System.getenv(name); + return SecurityUtils.getenv("PLANTUML_LOGDATA"); } private static String dotVersion = null; @@ -208,15 +201,16 @@ static public int addDotStatus(List result, boolean withRichText) { return error; } - final String ent = GraphvizUtils.getenvGraphvizDot(); - if (ent == null) { - result.add("The environment variable GRAPHVIZ_DOT has not been set"); - } else { - result.add("The environment variable GRAPHVIZ_DOT has been set to " + ent); - } final File dotExe = GraphvizUtils.getDotExe(); - result.add("Dot executable is " + dotExe); - + if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) { + final String ent = GraphvizUtils.getenvGraphvizDot(); + if (ent == null) { + result.add("The environment variable GRAPHVIZ_DOT has not been set"); + } else { + result.add("The environment variable GRAPHVIZ_DOT has been set to " + ent); + } + result.add("Dot executable is " + dotExe); + } final ExeState exeState = ExeState.checkFile(dotExe); if (exeState == ExeState.OK) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersion.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersion.java index aef3d89a5..2247fa26e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersion.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersion.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersionFinder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersionFinder.java index 8b1a62626..d6789733f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersionFinder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersionFinder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersions.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersions.java index 9524e824c..30185a891 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersions.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersions.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizWindows.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizWindows.java index 5b9b56631..4688d6cae 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizWindows.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizWindows.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,37 +41,54 @@ class GraphvizWindows extends AbstractGraphviz { + static private File specificDotExe; + @Override protected File specificDotExe() { - final File result = searchInDir(new File("c:/Program Files")); - if (result != null) { - return result; - } - final File result86 = searchInDir(new File("c:/Program Files (x86)")); - if (result86 != null) { - return result86; + synchronized (GraphvizWindows.class) { + if (specificDotExe == null) { + specificDotExe = specificDotExeSlow(); + } + return specificDotExe; } - final File resultEclipse = searchInDir(new File("c:/eclipse/graphviz")); - if (resultEclipse != null) { - return resultEclipse; + } + + private File specificDotExeSlow() { + for (File tmp : new File("c:/").listFiles(new FileFilter() { + public boolean accept(java.io.File pathname) { + return pathname.isDirectory() && pathname.canRead(); + } + })) { + final File result = searchInDir(tmp); + if (result != null) { + return result; + } } return null; } - private static File searchInDir(final File programFile) { - if (programFile.exists() == false || programFile.isDirectory() == false) { + private static File searchInDir(final File dir) { + if (dir.exists() == false || dir.isDirectory() == false) { return null; } final List dots = new ArrayList(); - for (File f : programFile.listFiles(new FileFilter() { - public boolean accept(File pathname) { + final File[] files = dir.listFiles(new FileFilter() { + public boolean accept(java.io.File pathname) { return pathname.isDirectory() && StringUtils.goLowerCase(pathname.getName()).startsWith("graphviz"); } - })) { + }); + if (files == null) { + return null; + } + for (File f : files) { final File result = new File(new File(f, "bin"), "dot.exe"); if (result.exists() && result.canRead()) { dots.add(result.getAbsoluteFile()); } + final File result2 = new File(new File(f, "release/bin"), "dot.exe"); + if (result2.exists() && result2.canRead()) { + dots.add(result2.getAbsoluteFile()); + } } return higherVersion(dots); } @@ -87,11 +104,10 @@ static File higherVersion(List dots) { GraphvizWindows(ISkinParam skinParam, String dotString, String... type) { super(skinParam, dotString, type); } - + @Override protected String getExeName() { return "dot.exe"; } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/Neighborhood.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/Neighborhood.java index 35c8a8544..09d16e432 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/Neighborhood.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/Neighborhood.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessRunner.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessRunner.java index 9e88c26f3..b348a2a4f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessRunner.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessRunner.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,7 +30,6 @@ */ package net.sourceforge.plantuml.cucadiagram.dot; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -40,6 +39,7 @@ import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.api.MyRunnable; import net.sourceforge.plantuml.api.TimeoutExecutor; +import net.sourceforge.plantuml.security.SFile; public class ProcessRunner { @@ -59,7 +59,7 @@ public ProcessState run(byte in[], OutputStream redirection) { return run(in, redirection, null); } - public ProcessState run(byte in[], OutputStream redirection, File dir) { + public ProcessState run(byte in[], OutputStream redirection, SFile dir) { if (this.state.differs(ProcessState.INIT())) { throw new IllegalStateException(); } @@ -91,14 +91,14 @@ public ProcessState run(byte in[], OutputStream redirection, File dir) { class MainThread implements MyRunnable { private final String[] cmd; - private final File dir; + private final SFile dir; private final OutputStream redirection; private final byte[] in; private volatile Process process; private volatile ThreadStream errorStream; private volatile ThreadStream outStream; - public MainThread(String[] cmd, File dir, OutputStream redirection, byte[] in) { + public MainThread(String[] cmd, SFile dir, OutputStream redirection, byte[] in) { this.cmd = cmd; this.dir = dir; this.redirection = redirection; @@ -155,7 +155,7 @@ public void cancelJob() { private void startThreads() { try { - process = Runtime.getRuntime().exec(cmd, null, dir); + process = Runtime.getRuntime().exec(cmd, null, dir == null ? null : dir.conv()); } catch (IOException e) { e.printStackTrace(); changeState.lock(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessState.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessState.java index 6433cb6fc..755b74b0f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessState.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/dot/ProcessState.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/entity/EntityFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/entity/EntityFactory.java index 9cebb0c7a..58c8a2027 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/entity/EntityFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/entity/EntityFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,13 +33,23 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; +import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; +import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.cucadiagram.Bodier; +import net.sourceforge.plantuml.cucadiagram.BodierImpl; +import net.sourceforge.plantuml.cucadiagram.BodierMap; import net.sourceforge.plantuml.cucadiagram.Code; +import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.GroupRoot; import net.sourceforge.plantuml.cucadiagram.GroupType; @@ -47,25 +57,139 @@ import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; -import net.sourceforge.plantuml.cucadiagram.LongCode; +import net.sourceforge.plantuml.cucadiagram.SuperGroup; +import net.sourceforge.plantuml.graphic.USymbol; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.skin.VisibilityModifier; +import net.sourceforge.plantuml.ugraphic.color.HColor; -public class EntityFactory { +public final class EntityFactory { + + private final Map leafsByCode; + private final Map groupsByCode; + + /* private */final Map leafs2 = new LinkedHashMap(); + /* private */final Map groups2 = new LinkedHashMap(); - private final Map leafs = new Protect(new LinkedHashMap()); private final List links = new ArrayList(); - private final Map groups = new Protect(new LinkedHashMap()); + private int rawLayout; private final IGroup rootGroup = new GroupRoot(this); + private final SuperGroup rootSuperGroup = new SuperGroup(rootGroup); + private final List hides2; private final List removed; + /* private */ final public CucaDiagram namespaceSeparator; + // private final boolean mergeIntricated; + private Map emptyGroupsAsNode = new HashMap(); + + public ILeaf getLeafForEmptyGroup(IGroup g) { + return emptyGroupsAsNode.get(g); + } + + public SuperGroup getRootSuperGroup() { + return rootSuperGroup; + } + + private Set superGroups = null; + final Map groupToSuper = new LinkedHashMap(); + + public Set getAllSuperGroups() { + return Collections.unmodifiableSet(superGroups); + } + + public void buildSuperGroups() { + superGroups = new HashSet(); + for (IGroup g : groups2.values()) { + final SuperGroup sg = new SuperGroup(g); + superGroups.add(sg); + groupToSuper.put(g, sg); + } + } + + public ILeaf createLeafForEmptyGroup(IGroup g, ISkinParam skinParam) { + final ILeaf folder = this.createLeaf(g.getIdent(), g.getCode(), g.getDisplay(), LeafType.EMPTY_PACKAGE, + g.getParentContainer(), null, this.namespaceSeparator.getNamespaceSeparator()); + ((EntityImpl) folder).setOriginalGroup(g); + final USymbol symbol = g.getUSymbol(); + folder.setUSymbol(symbol); + folder.setStereotype(g.getStereotype()); + if (g.getUrl99() != null) { + folder.addUrl(g.getUrl99()); + } + if (SkinParam.USE_STYLES()) { + // System.err.println("Backcolor ?"); + } else { + if (g.getColors(skinParam).getColor(ColorType.BACK) == null) { + final ColorParam param = symbol == null ? ColorParam.packageBackground : symbol.getColorParamBack(); + final HColor c1 = skinParam.getHtmlColor(param, g.getStereotype(), false); + folder.setSpecificColorTOBEREMOVED(ColorType.BACK, + c1 == null ? skinParam.getBackgroundColor(false) : c1); + } else { + folder.setSpecificColorTOBEREMOVED(ColorType.BACK, g.getColors(skinParam).getColor(ColorType.BACK)); + } + } + emptyGroupsAsNode.put(g, folder); + return folder; + } + + public Display getIntricatedDisplay(Ident ident) { + final Set known = new HashSet(groups2.keySet()); + known.removeAll(hiddenBecauseOfIntrication); + String sep = namespaceSeparator.getNamespaceSeparator(); + if (sep == null) { + sep = "."; + } + for (int check = ident.size() - 1; check > 0; check--) { + if (known.contains(ident.getPrefix(check))) { + // if (hiddenBecauseOfIntrication.contains(ident.getPrefix(check)) == false) { + return Display.getWithNewlines(ident.getSuffix(check).toString(sep)) + .withCreoleMode(CreoleMode.SIMPLE_LINE); + } + } + return Display.getWithNewlines(ident.toString(sep)).withCreoleMode(CreoleMode.SIMPLE_LINE); + } + + private final Collection hiddenBecauseOfIntrication = new ArrayList(); + + public IGroup isIntricated(IGroup parent) { + final int leafs = parent.getLeafsDirect().size(); + final Collection children = parent.getChildren(); + if (leafs == 0 && children.size() == 1) { + final IGroup g = children.iterator().next(); + if (g.getLeafsDirect().size() == 0 && g.getChildren().size() == 0 + && g.getGroupType() == GroupType.PACKAGE) { + return null; + } + for (Link link : this.getLinks()) { + if (link.contains(parent)) { + return null; + } + } + ((EntityImpl) g).setIntricated(true); + hiddenBecauseOfIntrication.add(parent.getIdent()); + return g; + } + return null; + } - public EntityFactory(List hides2, List removed) { + public EntityFactory(List hides2, List removed, CucaDiagram namespaceSeparator) { this.hides2 = hides2; this.removed = removed; + this.namespaceSeparator = namespaceSeparator; + // this.mergeIntricated = namespaceSeparator.mergeIntricated(); + + // if (OptionFlags.V1972(namespaceSeparator)) { + // this.leafsByCode = null; + // this.groupsByCode = null; + // } else { + this.leafsByCode = new LinkedHashMap(); + this.groupsByCode = new LinkedHashMap(); + // } } public boolean isHidden(ILeaf leaf) { @@ -84,38 +208,37 @@ public boolean isRemoved(ILeaf leaf) { return result; } - public ILeaf createLeaf(Code code, Display display, LeafType entityType, IGroup parentContainer, + public void thisIsGoingToBeALeaf(Ident ident) { + } + + public void thisIsNotArealGroup(Ident ident) { + } + + public ILeaf createLeaf(Ident ident, Code code, Display display, LeafType entityType, IGroup parentContainer, Set hides, String namespaceSeparator) { if (entityType == null) { throw new IllegalArgumentException(); } - final Bodier bodier = new Bodier(entityType, hides); - final LongCode longCode = getLongCode(code, namespaceSeparator); - final EntityImpl result = new EntityImpl(this, code, bodier, parentContainer, entityType, longCode, + final Bodier bodier = entityType == LeafType.MAP ? new BodierMap() : new BodierImpl(entityType, hides); + final EntityImpl result = new EntityImpl(ident, code, this, bodier, parentContainer, entityType, namespaceSeparator, rawLayout); bodier.setLeaf(result); result.setDisplay(display); return result; } - private LongCode getLongCode(Code code, String namespaceSeparator) { - final LongCode result = LongCode.of(code.getFullName(), namespaceSeparator); - // if (result.toString().equals(code.toString()) == false) { - // System.err.println("result=" + result); - // System.err.println(" code =" + code); - // throw new UnsupportedOperationException(); - // } - return result; - } - - public IGroup createGroup(Code code, Display display, Code namespace2, GroupType groupType, IGroup parentContainer, - Set hides, String namespaceSeparator) { + public IGroup createGroup(Ident ident, Code code, Display display, Code namespace, GroupType groupType, + IGroup parentContainer, Set hides, String namespaceSeparator) { if (groupType == null) { throw new IllegalArgumentException(); } - final Bodier bodier = new Bodier(null, hides); - final LongCode longCode = getLongCode(code, namespaceSeparator); - final EntityImpl result = new EntityImpl(this, code, bodier, parentContainer, groupType, namespace2, longCode, + for (Entry ent : groups2.entrySet()) { + if (ent.getKey().equals(ident)) { + return ent.getValue(); + } + } + final Bodier bodier = new BodierImpl(null, hides); + final EntityImpl result = new EntityImpl(ident, code, this, bodier, parentContainer, groupType, namespace, namespaceSeparator, rawLayout); if (Display.isNull(display) == false) { result.setDisplay(display); @@ -123,156 +246,277 @@ public IGroup createGroup(Code code, Display display, Code namespace2, GroupType return result; } - public IGroup getRootGroup() { - return rootGroup; - } - - public final ILeaf getLeafsget(Code code) { - return leafs.get(code); - } - - public final Collection getLeafsvalues() { - return Collections.unmodifiableCollection(leafs.values()); + public void addLeaf(ILeaf entity) { + if (namespaceSeparator.V1972() == false) + leafsByCode.put(entity.getCodeGetName(), entity); + leafs2.put(entity.getIdent(), entity); + if (namespaceSeparator.V1972()) + ensureParentIsCreated(entity.getIdent()); } - public void addLeaf(ILeaf entity) { - leafs.put(entity.getCode(), entity); + public void addGroup(IGroup group) { + if (namespaceSeparator.V1972() == false) + groupsByCode.put(group.getCodeGetName(), group); + groups2.put(group.getIdent(), group); + if (namespaceSeparator.V1972()) + ensureParentIsCreated(group.getIdent()); } - public void incRawLayout() { - rawLayout++; + private void ensureParentIsCreated(Ident ident) { + if (groups2.get(ident.parent()) != null) + return; + getParentContainer(ident, null); } - void removeLeaf(Code code) { - final IEntity removed = leafs.remove(code); + void removeGroup(String name) { + if (namespaceSeparator.V1972()) + throw new UnsupportedOperationException(); + final IEntity removed = groupsByCode.remove(name); if (removed == null) { throw new IllegalArgumentException(); } + final IEntity removed2 = groups2.remove(removed.getIdent()); + if (removed != removed2) { + bigError(); + } } - public void addGroup(IGroup group) { - groups.put(group.getCode(), group); - } - - void removeGroup(Code code) { - final IEntity removed = groups.remove(code); + void removeGroup(Ident ident) { + final IEntity removed = groups2.remove(ident); if (removed == null) { throw new IllegalArgumentException(); } } - public final Collection getGroupsvalues() { - return Collections.unmodifiableCollection(groups.values()); + public static void bigError() { + // Thread.dumpStack(); + // System.exit(0); + // throw new IllegalArgumentException(); } - public final IGroup getGroupsget(Code code) { - return groups.get(code); - } - - public final List getLinks() { - return Collections.unmodifiableList(links); + void removeLeaf(String name) { + if (namespaceSeparator.V1972()) + throw new UnsupportedOperationException(); + final IEntity removed = leafsByCode.remove(name); + if (removed == null) { + throw new IllegalArgumentException(); + } + final IEntity removed2 = leafs2.remove(removed.getIdent()); + if (removed != removed2) { + bigError(); + } } - public void addLink(Link link) { - if (link.isSingle() && containsSimilarLink(link)) { - return; + void removeLeaf(Ident ident) { + final IEntity removed = leafs2.remove(ident); + if (removed == null) { + System.err.println("leafs2=" + leafs2.keySet()); + throw new IllegalArgumentException(ident.toString()); } - links.add(link); } - private boolean containsSimilarLink(Link other) { - for (Link link : links) { - if (other.sameConnections(link)) { - return true; - } + private void removeLeaf1972(ILeaf leaf) { + final boolean removed = leafs2.values().remove(leaf); + if (removed == false) { + System.err.println("leafs2=" + leafs2.keySet()); + throw new IllegalArgumentException(leaf.toString()); } - return false; } - public void removeLink(Link link) { - final boolean ok = links.remove(link); - if (ok == false) { - throw new IllegalArgumentException(); - } + public IGroup muteToGroup(String name, Code namespace, GroupType type, IGroup parent) { + if (namespaceSeparator.V1972()) + throw new UnsupportedOperationException(); + final ILeaf leaf = leafsByCode.get(name); + ((EntityImpl) leaf).muteToGroup(namespace, type, parent); + final IGroup result = (IGroup) leaf; + removeLeaf(name); + return result; } - public IGroup muteToGroup(Code code, Code namespace2, GroupType type, IGroup parent) { - final ILeaf leaf = leafs.get(code); - ((EntityImpl) leaf).muteToGroup(namespace2, type, parent); + public IGroup muteToGroup1972(Ident ident, Code namespace, GroupType type, IGroup parent) { + if (!namespaceSeparator.V1972()) + throw new UnsupportedOperationException(); + final ILeaf leaf; + if (namespaceSeparator.getNamespaceSeparator() == null) + leaf = getLeafVerySmart(ident); + else + leaf = leafs2.get(ident); + ((EntityImpl) leaf).muteToGroup(namespace, type, parent); final IGroup result = (IGroup) leaf; - removeLeaf(code); + removeLeaf1972(leaf); return result; } - static class Protect implements Map { + public IGroup getRootGroup() { + return rootGroup; + } - private final Map m; + public final ILeaf getLeafStrict(Ident ident) { + return leafs2.get(ident); + } - public Protect(Map data) { - this.m = data; + public final ILeaf getLeafSmart(Ident ident) { + if (!namespaceSeparator.V1972()) + throw new UnsupportedOperationException(); + final ILeaf result = leafs2.get(ident); + if (result == null && ident.size() == 1) { + for (Entry ent : leafs2.entrySet()) { + if (ent.getKey().getLast().equals(ident.getLast())) { + return ent.getValue(); + } + } } + return result; + } - public O remove(Object key) { - if (key instanceof Code == false) { - throw new IllegalArgumentException(); + public final ILeaf getLeafVerySmart(Ident ident) { + if (!namespaceSeparator.V1972()) + throw new UnsupportedOperationException(); + final ILeaf result = leafs2.get(ident); + if (result == null) { + for (Entry ent : leafs2.entrySet()) { + if (ent.getKey().getLast().equals(ident.getLast())) { + return ent.getValue(); + } } - return m.remove(key); } + return result; + } - public O get(Object key) { - if (key instanceof Code == false) { - throw new IllegalArgumentException(); + public Ident buildFullyQualified(Ident currentPath, Ident id) { + if (currentPath.equals(id) == false) { + if (leafs2.containsKey(id) || groups2.containsKey(id)) { + return id; } - return m.get(key); } - - public Set keySet() { - return m.keySet(); + if (id.size() > 1) { + return id; } + return currentPath.add(id); + } - public void putAll(Map m) { - this.m.putAll(m); + public final IGroup getGroupStrict(Ident ident) { + if (namespaceSeparator.getNamespaceSeparator() == null) { + return getGroupVerySmart(ident); } + final IGroup result = groups2.get(ident); + return result; + } - public boolean containsKey(Object key) { - if (key instanceof Code == false) { - throw new IllegalArgumentException(); + public final IGroup getGroupVerySmart(Ident ident) { + final IGroup result = groups2.get(ident); + if (result == null) { + for (Entry ent : groups2.entrySet()) { + if (ent.getKey().getLast().equals(ident.getLast())) { + return ent.getValue(); + } } - return m.containsKey(key); } + return result; + } - public boolean isEmpty() { - return m.isEmpty(); + public final ILeaf getLeaf(Code code) { + if (namespaceSeparator.V1972()) + throw new UnsupportedOperationException(); + final ILeaf result = leafsByCode.get(code.getName()); + if (result != null && result != leafs2.get(result.getIdent())) { + bigError(); } + return result; + } - public O put(Code key, O value) { - if (key instanceof Code == false) { - throw new IllegalArgumentException(); - } - return m.put(key, value); + public final IGroup getGroup(Code code) { + if (namespaceSeparator.V1972()) + throw new UnsupportedOperationException(); + final IGroup result = groupsByCode.get(code.getName()); + if (result != null && result != groups2.get(result.getIdent())) { + bigError(); } + return result; + } - public boolean containsValue(Object value) { - return m.containsValue(value); + public final Collection leafs() { + if (namespaceSeparator.V1972()) + return leafs2(); + final Collection result = Collections.unmodifiableCollection(leafsByCode.values()); + if (new ArrayList(result).equals(new ArrayList(leafs2())) == false) { + bigError(); } + return result; + } - public Set> entrySet() { - return m.entrySet(); + public final Collection groups() { + if (namespaceSeparator.V1972()) + return groups2(); + final Collection result = Collections.unmodifiableCollection(groupsByCode.values()); + if (new ArrayList(result).equals(new ArrayList(groups2())) == false) { + bigError(); } + return result; + } - public Collection values() { - return m.values(); - } + public final Collection groups2() { + final Collection result = Collections.unmodifiableCollection(groups2.values()); + return Collections.unmodifiableCollection(result); + } - public void clear() { - m.clear(); + public final Collection leafs2() { + final Collection result = Collections.unmodifiableCollection(leafs2.values()); + return Collections.unmodifiableCollection(result); + } + + public void incRawLayout() { + rawLayout++; + } + + public final List getLinks() { + return Collections.unmodifiableList(links); + } + public void addLink(Link link) { + if (link.isSingle() && containsSimilarLink(link)) { + return; } + links.add(link); + } - public int size() { - return m.size(); + private boolean containsSimilarLink(Link other) { + for (Link link : links) { + if (other.sameConnections(link)) { + return true; + } } + return false; + } + public void removeLink(Link link) { + final boolean ok = links.remove(link); + if (ok == false) { + throw new IllegalArgumentException(); + } + } + + public IGroup getParentContainer(Ident ident, IGroup parentContainer) { + if (namespaceSeparator.V1972()) { + final Ident parent = ident.parent(); + if (parent.isRoot()) { + return this.rootGroup; + } + IGroup result = getGroupStrict(parent); + if (result != null) { + return result; + } +// System.err.println("getParentContainer::groups2=" + groups2); + final Display display = Display.getWithNewlines(parent.getName()); + result = createGroup(parent, parent, display, null, GroupType.PACKAGE, null, + Collections.emptySet(), namespaceSeparator.getNamespaceSeparator()); + addGroup(result); + return result; + } + if (parentContainer == null) { + throw new IllegalArgumentException(); + } + return parentContainer; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java index 7b80679dd..269b35a58 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -27,6 +27,7 @@ * * * Original Author: Arnaud Roques + * Contribution : Hisashi Miyashita * */ package net.sourceforge.plantuml.cucadiagram.entity; @@ -55,14 +56,13 @@ import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; -import net.sourceforge.plantuml.cucadiagram.LongCode; import net.sourceforge.plantuml.cucadiagram.Stereotag; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; @@ -71,15 +71,16 @@ import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.svek.SingleStrategy; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.UniqueSequence; -final class EntityImpl implements ILeaf, IGroup { +final public class EntityImpl implements ILeaf, IGroup { private final EntityFactory entityFactory; // Entity - private final Code code; - private final LongCode longCode; + private/* final */Code code; + private/* final */Ident ident; private Url url; @@ -96,7 +97,7 @@ final class EntityImpl implements ILeaf, IGroup { private boolean top; // Group - private Code namespace2; + private Code namespace; private GroupType groupType; @@ -131,30 +132,46 @@ public final void setTop(boolean top) { this.top = top; } - private EntityImpl(EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer, - LongCode longCode, String namespaceSeparator, int rawLayout) { + private EntityImpl(Ident ident, EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer, + String namespaceSeparator, int rawLayout) { + checkNotNull(ident); + if (entityFactory.namespaceSeparator.V1972()) { + code = ident; + } if (code == null) { throw new IllegalArgumentException(); } + this.ident = ident; this.entityFactory = entityFactory; this.bodier = bodier; this.code = code; this.parentContainer = parentContainer; - this.longCode = longCode; this.rawLayout = rawLayout; } - EntityImpl(EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer, LeafType leafType, - LongCode longCode, String namespaceSeparator, int rawLayout) { - this(entityFactory, code, bodier, parentContainer, longCode, namespaceSeparator, rawLayout); + EntityImpl(Ident ident, Code code, EntityFactory entityFactory, Bodier bodier, IGroup parentContainer, + LeafType leafType, String namespaceSeparator, int rawLayout) { + this(ident, entityFactory, code, bodier, parentContainer, namespaceSeparator, rawLayout); + checkNotNull(ident); + // System.err.println("ID for leaf=" + code + " " + ident); + // ident.checkSameAs(code, namespaceSeparator); this.leafType = leafType; } - EntityImpl(EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer, GroupType groupType, - Code namespace2, LongCode longCode, String namespaceSeparator, int rawLayout) { - this(entityFactory, code, bodier, parentContainer, longCode, namespaceSeparator, rawLayout); + EntityImpl(Ident ident, Code code, EntityFactory entityFactory, Bodier bodier, IGroup parentContainer, + GroupType groupType, Code namespace, String namespaceSeparator, int rawLayout) { + this(ident, entityFactory, code, bodier, parentContainer, namespaceSeparator, rawLayout); + checkNotNull(ident); + // System.err.println("ID for group=" + code + " " + ident); + ident.checkSameAs(code, namespaceSeparator, entityFactory.namespaceSeparator); this.groupType = groupType; - this.namespace2 = namespace2; + this.namespace = namespace; + } + + private void checkNotNull(Ident id) { + if (id == null) { + throw new IllegalArgumentException(); + } } public void setContainer(IGroup container) { @@ -201,7 +218,18 @@ public Code getCode() { return code; } + public String getCodeGetName() { + return getCode().getName(); + } + + public Ident getIdent() { + return ident; + } + public Display getDisplay() { + if (intricated) { + return entityFactory.getIntricatedDisplay(ident); + } return display; } @@ -222,15 +250,21 @@ public final void setStereotype(Stereotype stereotype) { } public final IGroup getParentContainer() { - if (parentContainer == null) { - throw new IllegalArgumentException(); - } - return parentContainer; + return entityFactory.getParentContainer(ident, parentContainer); + // if (parentContainer == null) { + // throw new IllegalArgumentException(); + // } + // return parentContainer; } @Override public String toString() { - return code + " " + display + "(" + leafType + ") " + xposition + " " + getUid(); + // return super.toString() + code + " " + display + "(" + leafType + ")[" + + // groupType + "] " + xposition + " " + // + getUid(); + if (entityFactory.namespaceSeparator.V1972()) + return getUid() + " " + ident + " " + display + "(" + leafType + ")[" + groupType + "]"; + return "EntityImpl " + code + ident + " " + display + "(" + leafType + ")[" + groupType + "] " + getUid(); } public final Url getUrl99() { @@ -297,6 +331,15 @@ public Bodier getBodier() { public EntityPosition getEntityPosition() { checkNotGroup(); + if (leafType == LeafType.PORT) { + return EntityPosition.PORT; + } + if (leafType == LeafType.PORTIN) { + return EntityPosition.PORTIN; + } + if (leafType == LeafType.PORTOUT) { + return EntityPosition.PORTOUT; + } if (leafType != LeafType.STATE) { return EntityPosition.NORMAL; } @@ -347,7 +390,7 @@ public boolean containsLeafRecurse(ILeaf leaf) { public Collection getLeafsDirect() { checkGroup(); final List result = new ArrayList(); - for (ILeaf ent : entityFactory.getLeafsvalues()) { + for (ILeaf ent : entityFactory.leafs()) { if (ent.isGroup()) { throw new IllegalStateException(); } @@ -361,7 +404,7 @@ public Collection getLeafsDirect() { public Collection getChildren() { checkGroup(); final Collection result = new ArrayList(); - for (IGroup g : entityFactory.getGroupsvalues()) { + for (IGroup g : entityFactory.groups()) { if (g != this && g.getParentContainer() == this) { result.add(g); } @@ -370,6 +413,10 @@ public Collection getChildren() { } public void moveEntitiesTo(IGroup dest) { + if (entityFactory.namespaceSeparator.V1972()) { + moveEntitiesTo1972(dest); + return; + } checkGroup(); if (dest.isGroup() == false) { throw new UnsupportedOperationException(); @@ -391,6 +438,70 @@ public void moveEntitiesTo(IGroup dest) { } + private void moveEntitiesTo1972(IGroup dest) { + checkGroup(); + if (dest.isGroup() == false) { + throw new UnsupportedOperationException(); + } + // System.err.println("moveEntitiesTo1972::before1::groups2=" + + // entityFactory.groups2()); + final Ident firstIdent = getIdent(); + final Ident destIdent = dest.getIdent(); + // System.err.println("moveEntitiesTo1972::this=" + firstIdent); + // System.err.println("moveEntitiesTo1972::dest=" + destIdent); + if (destIdent.startsWith(firstIdent) == false) { + throw new UnsupportedOperationException(); + } + // System.err.println("moveEntitiesTo1972::before2::groups2=" + + // entityFactory.groups2()); + for (ILeaf ent : new ArrayList(entityFactory.leafs2())) { + Ident ident = ent.getIdent(); + if (ident.equals(firstIdent) == false && ident.startsWith(firstIdent) + && ident.startsWith(destIdent) == false) { + // System.err.print("moving leaf ident1=" + ident); + entityFactory.leafs2.remove(ident); + ident = ident.move(firstIdent, destIdent); + // System.err.println(" to ident2=" + ident); + ((EntityImpl) ent).ident = ident; + ((EntityImpl) ent).code = ident; + entityFactory.leafs2.put(ident, ent); + } + } + // System.err.println("moveEntitiesTo1972::before3::groups2=" + + // entityFactory.groups2()); + for (IGroup ent : new ArrayList(entityFactory.groups2())) { + Ident ident = ent.getIdent(); + // System.err.println("found=" + ident + " " + ident.startsWith(firstIdent) + " + // " + // + ident.startsWith(destIdent)); + if (ident.equals(firstIdent) == false && ident.startsWith(firstIdent) + && ident.startsWith(destIdent) == false) { + // System.err.print("moving gr ident1=" + ident); + entityFactory.groups2.remove(ident); + ident = ident.move(firstIdent, destIdent); + // System.err.println(" to ident2=" + ident); + ((EntityImpl) ent).ident = ident; + ((EntityImpl) ent).code = ident; + entityFactory.groups2.put(ident, ent); + // System.err.println("-->groups2=" + entityFactory.groups2()); + } + } + // System.err.println("moveEntitiesTo1972::after::groups2=" + + // entityFactory.groups2()); + // for (IGroup g : dest.getChildren()) { + // // ((EntityImpl) g).parentContainer = dest; + // throw new IllegalStateException(); + // } + // + // for (IGroup g : getChildren()) { + // if (g == dest) { + // continue; + // } + // ((EntityImpl) g).parentContainer = dest; + // } + + } + public int size() { checkGroup(); return getLeafsDirect().size(); @@ -401,9 +512,9 @@ public GroupType getGroupType() { return groupType; } - public Code getNamespace2() { + public Code getNamespace() { checkGroup(); - return namespace2; + return namespace; } public PackageStyle getPackageStyle() { @@ -418,6 +529,7 @@ public boolean isGroup() { if (groupType != null && leafType != null) { throw new IllegalStateException(); } + assert groupType == null || leafType == null; if (groupType != null) { return true; } @@ -440,10 +552,19 @@ public void overrideImage(IEntityImage img, LeafType leafType) { } } - entityFactory.removeGroup(this.getCode()); - for (ILeaf ent : new ArrayList(entityFactory.getLeafsvalues())) { - if (this != ent && this == ent.getParentContainer()) { - entityFactory.removeLeaf(ent.getCode()); + if (entityFactory.namespaceSeparator.V1972()) { + entityFactory.removeGroup(getIdent()); + for (ILeaf ent : new ArrayList(entityFactory.leafs())) { + if (this != ent && getIdent().equals(ent.getIdent().parent())) { + entityFactory.removeLeaf(ent.getIdent()); + } + } + } else { + entityFactory.removeGroup(getCodeGetName()); + for (ILeaf ent : new ArrayList(entityFactory.leafs())) { + if (this != ent && this == ent.getParentContainer()) { + entityFactory.removeLeaf(ent.getCodeGetName()); + } } } @@ -452,12 +573,12 @@ public void overrideImage(IEntityImage img, LeafType leafType) { this.leafType = leafType; } - void muteToGroup(Code namespace2, GroupType groupType, IGroup parentContainer) { + void muteToGroup(Code namespaceNew, GroupType groupType, IGroup parentContainer) { checkNotGroup(); if (parentContainer.isGroup() == false) { throw new IllegalArgumentException(); } - this.namespace2 = namespace2; + this.namespace = namespaceNew; this.groupType = groupType; this.leafType = null; this.parentContainer = parentContainer; @@ -541,6 +662,18 @@ private boolean isRemovedInternal() { return entityFactory.isRemoved(this); } + public boolean isAloneAndUnlinked() { + if (isGroup()) { + return false; + } + for (Link link : entityFactory.getLinks()) { + if (link.contains(this) && link.getType().isInvisible() == false) { + return false; + } + } + return true; + } + private int layer; public int getHectorLayer() { @@ -554,10 +687,6 @@ public void setHectorLayer(int layer) { } } - public LongCode getLongCode() { - return longCode; - } - private FontParam getTitleFontParam() { if (symbol != null) { return symbol.getFontParam(); @@ -567,7 +696,7 @@ private FontParam getTitleFontParam() { public FontConfiguration getFontConfigurationForTitle(final ISkinParam skinParam) { final FontParam fontParam = getTitleFontParam(); - final HtmlColor fontHtmlColor = skinParam.getFontHtmlColor(getStereotype(), fontParam, FontParam.PACKAGE); + final HColor fontHtmlColor = skinParam.getFontHtmlColor(getStereotype(), fontParam, FontParam.PACKAGE); final UFont font = skinParam.getFont(getStereotype(), true, fontParam, FontParam.PACKAGE); final FontConfiguration fontConfiguration = new FontConfiguration(font, fontHtmlColor, skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink(), skinParam.getTabSize()); @@ -616,7 +745,7 @@ public void setColors(Colors colors) { this.colors = colors; } - public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) { + public void setSpecificColorTOBEREMOVED(ColorType type, HColor color) { if (color != null) { this.colors = colors.add(type, color); } @@ -624,7 +753,8 @@ public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) { public Collection getPortShortNames() { checkNotGroup(); - return Collections.unmodifiableCollection(portShortNames); + // return Collections.unmodifiableCollection(portShortNames); + return portShortNames; } public void addPortShortName(String portShortName) { @@ -652,4 +782,28 @@ public DisplayPositionned getLegend() { return legend; } + private boolean intricated; + + public void setIntricated(boolean intricated) { + this.intricated = intricated; + + } + + private IGroup originalGroup; + + public void setOriginalGroup(IGroup originalGroup) { + this.originalGroup = originalGroup; + } + + public IGroup getOriginalGroup() { + return originalGroup; + } + + private boolean together; + + public void setThisIsTogether() { + this.together = true; + // System.err.println("setThisIsTogether"); + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/ApolloniusSolver.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/ApolloniusSolver.java index 41e43b4e6..fed0a61a7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/ApolloniusSolver.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/ApolloniusSolver.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/ApolloniusSolver2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/ApolloniusSolver2.java index 03001f53f..b03f99b55 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/ApolloniusSolver2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/ApolloniusSolver2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Arc.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Arc.java index fbecd77b9..61209faa0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Arc.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Arc.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Balloon.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Balloon.java index 4aae95300..e56ea0481 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Balloon.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Balloon.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/BetweenCorners.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/BetweenCorners.java index 6c4c582cb..60b41fdb8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/BetweenCorners.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/BetweenCorners.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Cheese.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Cheese.java index 297d831c4..4832ee2eb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Cheese.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Cheese.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -66,7 +66,6 @@ public void drawU(UGraphic ug) { final Point2D ptA = balloon.getPointOnCircle(angle1); final Point2D ptB = balloon.getPointOnCircle(angle2); - // balloon.drawU(ug.apply(new UChangeBackColor(null)).apply(new UChangeColor(HtmlColorUtils.BLACK))); final UPath path = new UPath(); final Point2D ptA0; if (radius.hasCurvation()) { @@ -111,12 +110,6 @@ public void drawU(UGraphic ug) { path.closePath(); ug.draw(path); - // if (startAngle.hasCurvation()) { - // insideA.drawU(ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(null))); - // } - // if (endAngle.hasCurvation()) { - // insideB.drawU(ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(null))); - // } } public CuteShape rotateZoom(RotationZoom other) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Circle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Circle.java index 0a95f8fa3..eec4b4424 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Circle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Circle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Corner.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Corner.java index 23b0cab87..4b7973fa6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Corner.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Corner.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Crossing.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Crossing.java index b77081975..bcbf5455b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Crossing.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Crossing.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CrossingSegment.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CrossingSegment.java index ee4cf407e..278274028 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CrossingSegment.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CrossingSegment.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CrossingSimple.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CrossingSimple.java index 95b624c51..3e6415081 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CrossingSimple.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CrossingSimple.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CutePath.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CutePath.java index 4401e7716..45533d897 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CutePath.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CutePath.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,11 +35,10 @@ import java.util.List; import java.util.StringTokenizer; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPath; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class CutePath { @@ -136,7 +135,7 @@ private void debugMe(UGraphic ug) { for (int i = 0; i < arcs.size(); i++) { final BetweenCorners betweenCorners = new BetweenCorners(getCorner(i), getCorner(i + 1), arcs.get(i) .getTension()); - betweenCorners.debugMe(ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(null))); + betweenCorners.debugMe(ug.apply(HColorUtils.BLACK).apply(new HColorNone().bg())); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CuteShape.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CuteShape.java index 913087ba4..e783b61f0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CuteShape.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CuteShape.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CuteShapeFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CuteShapeFactory.java index 86c0328af..0eb5fcff4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CuteShapeFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/CuteShapeFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Group.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Group.java index 14edc80ec..07a9b712f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Group.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Group.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/InfiniteLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/InfiniteLine.java index 5019da878..2ce7616ee 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/InfiniteLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/InfiniteLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/MyDouble.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/MyDouble.java index 51d685a6a..38c62e6ed 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/MyDouble.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/MyDouble.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/MyPoint2D.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/MyPoint2D.java index 5cd6d878a..3de9db842 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/MyPoint2D.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/MyPoint2D.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/PSystemCute.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/PSystemCute.java index 5d4218c16..dc9292a78 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/PSystemCute.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/PSystemCute.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,11 +36,13 @@ import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.FileFormatOption; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemCute extends AbstractPSystem { @@ -81,8 +83,17 @@ public void doCommandLine(String line) { @Override final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { - final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), 1.0, null, null, null, 10, 10, null, - false); + final int margin1; + final int margin2; + if (SkinParam.USE_STYLES()) { + margin1 = SkinParam.zeroMargin(10); + margin2 = SkinParam.zeroMargin(10); + } else { + margin1 = 10; + margin2 = 10; + } + final ImageBuilder builder = ImageBuilder.buildB(new ColorMapperIdentity(), false, ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), + null, null, null, 1.0, null); builder.setUDrawable(root); return builder.writeImageTOBEMOVED(fileFormat, seed, os); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/PSystemCuteFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/PSystemCuteFactory.java index 580c3e302..bea98eaa3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/PSystemCuteFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/PSystemCuteFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Positionned.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Positionned.java index eeaafe80d..9ff3033ee 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Positionned.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Positionned.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/PositionnedImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/PositionnedImpl.java index 962566737..0685e7bd7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/PositionnedImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/PositionnedImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,18 +30,16 @@ */ package net.sourceforge.plantuml.cute; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; 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; public class PositionnedImpl implements Positionned { private final CuteShape cuteShape; - private final HtmlColor color; + private final HColor color; private final UTranslate position; private final RotationZoom rotationZoom; @@ -57,7 +55,7 @@ public PositionnedImpl(CuteShape cuteShape, VarArgs args) { this.rotationZoom = RotationZoom.fromVarArgs(args); } - private PositionnedImpl(CuteShape cuteShape, HtmlColor color, UTranslate position, RotationZoom rotationZoom) { + private PositionnedImpl(CuteShape cuteShape, HColor color, UTranslate position, RotationZoom rotationZoom) { this.cuteShape = cuteShape; this.color = color; this.position = position; @@ -66,20 +64,20 @@ private PositionnedImpl(CuteShape cuteShape, HtmlColor color, UTranslate positio public PositionnedImpl(Group group, RotationZoom rotation) { this.cuteShape = group; - this.color = HtmlColorUtils.BLACK; + this.color = HColorUtils.BLACK; this.position = new UTranslate(); this.rotationZoom = rotation; } public PositionnedImpl(Group group, UTranslate translation) { this.cuteShape = group; - this.color = HtmlColorUtils.BLACK; + this.color = HColorUtils.BLACK; this.position = translation; this.rotationZoom = RotationZoom.none(); } private UGraphic applyColor(UGraphic ug) { - return ug.apply(new UChangeBackColor(color)).apply(new UChangeColor(color)); + return ug.apply(color.bg()).apply(color); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Rectangle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Rectangle.java index 40894dad5..d9280a0be 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Rectangle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Rectangle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/RotationZoom.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/RotationZoom.java index 34d3f43bb..e6948d96d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/RotationZoom.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/RotationZoom.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Segment.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Segment.java index 941e55797..0f44594b6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Segment.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Segment.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Stick.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Stick.java index 4c87ab4d0..55327722f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Stick.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Stick.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Tension.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Tension.java index 6021e8f58..2083a23df 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Tension.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Tension.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Triangle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Triangle.java index 2794886d8..66658b8a2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Triangle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/Triangle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -42,9 +42,6 @@ public Triangle(VarArgs varArgs) { private Triangle(CutePath cutePath) { this.cutePath = cutePath; - // if (points.size() != 3) { - // throw new IllegalArgumentException(); - // } } public Triangle rotateZoom(final RotationZoom angle) { @@ -56,9 +53,5 @@ public Triangle rotateZoom(final RotationZoom angle) { public void drawU(UGraphic ug) { cutePath.drawU(ug); - // ug = ug.apply(new UChangeBackColor(null)).apply(new UChangeColor(HtmlColorUtils.BLACK)); - // cutePath.withNoTension().drawU( - // ug.apply(new UChangeBackColor(null)).apply(new UChangeColor(HtmlColorUtils.BLACK))); - } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/TriangleCorner.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/TriangleCorner.java index dc204df02..717e3bb0d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/TriangleCorner.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/TriangleCorner.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/TriangleCornerSimple.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/TriangleCornerSimple.java index da585d09c..152a25797 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/TriangleCornerSimple.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/TriangleCornerSimple.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/VarArgs.java b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/VarArgs.java index eefc66667..b61b45692 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/cute/VarArgs.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/cute/VarArgs.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,10 +35,10 @@ import java.util.Map; import java.util.StringTokenizer; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSet; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; 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.HColorUtils; public class VarArgs { @@ -84,14 +84,14 @@ public MyDouble getAsMyDouble(String k) { return new MyDouble(value); } - public HtmlColor getAsColor(String k) { + public HColor getAsColor(String k) { final String value = args.get(k); if (value == null) { - return HtmlColorUtils.BLACK; + return HColorUtils.BLACK; } - final HtmlColor result = HtmlColorSet.getInstance().getColorIfValid(value); + final HColor result = HColorSet.instance().getColorIfValid(value); if (result == null) { - return HtmlColorUtils.BLACK; + return HColorUtils.BLACK; } return result; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/DecoderInputStream.java b/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/DecoderInputStream.java index ce29b2cec..ae4f0fe94 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/DecoderInputStream.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/DecoderInputStream.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/Dedication.java b/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/Dedication.java index d3bfc18d4..5b4937ce3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/Dedication.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/Dedication.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,9 +38,10 @@ import java.lang.reflect.Method; import java.math.BigInteger; -import javax.imageio.ImageIO; import javax.imageio.stream.ImageInputStream; +import net.sourceforge.plantuml.security.ImageIO; + public class Dedication { private final String name; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/Dedications.java b/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/Dedications.java index e1cd03add..48385e37c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/Dedications.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/Dedications.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/PSystemDedication.java b/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/PSystemDedication.java index 93518d3c8..57374a043 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/PSystemDedication.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/PSystemDedication.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,12 +38,14 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.AffineTransformType; +import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemDedication extends AbstractPSystem { @@ -58,13 +60,13 @@ public PSystemDedication(Dedication dedication, String keepLetter) { @Override final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, - getMetadata(), null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, getMetadata(), + null, 1.0, HColorUtils.WHITE); imageBuilder.setUDrawable(new UDrawable() { public void drawU(UGraphic ug) { final BufferedImage bufferedImage = dedication.getBufferedImage(keepLetter); if (bufferedImage != null) { - ug.draw(new UImage(bufferedImage)); + ug.draw(new UImage(new PixelImage(bufferedImage, AffineTransformType.TYPE_BILINEAR))); } } }); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/PSystemDedicationFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/PSystemDedicationFactory.java index 1462e1922..19c36b40a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/PSystemDedicationFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/PSystemDedicationFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/QBlock.java b/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/QBlock.java index dc2b5fbd2..814121f15 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/QBlock.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/QBlock.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/QBlocks.java b/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/QBlocks.java index eb56148c7..e5077e033 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/QBlocks.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/QBlocks.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/TurningBytes.java b/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/TurningBytes.java index 1612c018f..8b12feeca 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/TurningBytes.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/dedication/TurningBytes.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/definition/PSystemDefinition.java b/src/plantuml-asl/src/net/sourceforge/plantuml/definition/PSystemDefinition.java index e0d5b635c..95938bf99 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/definition/PSystemDefinition.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/definition/PSystemDefinition.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,12 +43,12 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemDefinition extends AbstractPSystem implements UDrawable { @@ -66,8 +66,8 @@ public DiagramDescription getDescription() { @Override final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormatOption, long seed) throws IOException { - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1, null, "", "", 0, 0, null, - false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, "", "", 1, + null); imageBuilder.setUDrawable(this); return imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed, os); @@ -75,7 +75,7 @@ final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatO public void drawU(UGraphic ug) { final UFont font = UFont.sansSerif(14); - final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK, false); + final FontConfiguration fc = new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); Display.getWithNewlines(startLine).create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty()).drawU(ug); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/definition/PSystemDefinitionFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/definition/PSystemDefinitionFactory.java index 830b26c3f..66c6f9add 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/definition/PSystemDefinitionFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/definition/PSystemDefinitionFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/BoxedCharacter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/BoxedCharacter.java index 84a278ffd..db6ee7b94 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/BoxedCharacter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/BoxedCharacter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,27 +34,26 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; public class BoxedCharacter extends AbstractTextBlock implements TextBlock { private final String c; private final UFont font; - private final HtmlColor innerCircle; - private final HtmlColor circle; - private final HtmlColor fontColor; + private final HColor innerCircle; + private final HColor circle; + private final HColor fontColor; private final double radius; - public BoxedCharacter(char c, double size, UFont font, HtmlColor innerCircle, HtmlColor circle, HtmlColor fontColor) { + public BoxedCharacter(char c, double size, UFont font, HColor innerCircle, HColor circle, HColor fontColor) { this.c = "" + c; this.font = font; this.innerCircle = innerCircle; @@ -65,12 +64,15 @@ public BoxedCharacter(char c, double size, UFont font, HtmlColor innerCircle, Ht public void drawU(UGraphic ug) { if (circle != null) { - ug = ug.apply(new UChangeColor(circle)); + ug = ug.apply(circle); + } + if (innerCircle == null) { + ug = ug.apply(new HColorNone().bg()); + } else { + ug = ug.apply(innerCircle.bg()); } - // final HtmlColor back = ug.getParam().getBackcolor(); - ug = ug.apply(new UChangeBackColor(innerCircle)); ug.draw(new URectangle(2 * radius, 2 * radius)); - ug = ug.apply(new UChangeColor(fontColor)); + ug = ug.apply(fontColor); ug = ug.apply(new UTranslate(radius, radius)); ug.draw(new UCenteredCharacter(c.charAt(0), font)); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java index 7635227bb..b54982668 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -47,6 +47,7 @@ import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; import net.sourceforge.plantuml.cucadiagram.Stereotype; @@ -80,17 +81,22 @@ private static IRegex getRegexConcat() { protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) { String type = arg.get("TYPE", 0); String display = arg.getLazzy("DISPLAY", 0); - String code = arg.getLazzy("CODE", 0); - if (code == null) { - code = display; + String codeString = arg.getLazzy("CODE", 0); + if (codeString == null) { + codeString = display; } - final String genericOption = arg.getLazzy("DISPLAY", 1); - final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0); + // final String genericOption = arg.getLazzy("DISPLAY", 1); + // final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0); final String stereotype = arg.get("STEREO", 0); - if (diagram.leafExist(Code.of(code))) { - return CommandExecutionResult.error("Object already exists : " + code); + final Ident ident = diagram.buildLeafIdent(codeString); + final Code code = diagram.V1972() ? ident : diagram.buildCode(codeString); + if (diagram.V1972() && diagram.leafExistSmart(ident)) { + return CommandExecutionResult.error("Object already exists : " + codeString); + } + if (!diagram.V1972() && diagram.leafExist(code)) { + return CommandExecutionResult.error("Object already exists : " + codeString); } Display d = Display.getWithNewlines(display); final String urlString = arg.get("URL", 0); @@ -98,11 +104,11 @@ protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLoca IEntity entity; if (group != null) { final IGroup currentGroup = diagram.getCurrentGroup(); - diagram.gotoGroup2(Code.of(code), d, type.equalsIgnoreCase("domain") ? GroupType.DOMAIN + diagram.gotoGroup(ident, code, d, type.equalsIgnoreCase("domain") ? GroupType.DOMAIN : GroupType.REQUIREMENT, currentGroup, NamespaceStrategy.SINGLE); entity = diagram.getCurrentGroup(); } else { - entity = diagram.createLeaf(Code.of(code), d, type.equalsIgnoreCase("domain") ? LeafType.DOMAIN + entity = diagram.createLeaf(ident, code, d, type.equalsIgnoreCase("domain") ? LeafType.DOMAIN : LeafType.REQUIREMENT, null); } if (stereotype != null) { @@ -134,7 +140,7 @@ protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLoca type = "biddable"; } } - USymbol usymbol = USymbol.getFromString(type, diagram.getSkinParam().useUml2ForComponent()); + USymbol usymbol = USymbol.fromString(type, diagram.getSkinParam()); entity.setUSymbol(usymbol); return CommandExecutionResult.ok(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java index 597da3640..d8ddb5e5e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,84 +30,75 @@ */ package net.sourceforge.plantuml.descdiagram; +import net.sourceforge.plantuml.ComponentStyle; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.graphic.USymbol; public class DescriptionDiagram extends AbstractEntityDiagram { - + public DescriptionDiagram(ISkinSimple skinParam) { super(skinParam); } - @Override - public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) { - if (getNamespaceSeparator() != null) { - code = code.withSeparator(getNamespaceSeparator()); + public Ident cleanIdent(Ident ident) { + String codeString = ident.getName(); + if (codeString.startsWith("[") && codeString.endsWith("]")) { + return ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"); } - if (getNamespaceSeparator() != null && code.getFullName().contains(getNamespaceSeparator())) { - // System.err.println("code=" + code); - final Code fullyCode = code; - // final String namespace = fullyCode.getNamespace(getLeafs()); - // System.err.println("namespace=" + namespace); + if (codeString.startsWith(":") && codeString.endsWith(":")) { + return ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"); } + if (codeString.startsWith("()")) { + codeString = StringUtils.trin(codeString.substring(2)); + codeString = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeString); + return ident.parent().add(Ident.empty().add(codeString, null)); + } + return ident; + } + + @Override + public ILeaf getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) { + checkNotNull(ident); if (type == null) { - String code2 = code.getFullName(); - if (code2.startsWith("[") && code2.endsWith("]")) { - final USymbol sym = getSkinParam().useUml2ForComponent() ? USymbol.COMPONENT2 : USymbol.COMPONENT1; - return getOrCreateLeafDefault(code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"), - LeafType.DESCRIPTION, sym); + String codeString = code.getName(); + if (codeString.startsWith("[") && codeString.endsWith("]")) { + final USymbol sym = getSkinParam().componentStyle().toUSymbol() ; + final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"); + return getOrCreateLeafDefault(idNewLong, idNewLong.toCode(this), LeafType.DESCRIPTION, sym); } - if (code2.startsWith(":") && code2.endsWith(":")) { - return getOrCreateLeafDefault(code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"), - LeafType.DESCRIPTION, USymbol.ACTOR); + if (codeString.startsWith(":") && codeString.endsWith(":")) { + final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"); + return getOrCreateLeafDefault(idNewLong, idNewLong.toCode(this), LeafType.DESCRIPTION, + getSkinParam().actorStyle().toUSymbol()); } - if (code2.startsWith("()")) { - code2 = StringUtils.trin(code2.substring(2)); - code2 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(code2); - return getOrCreateLeafDefault(Code.of(code2), LeafType.DESCRIPTION, USymbol.INTERFACE); + if (codeString.startsWith("()")) { + codeString = StringUtils.trin(codeString.substring(2)); + codeString = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeString); + final Ident idNewLong = buildLeafIdent(codeString); + final Code code99 = this.V1972() ? idNewLong : buildCode(codeString); + return getOrCreateLeafDefault(idNewLong, code99, LeafType.DESCRIPTION, USymbol.INTERFACE); } - code = code.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"); - return getOrCreateLeafDefault(code, LeafType.STILL_UNKNOWN, symbol); + final String tmp4 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(code.getName(), "\"([:"); + final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"); + code = this.V1972() ? idNewLong : buildCode(tmp4); + return getOrCreateLeafDefault(idNewLong, code, LeafType.STILL_UNKNOWN, symbol); } - return getOrCreateLeafDefault(code, type, symbol); + return getOrCreateLeafDefault(ident, code, type, symbol); } - // @Override - // public ILeaf createLeaf(Code code, List display, LeafType type) { - // if (type != LeafType.COMPONENT) { - // return super.createLeaf(code, display, type); - // } - // code = code.getFullyQualifiedCode(getCurrentGroup()); - // if (super.leafExist(code)) { - // throw new IllegalArgumentException("Already known: " + code); - // } - // return createEntityWithNamespace(code, display, type); - // } - - // private ILeaf createEntityWithNamespace(Code fullyCode, List display, LeafType type) { - // IGroup group = getCurrentGroup(); - // final String namespace = fullyCode.getNamespace(getLeafs()); - // if (namespace != null && (EntityUtils.groupRoot(group) || group.getCode().equals(namespace) == false)) { - // group = getOrCreateGroupInternal(Code.of(namespace), StringUtils.getWithNewlines(namespace), namespace, - // GroupType.PACKAGE, getRootGroup()); - // } - // return createLeafInternal(fullyCode, - // display == null ? StringUtils.getWithNewlines(fullyCode.getShortName(getLeafs())) : display, type, - // group); - // } - private boolean isUsecase() { for (ILeaf leaf : getLeafsvalues()) { final LeafType type = leaf.getLeafType(); final USymbol usymbol = leaf.getUSymbol(); - if (type == LeafType.USECASE || usymbol == USymbol.ACTOR) { + if (type == LeafType.USECASE || usymbol == getSkinParam().actorStyle().toUSymbol()) { return true; } } @@ -118,7 +109,7 @@ private boolean isUsecase() { public void makeDiagramReady() { super.makeDiagramReady(); final LeafType defaultType = isUsecase() ? LeafType.DESCRIPTION : LeafType.DESCRIPTION; - final USymbol defaultSymbol = isUsecase() ? USymbol.ACTOR : USymbol.INTERFACE; + final USymbol defaultSymbol = isUsecase() ? getSkinParam().actorStyle().toUSymbol() : USymbol.INTERFACE; for (ILeaf leaf : getLeafsvalues()) { if (leaf.getLeafType() == LeafType.STILL_UNKNOWN) { leaf.muteToType(defaultType, defaultSymbol); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java index 94bc9c581..6fcfaa8e4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -44,9 +44,9 @@ import net.sourceforge.plantuml.command.CommandPage; import net.sourceforge.plantuml.command.CommandRankDir; import net.sourceforge.plantuml.command.UmlDiagramFactory; -import net.sourceforge.plantuml.command.note.FactoryNoteCommand; -import net.sourceforge.plantuml.command.note.FactoryNoteOnEntityCommand; -import net.sourceforge.plantuml.command.note.FactoryNoteOnLinkCommand; +import net.sourceforge.plantuml.command.note.CommandFactoryNote; +import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnEntity; +import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnLink; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.descdiagram.command.CommandArchimate; @@ -87,10 +87,10 @@ protected List createCommands() { // cmds.add(new CommandPackageWithUSymbol()); cmds.add(new CommandEndPackage()); - final FactoryNoteCommand factoryNoteCommand = new FactoryNoteCommand(); + final CommandFactoryNote factoryNoteCommand = new CommandFactoryNote(); cmds.add(factoryNoteCommand.createMultiLine(false)); - final FactoryNoteOnEntityCommand factoryNoteOnEntityCommand = new FactoryNoteOnEntityCommand("desc", + final CommandFactoryNoteOnEntity factoryNoteOnEntityCommand = new CommandFactoryNoteOnEntity("desc", new RegexOr("ENTITY", // new RegexLeaf("[\\p{L}0-9_.]+"), // new RegexLeaf("\\(\\)[%s]*[\\p{L}0-9_.]+"), // @@ -112,7 +112,7 @@ protected List createCommands() { cmds.add(factoryNoteOnEntityCommand.createMultiLine(false)); cmds.add(factoryNoteCommand.createMultiLine(false)); - final FactoryNoteOnLinkCommand factoryNoteOnLinkCommand = new FactoryNoteOnLinkCommand(); + final CommandFactoryNoteOnLink factoryNoteOnLinkCommand = new CommandFactoryNoteOnLink(); cmds.add(factoryNoteOnLinkCommand.createSingleLine()); cmds.add(factoryNoteOnLinkCommand.createMultiLine(false)); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/EntityImageDesignedDomain.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/EntityImageDesignedDomain.java index 1c171c218..d3d8f723a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/EntityImageDesignedDomain.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/EntityImageDesignedDomain.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -45,7 +45,6 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -53,13 +52,12 @@ import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULayoutGroup; 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; public class EntityImageDesignedDomain extends AbstractEntityImage { final private TextBlock name; @@ -120,15 +118,15 @@ final public void drawU(UGraphic ug) { final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final URectangle rect = new URectangle(widthTotal, heightTotal, 0, 0); - URectangle rect2 = new URectangle(4, heightTotal, 0, 0); + final URectangle rect = new URectangle(widthTotal, heightTotal); + URectangle rect2 = new URectangle(4, heightTotal); - ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.designedBorder))); - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + ug = ug.apply(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.designedBorder)); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.designedBackground); } - ug = ug.apply(new UChangeBackColor(backcolor)); + ug = ug.apply(backcolor.bg()); if (url != null) { ug.startUrl(url); } @@ -139,10 +137,10 @@ final public void drawU(UGraphic ug) { final ULayoutGroup header = new ULayoutGroup(new PlacementStrategyY1Y2(ug.getStringBounder())); header.add(name); - header.drawU(ug.apply(new UTranslate(4, 0)), dimTotal.getWidth(), dimTitle.getHeight()); + header.drawU(ug.apply(UTranslate.dx(4)), dimTotal.getWidth(), dimTitle.getHeight()); if (url != null) { - ug.closeAction(); + ug.closeUrl(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/EntityImageDomain.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/EntityImageDomain.java index 261997be6..62514ecee 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/EntityImageDomain.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/EntityImageDomain.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -45,7 +45,6 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -53,14 +52,13 @@ import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULayoutGroup; 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; public class EntityImageDomain extends AbstractEntityImage { final private TextBlock name; @@ -123,14 +121,14 @@ final public void drawU(UGraphic ug) { final Dimension2D dimTag = getTagDimension(stringBounder); final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final URectangle rect = new URectangle(widthTotal, heightTotal, 0, 0); + final URectangle rect = new URectangle(widthTotal, heightTotal); - ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.domainBorder))); - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + ug = ug.apply(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.domainBorder)); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.domainBackground); } - ug = ug.apply(new UChangeBackColor(backcolor)); + ug = ug.apply(backcolor.bg()); if (url != null) { ug.startUrl(url); } @@ -146,7 +144,7 @@ final public void drawU(UGraphic ug) { footer.drawU(ug.apply(new UTranslate(dimTotal.getWidth() - dimTag.getWidth(), dimTitle.getHeight())), dimTag.getWidth(), dimTag.getHeight()); if (url != null) { - ug.closeAction(); + ug.closeUrl(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/EntityImageMachine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/EntityImageMachine.java index a2e5a75ef..370ab5959 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/EntityImageMachine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/EntityImageMachine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -45,7 +45,6 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -53,13 +52,12 @@ import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULayoutGroup; 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; public class EntityImageMachine extends AbstractEntityImage { final private TextBlock name; @@ -119,29 +117,29 @@ final public void drawU(UGraphic ug) { final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final URectangle rect = new URectangle(widthTotal, heightTotal, 0, 0); - URectangle rect2 = new URectangle(4, heightTotal, 0, 0); + final URectangle rect = new URectangle(widthTotal, heightTotal); + URectangle rect2 = new URectangle(4, heightTotal); - ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.machineBorder))); - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + ug = ug.apply(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.machineBorder)); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.machineBackground); } - ug = ug.apply(new UChangeBackColor(backcolor)); + ug = ug.apply(backcolor.bg()); if (url != null) { ug.startUrl(url); } final UStroke stroke = getStroke(); ug.apply(stroke).draw(rect); - ug.apply(new UTranslate(4, 0)).apply(stroke).draw(rect2); + ug.apply(UTranslate.dx(4)).apply(stroke).draw(rect2); final ULayoutGroup header = new ULayoutGroup(new PlacementStrategyY1Y2(ug.getStringBounder())); header.add(name); - header.drawU(ug.apply(new UTranslate(5, 0)), dimTotal.getWidth(), dimTitle.getHeight()); + header.drawU(ug.apply(UTranslate.dx(5)), dimTotal.getWidth(), dimTitle.getHeight()); if (url != null) { - ug.closeAction(); + ug.closeUrl(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/EntityImageRequirement.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/EntityImageRequirement.java index 08e0f9e73..d0df24c18 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/EntityImageRequirement.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/EntityImageRequirement.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -46,23 +46,22 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; import net.sourceforge.plantuml.ugraphic.TextBlockInEllipse; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UHorizontalLine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageRequirement extends AbstractEntityImage { @@ -75,7 +74,7 @@ public EntityImageRequirement(ILeaf entity, ISkinParam skinParam) { final Stereotype stereotype = entity.getStereotype(); final TextBlock tmp = new BodyEnhanced(entity.getDisplay(), FontParam.REQUIREMENT, skinParam, - HorizontalAlignment.CENTER, stereotype, true, false, entity); + HorizontalAlignment.CENTER, stereotype, true, false, entity, SName.componentDiagram); if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null) { this.desc = tmp; @@ -114,22 +113,22 @@ final public void drawU(UGraphic ug) { } ug = ug.apply(getStroke()); - HtmlColor linecolor = getEntity().getColors(getSkinParam()).getColor(ColorType.LINE); + HColor linecolor = getEntity().getColors(getSkinParam()).getColor(ColorType.LINE); if (linecolor == null) { linecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.requirementBorder); } - ug = ug.apply(new UChangeColor(linecolor)); - HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); + ug = ug.apply(linecolor); + HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.requirementBackground); } - ug = ug.apply(new UChangeBackColor(backcolor)); + ug = ug.apply(backcolor.bg()); final UGraphic ug2 = new MyUGraphicEllipse(ug, 0, 0, ellipse.getUEllipse()); ellipse.drawU(ug2); if (url != null) { - ug.closeAction(); + ug.closeUrl(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimate.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimate.java index 655c71406..0fba87307 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimate.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimate.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.descdiagram.DescriptionDiagram; @@ -116,16 +117,18 @@ private static ColorParser color() { protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) { final String codeRaw = arg.getLazzy("CODE", 0); - final Code code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw)); + final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); final String icon = arg.getLazzy("STEREOTYPE", 0); - final IEntity entity = diagram.getOrCreateLeaf(code, LeafType.DESCRIPTION, USymbol.ARCHIMATE); + final IEntity entity = diagram.getOrCreateLeaf(ident, code, LeafType.DESCRIPTION, USymbol.ARCHIMATE); final String displayRaw = arg.getLazzy("DISPLAY", 0); String display = displayRaw; if (display == null) { - display = code.getFullName(); + display = code.getName(); } display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimateMultilines.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimateMultilines.java index 1075814be..b0081ca6b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimateMultilines.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimateMultilines.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -46,6 +46,7 @@ import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.USymbol; @@ -93,14 +94,16 @@ private static ColorParser color() { @Override protected CommandExecutionResult executeNow(AbstractEntityDiagram diagram, BlocLines lines) { - lines = lines.trim(false); - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + lines = lines.trim(); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final String codeRaw = line0.getLazzy("CODE", 0); - final Code code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw)); + final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); final String icon = line0.getLazzy("STEREOTYPE", 0); - final IEntity entity = diagram.getOrCreateLeaf(code, LeafType.DESCRIPTION, USymbol.RECTANGLE); + final IEntity entity = diagram.getOrCreateLeaf(ident, code, LeafType.DESCRIPTION, USymbol.RECTANGLE); lines = lines.subExtract(1, 1); Display display = lines.toDisplay(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java index 45e5cd4f7..620fb65fd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -27,6 +27,7 @@ * * * Original Author: Arnaud Roques + * Contribution : Hisashi Miyashita */ package net.sourceforge.plantuml.descdiagram.command; @@ -37,6 +38,7 @@ import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder.ModeUrl; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; +import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.IRegex; @@ -49,18 +51,20 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; +import net.sourceforge.plantuml.cucadiagram.Stereotag; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.descdiagram.DescriptionDiagram; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandCreateElementFull extends SingleLineCommand2 { - public static final String ALL_TYPES = "artifact|actor|folder|card|file|package|rectangle|node|frame|cloud|database|queue|stack|storage|agent|usecase|component|boundary|control|entity|interface|circle|collections"; + public static final String ALL_TYPES = "artifact|actor|folder|card|file|package|rectangle|label|node|frame|cloud|database|queue|stack|storage|agent|usecase|component|boundary|control|entity|interface|circle|collections|port|portin|portout"; public CommandCreateElementFull() { super(getRegexConcat()); @@ -113,6 +117,8 @@ private static IRegex getRegexConcat() { new RegexLeaf("STEREOTYPE", "(\\<\\<.+\\>\\>)") // )), // RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // + RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // RegexLeaf.spaceZeroOrMore(), // color().getRegex(), RegexLeaf.end()); @@ -167,7 +173,16 @@ protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLoca if (symbol == null) { type = LeafType.DESCRIPTION; - usymbol = USymbol.ACTOR; + usymbol = diagram.getSkinParam().actorStyle().toUSymbol(); + } else if (symbol.equalsIgnoreCase("portin")) { + type = LeafType.PORTIN; + usymbol = null; + } else if (symbol.equalsIgnoreCase("portout")) { + type = LeafType.PORTOUT; + usymbol = null; + } else if (symbol.equalsIgnoreCase("port")) { + type = LeafType.PORT; + usymbol = null; } else if (symbol.equalsIgnoreCase("usecase")) { type = LeafType.USECASE; usymbol = null; @@ -176,33 +191,39 @@ protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLoca usymbol = null; } else { type = LeafType.DESCRIPTION; - usymbol = USymbol.getFromString(symbol, diagram.getSkinParam().useUml2ForComponent()); + usymbol = USymbol.fromString(symbol, diagram.getSkinParam()); if (usymbol == null) { throw new IllegalStateException(); } } - final Code code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw)); - if (diagram.isGroup(code)) { - return CommandExecutionResult.error("This element (" + code.getFullName() + ") is already defined"); + final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); + if (!diagram.V1972() && diagram.isGroup(code)) { + return CommandExecutionResult.error("This element (" + code.getName() + ") is already defined"); + } + if (diagram.V1972() && diagram.isGroupStrict(ident)) { + return CommandExecutionResult.error("This element (" + ident.getName() + ") is already defined"); } String display = displayRaw; if (display == null) { - display = code.getFullName(); + display = code.getName(); } display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display); final String stereotype = arg.getLazzy("STEREOTYPE", 0); - if (existsWithBadType(diagram, code, type, usymbol)) { - return CommandExecutionResult.error("This element (" + code.getFullName() + ") is already defined"); + if (existsWithBadType3(diagram, code, ident, type, usymbol)) { + return CommandExecutionResult.error("This element (" + code.getName() + ") is already defined"); } - final IEntity entity = diagram.getOrCreateLeaf(code, type, usymbol); + final IEntity entity = diagram.getOrCreateLeaf(ident, code, type, usymbol); entity.setDisplay(Display.getWithNewlines(display)); entity.setUSymbol(usymbol); if (stereotype != null) { - entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram - .getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam() - .getIHtmlColorSet())); + entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), + diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), + diagram.getSkinParam().getIHtmlColorSet())); } + CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0)); final String urlString = arg.get("URL", 0); if (urlString != null) { @@ -213,33 +234,49 @@ protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLoca Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); - final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); + final HColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); if (lineColor != null) { colors = colors.add(ColorType.LINE, lineColor); } entity.setColors(colors); // entity.setSpecificColorTOBEREMOVED(ColorType.BACK, - // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); + // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", + // 0))); return CommandExecutionResult.ok(); } - public static boolean existsWithBadType(AbstractEntityDiagram diagram, final Code code, LeafType type, + public static boolean existsWithBadType3(AbstractEntityDiagram diagram, Code code, Ident ident, LeafType type, USymbol usymbol) { - if (diagram.leafExist(code) == false) { + if (diagram.V1972()) { + if (diagram.leafExistSmart(ident) == false) { + return false; + } + final ILeaf other = diagram.getLeafSmart(ident); + if (other.getLeafType() != type) { + return true; + } + if (usymbol != null && other.getUSymbol() != usymbol) { + return true; + } + return false; + } else { + if (diagram.leafExist(code) == false) { + return false; + } + final ILeaf other = diagram.getLeaf(code); + if (other.getLeafType() != type) { + return true; + } + if (usymbol != null && other.getUSymbol() != usymbol) { + return true; + } return false; } - final ILeaf other = diagram.getLeafsget(code); - if (other.getLeafType() != type) { - return true; - } - if (usymbol != null && other.getUSymbol() != usymbol) { - return true; - } - return false; } private char getCharEncoding(final String codeRaw) { return codeRaw != null && codeRaw.length() > 2 ? codeRaw.charAt(0) : 0; } } + diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementMultilines.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementMultilines.java index 9cabedd4b..92521ca88 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementMultilines.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementMultilines.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -49,11 +49,14 @@ import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandCreateElementMultilines extends CommandMultilines2 { @@ -117,8 +120,8 @@ private static RegexConcat getRegexConcat(int type) { @Override protected CommandExecutionResult executeNow(AbstractEntityDiagram diagram, BlocLines lines) { - lines = lines.trim(false); - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + lines = lines.trimSmart(1); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final String symbol = StringUtils.goUpperCase(line0.get("TYPE", 0)); final LeafType type; USymbol usymbol; @@ -127,16 +130,17 @@ protected CommandExecutionResult executeNow(AbstractEntityDiagram diagram, BlocL type = LeafType.USECASE; usymbol = null; } else { - usymbol = USymbol.getFromString(symbol); + usymbol = USymbol.fromString(symbol, diagram.getSkinParam().actorStyle(), + diagram.getSkinParam().componentStyle(), diagram.getSkinParam().packageStyle()); if (usymbol == null) { throw new IllegalStateException(); } type = LeafType.DESCRIPTION; } - final Code code = Code.of(line0.get("CODE", 0)); - final List lineLast = StringUtils.getSplit(MyPattern.cmpile(getPatternEnd()), lines.getLast499() - .getString()); + final String idShort = line0.get("CODE", 0); + final List lineLast = StringUtils.getSplit(MyPattern.cmpile(getPatternEnd()), + lines.getLast().getTrimmed().getString()); lines = lines.subExtract(1, 1); Display display = lines.toDisplay(); final String descStart = line0.get("DESC", 0); @@ -150,18 +154,20 @@ protected CommandExecutionResult executeNow(AbstractEntityDiagram diagram, BlocL final String stereotype = line0.get("STEREO", 0); - if (CommandCreateElementFull.existsWithBadType(diagram, code, type, usymbol)) { - return CommandExecutionResult.error("This element (" + code.getFullName() + ") is already defined"); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); + if (CommandCreateElementFull.existsWithBadType3(diagram, code, ident, type, usymbol)) { + return CommandExecutionResult.error("This element (" + code.getName() + ") is already defined"); } - final ILeaf result = diagram.createLeaf(code, display, type, usymbol); + final ILeaf result = diagram.createLeaf(ident, code, display, type, usymbol); if (result == null) { - return CommandExecutionResult.error("This element (" + code.getFullName() + ") is already defined"); + return CommandExecutionResult.error("This element (" + code.getName() + ") is already defined"); } result.setUSymbol(usymbol); if (stereotype != null) { - result.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram - .getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam() - .getIHtmlColorSet())); + result.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), + diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), + diagram.getSkinParam().getIHtmlColorSet())); } final String urlString = line0.get("URL", 0); @@ -171,9 +177,18 @@ protected CommandExecutionResult executeNow(AbstractEntityDiagram diagram, BlocL result.addUrl(url); } - result.setSpecificColorTOBEREMOVED(ColorType.BACK, - diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0))); + // final HColor backColor = + // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", + // 0)); + final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet()); + result.setColors(colors); + // result.setSpecificColorTOBEREMOVED(ColorType.BACK, backColor); return CommandExecutionResult.ok(); } + + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementParenthesis.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementParenthesis.java new file mode 100644 index 000000000..4e9faaff2 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementParenthesis.java @@ -0,0 +1,235 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.descdiagram.command; + +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.LineLocation; +import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.UrlBuilder; +import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; +import net.sourceforge.plantuml.classdiagram.ClassDiagram; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.SingleLineCommand2; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexOptional; +import net.sourceforge.plantuml.command.regex.RegexOr; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Code; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.Ident; +import net.sourceforge.plantuml.cucadiagram.LeafType; +import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.USymbol; +import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.ugraphic.color.HColor; + +public class CommandCreateElementParenthesis extends SingleLineCommand2 { + + public CommandCreateElementParenthesis() { + super(getRegexConcat()); + } + + private static IRegex getRegexConcat() { + return RegexConcat.build(CommandCreateElementParenthesis.class.getName(), RegexLeaf.start(), // + new RegexLeaf("\\(\\)[%s]+"), // + color2().getRegex(), // + RegexLeaf.spaceZeroOrMore(), // + new RegexOr(// + new RegexLeaf("CODE1", CommandCreateElementFull.CODE_WITH_QUOTE), // + new RegexConcat(// + new RegexLeaf("DISPLAY2", CommandCreateElementFull.DISPLAY), // + new RegexOptional( // + new RegexConcat( // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("STEREOTYPE2", "(\\<\\<.+\\>\\>)")// + )), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("as"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("CODE2", CommandCreateElementFull.CODE)), // + new RegexConcat(// + new RegexLeaf("CODE3", CommandCreateElementFull.CODE), // + new RegexOptional( // + new RegexConcat( // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("STEREOTYPE3", "(\\<\\<.+\\>\\>)") // + )), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("as"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("DISPLAY3", CommandCreateElementFull.DISPLAY)), // + new RegexConcat(// + new RegexLeaf("DISPLAY4", CommandCreateElementFull.DISPLAY_WITHOUT_QUOTE), // + new RegexOptional( // + new RegexConcat( // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("STEREOTYPE4", "(\\<\\<.+\\>\\>)") // + )), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("as"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("CODE4", CommandCreateElementFull.CODE)) // + ), // + new RegexOptional( // + new RegexConcat( // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREOTYPE", "(\\<\\<.+\\>\\>)") // + )), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // + RegexLeaf.spaceZeroOrMore(), // + color().getRegex(), RegexLeaf.end()); + } + + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + + private static ColorParser color2() { + return ColorParser.simpleColor(ColorType.BACK, "COLOR2"); + } + +// private static final String CODE_CORE = "[\\p{L}0-9_.]+|\\(\\)[%s]*[\\p{L}0-9_.]+|\\(\\)[%s]*[%g][^%g]+[%g]|:[^:]+:|\\([^()]+\\)|\\[[^\\[\\]]+\\]"; +// public static final String CODE = "(" + CODE_CORE + ")"; +// public static final String CODE_WITH_QUOTE = "(" + CODE_CORE + "|[%g].+?[%g])"; +// +// private static final String DISPLAY_CORE = "[%g].+?[%g]|:[^:]+:|\\([^()]+\\)|\\[[^\\[\\]]+\\]"; +// public static final String DISPLAY = "(" + DISPLAY_CORE + ")"; +// public static final String DISPLAY_WITHOUT_QUOTE = "(" + DISPLAY_CORE + "|[\\p{L}0-9_.]+)"; + + @Override + final protected boolean isForbidden(CharSequence line) { + if (line.toString().matches("^[\\p{L}0-9_.]+$")) { + return true; + } + return false; + } + + @Override + protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { + String codeRaw = arg.getLazzy("CODE", 0); + final String displayRaw = arg.getLazzy("DISPLAY", 0); + final String symbol = "interface"; + final LeafType type; + final USymbol usymbol; + + type = LeafType.DESCRIPTION; + usymbol = USymbol.fromString(symbol, diagram.getSkinParam()); + + final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); + if (!diagram.V1972() && diagram.isGroup(code)) { + return CommandExecutionResult.error("This element (" + code.getName() + ") is already defined"); + } + if (diagram.V1972() && diagram.isGroupStrict(ident)) { + return CommandExecutionResult.error("This element (" + ident.getName() + ") is already defined"); + } + String display = displayRaw; + if (display == null) { + display = code.getName(); + } + display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display); + final String stereotype = arg.getLazzy("STEREOTYPE", 0); + if (existsWithBadType3(diagram, code, ident, type, usymbol)) { + return CommandExecutionResult.error("This element (" + code.getName() + ") is already defined"); + } + final IEntity entity = diagram.getOrCreateLeaf(ident, code, type, usymbol); + entity.setDisplay(Display.getWithNewlines(display)); + entity.setUSymbol(usymbol); + if (stereotype != null) { + entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), + diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), + diagram.getSkinParam().getIHtmlColorSet())); + } + + final String urlString = arg.get("URL", 0); + if (urlString != null) { + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final Url url = urlBuilder.getUrl(urlString); + entity.addUrl(url); + } + + Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); + + final HColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); + if (lineColor != null) { + colors = colors.add(ColorType.LINE, lineColor); + } + entity.setColors(colors); + + // entity.setSpecificColorTOBEREMOVED(ColorType.BACK, + // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", + // 0))); + return CommandExecutionResult.ok(); + } + + public static boolean existsWithBadType3(AbstractEntityDiagram diagram, Code code, Ident ident, LeafType type, + USymbol usymbol) { + if (diagram.V1972()) { + if (diagram.leafExistSmart(ident) == false) { + return false; + } + final ILeaf other = diagram.getLeafSmart(ident); + if (other.getLeafType() != type) { + return true; + } + if (usymbol != null && other.getUSymbol() != usymbol) { + return true; + } + return false; + } else { + if (diagram.leafExist(code) == false) { + return false; + } + final ILeaf other = diagram.getLeaf(code); + if (other.getLeafType() != type) { + return true; + } + if (usymbol != null && other.getUSymbol() != usymbol) { + return true; + } + return false; + } + } + + private char getCharEncoding(final String codeRaw) { + return codeRaw != null && codeRaw.length() > 2 ? codeRaw.charAt(0) : 0; + } +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java index f15c34f98..0ad7ab471 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -27,6 +27,7 @@ * * * Original Author: Arnaud Roques + * Contribution : Hisashi Miyashita */ package net.sourceforge.plantuml.descdiagram.command; @@ -37,9 +38,6 @@ import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.IRegex; -import net.sourceforge.plantuml.command.regex.Matcher2; -import net.sourceforge.plantuml.command.regex.MyPattern; -import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; @@ -48,9 +46,9 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; -import net.sourceforge.plantuml.cucadiagram.LinkArrow; import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.cucadiagram.Stereotype; @@ -76,18 +74,18 @@ static IRegex getRegexConcat() { return RegexConcat.build(CommandLinkElement.class.getName(), RegexLeaf.start(), // getGroup("ENT1"), // RegexLeaf.spaceZeroOrMore(), // - new RegexOptional(new RegexLeaf("LABEL1", "[%g]([^%g]+)[%g]")), // + new RegexOptional(new RegexLeaf("FIRST_LABEL", "[%g]([^%g]+)[%g]")), // RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("HEAD2", "(0\\)|<<|[<^*+#0)]|<\\||[%s]+o)?"), // + new RegexLeaf("HEAD2", "(0\\)|<<|[<^*+#0@)]|<\\|[\\|\\:]?|[%s]+o)?"), // new RegexLeaf("BODY1", "([-=.~]+)"), // new RegexLeaf("ARROW_STYLE1", "(?:\\[(" + LINE_STYLE_MUTILPLES + ")\\])?"), // new RegexOptional(new RegexLeaf("DIRECTION", "(left|right|up|down|le?|ri?|up?|do?)(?=[-=.~0()])")), // new RegexOptional(new RegexLeaf("INSIDE", "(0|\\(0\\)|\\(0|0\\))(?=[-=.~])")), // new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + LINE_STYLE + ")\\])?"), // new RegexLeaf("BODY2", "([-=.~]*)"), // - new RegexLeaf("HEAD1", "(\\(0|>>|[>^*+#0(]|\\|>|o[%s]+)?"), // + new RegexLeaf("HEAD1", "(\\(0|>>|[>^*+#0@(]|[\\:\\|]?\\|>|\\\\\\\\|o[%s]+)?"), // RegexLeaf.spaceZeroOrMore(), // - new RegexOptional(new RegexLeaf("LABEL2", "[%g]([^%g]+)[%g]")), // + new RegexOptional(new RegexLeaf("SECOND_LABEL", "[%g]([^%g]+)[%g]")), // RegexLeaf.spaceZeroOrMore(), // getGroup("ENT2"), // RegexLeaf.spaceZeroOrMore(), // @@ -113,6 +111,8 @@ private LinkType getLinkType(RegexResult arg) { d1 = LinkDecor.SQUARE; } else if (head1.equals("0")) { d1 = LinkDecor.CIRCLE; + } else if (head1.equals("@")) { + d1 = LinkDecor.CIRCLE_FILL; } else if (head1.equals("(")) { d1 = LinkDecor.PARENTHESIS; } else if (head1.equals(">")) { @@ -123,10 +123,16 @@ private LinkType getLinkType(RegexResult arg) { d1 = LinkDecor.AGREGATION; } else if (head1.equals("+")) { d1 = LinkDecor.PLUS; + } else if (head1.equals("\\\\")) { + d1 = LinkDecor.HALF_ARROW; } else if (head1.equals(">>")) { d1 = LinkDecor.ARROW_TRIANGLE; } else if (head1.equals("^")) { d1 = LinkDecor.EXTENDS; + } else if (head1.equals(":|>")) { + d1 = LinkDecor.DEFINEDBY; + } else if (head1.equals("||>")) { + d1 = LinkDecor.REDEFINES; } else if (head1.equals("|>")) { d1 = LinkDecor.EXTENDS; } @@ -137,6 +143,8 @@ private LinkType getLinkType(RegexResult arg) { d2 = LinkDecor.SQUARE; } else if (head2.equals("0")) { d2 = LinkDecor.CIRCLE; + } else if (head2.equals("@")) { + d2 = LinkDecor.CIRCLE_FILL; } else if (head2.equals(")")) { d2 = LinkDecor.PARENTHESIS; } else if (head2.equals("<")) { @@ -151,6 +159,10 @@ private LinkType getLinkType(RegexResult arg) { d2 = LinkDecor.ARROW_TRIANGLE; } else if (head2.equals("^")) { d2 = LinkDecor.EXTENDS; + } else if (head2.equals("<|:")) { + d2 = LinkDecor.DEFINEDBY; + } else if (head2.equals("<||")) { + d2 = LinkDecor.REDEFINES; } else if (head2.equals("<|")) { d2 = LinkDecor.EXTENDS; } @@ -199,103 +211,20 @@ private String getQueue(RegexResult arg) { } private static RegexLeaf getGroup(String name) { - return new RegexLeaf( - name, + return new RegexLeaf(name, "([\\p{L}0-9_.]+|\\(\\)[%s]*[\\p{L}0-9_.]+|\\(\\)[%s]*[%g][^%g]+[%g]|:[^:]+:|(?!\\[\\*\\])\\[[^\\[\\]]+\\]|\\((?!\\*\\))[^)]+\\))"); } - static class Labels { - private String firstLabel; - private String secondLabel; - private String labelLink; - private LinkArrow linkArrow = LinkArrow.NONE; - - Labels(RegexResult arg) { - firstLabel = arg.get("LABEL1", 0); - secondLabel = arg.get("LABEL2", 0); - labelLink = arg.get("LABEL_LINK", 0); - - if (labelLink != null) { - if (firstLabel == null && secondLabel == null) { - init(); - } - labelLink = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(labelLink); - - if ("<".equals(labelLink)) { - linkArrow = LinkArrow.BACKWARD; - labelLink = null; - } else if (">".equals(labelLink)) { - linkArrow = LinkArrow.DIRECT_NORMAL; - labelLink = null; - } else if (labelLink != null && labelLink.startsWith("< ")) { - linkArrow = LinkArrow.BACKWARD; - labelLink = StringUtils.trin(labelLink.substring(2)); - } else if (labelLink != null && labelLink.startsWith("> ")) { - linkArrow = LinkArrow.DIRECT_NORMAL; - labelLink = StringUtils.trin(labelLink.substring(2)); - } else if (labelLink != null && labelLink.endsWith(" >")) { - linkArrow = LinkArrow.DIRECT_NORMAL; - labelLink = StringUtils.trin(labelLink.substring(0, labelLink.length() - 2)); - } else if (labelLink != null && labelLink.endsWith(" <")) { - linkArrow = LinkArrow.BACKWARD; - labelLink = StringUtils.trin(labelLink.substring(0, labelLink.length() - 2)); - } - - } - - } - - private void init() { - final Pattern2 p1 = MyPattern.cmpile("^[%g]([^%g]+)[%g]([^%g]+)[%g]([^%g]+)[%g]$"); - final Matcher2 m1 = p1.matcher(labelLink); - if (m1.matches()) { - firstLabel = m1.group(1); - labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils - .trin(m1.group(2)))); - secondLabel = m1.group(3); - return; - } - final Pattern2 p2 = MyPattern.cmpile("^[%g]([^%g]+)[%g]([^%g]+)$"); - final Matcher2 m2 = p2.matcher(labelLink); - if (m2.matches()) { - firstLabel = m2.group(1); - labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils - .trin(m2.group(2)))); - secondLabel = null; - return; - } - final Pattern2 p3 = MyPattern.cmpile("^([^%g]+)[%g]([^%g]+)[%g]$"); - final Matcher2 m3 = p3.matcher(labelLink); - if (m3.matches()) { - firstLabel = null; - labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils - .trin(m3.group(1)))); - secondLabel = m3.group(2); - } - } - - } - @Override protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) { - final Code ent1 = Code.of(arg.get("ENT1", 0)); - final Code ent2 = Code.of(arg.get("ENT2", 0)); - - if (diagram.isGroup(ent1) && diagram.isGroup(ent2)) { - return executePackageLink(diagram, arg); - } - - final IEntity cl1 = diagram.isGroup(ent1) ? diagram.getGroup(Code.of(arg.get("ENT1", 0))) : getOrCreateLeaf( - diagram, ent1); - final IEntity cl2 = diagram.isGroup(ent2) ? diagram.getGroup(Code.of(arg.get("ENT2", 0))) : getOrCreateLeaf( - diagram, ent2); - - // if (arg.get("ENT1", 1) != null) { - // cl1.setStereotype(new Stereotype(arg.get("ENT1", 1))); - // } - // if (arg.get("ENT2", 1) != null) { - // cl2.setStereotype(new Stereotype(arg.get("ENT2", 1))); - // } + final String ent1String = arg.get("ENT1", 0); + final String ent2String = arg.get("ENT2", 0); + final Ident ident1 = diagram.buildFullyQualified(ent1String); + final Ident ident2 = diagram.buildFullyQualified(ent2String); + Ident ident1pure = Ident.empty().add(ent1String, diagram.getNamespaceSeparator()); + Ident ident2pure = Ident.empty().add(ent2String, diagram.getNamespaceSeparator()); + final Code code1 = diagram.V1972() ? ident1 : diagram.buildCode(ent1String); + final Code code2 = diagram.V1972() ? ident2 : diagram.buildCode(ent2String); final LinkType linkType = getLinkType(arg); final Direction dir = getDirection(arg); @@ -305,13 +234,23 @@ protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLoca } else { queue = getQueue(arg); } - final Labels labels = new Labels(arg); - Link link = new Link(cl1, cl2, linkType, Display.getWithNewlines(labels.labelLink), queue.length(), - labels.firstLabel, labels.secondLabel, diagram.getLabeldistance(), diagram.getLabelangle(), diagram - .getSkinParam().getCurrentStyleBuilder()); - link.setLinkArrow(labels.linkArrow); + final IEntity cl1; + final IEntity cl2; + if (diagram.isGroup(code1) && diagram.isGroup(code2)) { + cl1 = diagram.V1972() ? diagram.getGroupStrict(diagram.buildLeafIdent(ent1String)) + : diagram.getGroup(diagram.buildCode(ent1String)); + cl2 = diagram.V1972() ? diagram.getGroupStrict(diagram.buildLeafIdent(ent2String)) + : diagram.getGroup(diagram.buildCode(ent2String)); + } else { + cl1 = getFoo1(diagram, code1, ident1, ident1pure); + cl2 = getFoo1(diagram, code2, ident2, ident2pure); + } + Link link = new Link(cl1, cl2, linkType, Display.getWithNewlines(labels.getLabelLink()), queue.length(), + labels.getFirstLabel(), labels.getSecondLabel(), diagram.getLabeldistance(), diagram.getLabelangle(), + diagram.getSkinParam().getCurrentStyleBuilder()); + link.setLinkArrow(labels.getLinkArrow()); if (dir == Direction.LEFT || dir == Direction.UP) { link = link.getInv(); } @@ -325,49 +264,46 @@ protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLoca return CommandExecutionResult.ok(); } - private ILeaf getOrCreateLeaf(DescriptionDiagram diagram, final Code code2) { - final String code = code2.getFullName(); - if (code.startsWith("()")) { - return diagram.getOrCreateLeaf(Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils - .trin(code.substring(2)))), LeafType.DESCRIPTION, USymbol.INTERFACE); + private IEntity getFoo1(DescriptionDiagram diagram, Code code, Ident ident, Ident pure) { + if (!diagram.V1972() && diagram.isGroup(code)) { + return diagram.getGroup(code); + } + if (diagram.V1972() && diagram.isGroupStrict(ident)) { + return diagram.getGroupStrict(ident); } - final char codeChar = code.length() > 2 ? code.charAt(0) : 0; + final String codeString = code.getName(); + if (ident.getLast().startsWith("()")) { + ident = ident.removeStartingParenthesis(); + return getOrCreateLeaf1972(diagram, ident, ident.toCode(diagram), LeafType.DESCRIPTION, USymbol.INTERFACE, + pure); + } + final char codeChar = codeString.length() > 2 ? codeString.charAt(0) : 0; + final String tmp3 = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeString, "\"([:"); + final Ident ident3 = diagram.buildFullyQualified(tmp3); + final Code code3 = diagram.V1972() ? ident3 : diagram.buildCode(tmp3); if (codeChar == '(') { - return diagram.getOrCreateLeaf(code2.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"), - LeafType.USECASE, USymbol.USECASE); + return getOrCreateLeaf1972(diagram, ident3, code3, LeafType.USECASE, USymbol.USECASE, pure); } else if (codeChar == ':') { - return diagram.getOrCreateLeaf(code2.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"), - LeafType.DESCRIPTION, USymbol.ACTOR); + return getOrCreateLeaf1972(diagram, ident3, code3, LeafType.DESCRIPTION, + diagram.getSkinParam().actorStyle().toUSymbol(), pure); } else if (codeChar == '[') { - final USymbol sym = diagram.getSkinParam().useUml2ForComponent() ? USymbol.COMPONENT2 : USymbol.COMPONENT1; - return diagram.getOrCreateLeaf(code2.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"), - LeafType.DESCRIPTION, sym); + final USymbol sym = diagram.getSkinParam().componentStyle().toUSymbol(); + return getOrCreateLeaf1972(diagram, ident3, code3, LeafType.DESCRIPTION, sym, pure); } - return diagram.getOrCreateLeaf(code2, null, null); + return getOrCreateLeaf1972(diagram, ident, code, null, null, pure); } - private CommandExecutionResult executePackageLink(DescriptionDiagram diagram, RegexResult arg) { - final IEntity cl1 = diagram.getGroup(Code.of(arg.get("ENT1", 0))); - final IEntity cl2 = diagram.getGroup(Code.of(arg.get("ENT2", 0))); - - final LinkType linkType = getLinkType(arg); - final Direction dir = getDirection(arg); - final String queue; - if (dir == Direction.LEFT || dir == Direction.RIGHT) { - queue = "-"; - } else { - queue = getQueue(arg); - } - - Link link = new Link(cl1, cl2, linkType, Display.getWithNewlines(arg.get("LABEL_LINK", 0)), queue.length(), - diagram.getSkinParam().getCurrentStyleBuilder()); - if (dir == Direction.LEFT || dir == Direction.UP) { - link = link.getInv(); + private ILeaf getOrCreateLeaf1972(DescriptionDiagram diagram, Ident ident, Code code, LeafType type, USymbol symbol, + Ident pure) { + if (diagram.V1972()) { + final ILeaf result = pure.size() == 1 ? diagram.getLeafVerySmart(ident) : diagram.getLeafStrict(ident); + // final ILeaf result = diagram.getLeafSmart(ident); + if (result != null) { + return result; + } } - link.applyStyle(arg.getLazzy("ARROW_STYLE", 0)); - diagram.addLink(link); - return CommandExecutionResult.ok(); + return diagram.getOrCreateLeaf(ident, code, type, symbol); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandNewpage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandNewpage.java index a9fd0f661..d54695eca 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandNewpage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandNewpage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java index 33ebf1857..0616ee504 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -50,6 +50,7 @@ import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; import net.sourceforge.plantuml.cucadiagram.Stereotag; import net.sourceforge.plantuml.cucadiagram.Stereotype; @@ -66,62 +67,60 @@ public CommandPackageWithUSymbol() { } private static IRegex getRegexConcat() { - return RegexConcat - .build(CommandPackageWithUSymbol.class.getName(), - RegexLeaf.start(), // - new RegexLeaf("SYMBOL", - "(package|rectangle|node|artifact|folder|file|frame|cloud|database|storage|component|card|together|queue|stack)"), // - RegexLeaf.spaceOneOrMore(), // - new RegexOr(// - new RegexConcat( // - new RegexLeaf("DISPLAY1", "([%g].+?[%g])"), // - new RegexOptional( // - new RegexConcat( // - RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("STEREOTYPE1", "(\\<\\<.+\\>\\>)") // - )), // - RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("as"), // - RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("CODE1", "([^#%s{}]+)") // - ), // - new RegexConcat( // - new RegexLeaf("CODE2", "([^#%s{}%g]+)"), // - new RegexOptional( // - new RegexConcat( // - RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("STEREOTYPE2", "(\\<\\<.+\\>\\>)") // - )), // - RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("as"), // - RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("DISPLAY2", "([%g].+?[%g])") // - ), // - new RegexConcat( // - new RegexLeaf("DISPLAY3", "([^#%s{}%g]+)"), // - new RegexOptional( // - new RegexConcat( // - RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("STEREOTYPE3", "(\\<\\<.+\\>\\>)") // - )), // - RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("as"), // - RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("CODE3", "([^#%s{}%g]+)") // - ), // - new RegexLeaf("CODE8", "([%g][^%g]+[%g])"), // - new RegexLeaf("CODE9", "([^#%s{}%g]*)") // + return RegexConcat.build(CommandPackageWithUSymbol.class.getName(), RegexLeaf.start(), // + new RegexLeaf("SYMBOL", + "(package|rectangle|node|artifact|folder|file|frame|cloud|database|storage|component|card|together|queue|stack)"), // + RegexLeaf.spaceOneOrMore(), // + new RegexOr(// + new RegexConcat( // + new RegexLeaf("DISPLAY1", "([%g].+?[%g])"), // + new RegexOptional( // + new RegexConcat( // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("STEREOTYPE1", "(\\<\\<.+\\>\\>)") // + )), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("as"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("CODE1", "([^#%s{}]+)") // ), // - RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), // - RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // - RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // - RegexLeaf.spaceZeroOrMore(), // - color().getRegex(), // - RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("\\{"), RegexLeaf.end()); + new RegexConcat( // + new RegexLeaf("CODE2", "([^#%s{}%g]+)"), // + new RegexOptional( // + new RegexConcat( // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("STEREOTYPE2", "(\\<\\<.+\\>\\>)") // + )), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("as"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("DISPLAY2", "([%g].+?[%g])") // + ), // + new RegexConcat( // + new RegexLeaf("DISPLAY3", "([^#%s{}%g]+)"), // + new RegexOptional( // + new RegexConcat( // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("STEREOTYPE3", "(\\<\\<.+\\>\\>)") // + )), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("as"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("CODE3", "([^#%s{}%g]+)") // + ), // + new RegexLeaf("CODE8", "([%g][^%g]+[%g])"), // + new RegexLeaf("CODE9", "([^#%s{}%g]*)") // + ), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // + RegexLeaf.spaceZeroOrMore(), // + color().getRegex(), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("\\{"), RegexLeaf.end()); } private static ColorParser color() { @@ -132,25 +131,32 @@ private static ColorParser color() { protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) { final String codeRaw = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("CODE", 0)); final String displayRaw = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("DISPLAY", 0)); - final Code code; final String display; + final String idShort; if (codeRaw.length() == 0) { - code = UniqueSequence.getCode("##"); + idShort = UniqueSequence.getString("##"); display = null; } else { - code = Code.of(codeRaw); + idShort = codeRaw; if (displayRaw == null) { - display = code.getFullName(); + display = idShort; } else { display = displayRaw; } } + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); final IGroup currentPackage = diagram.getCurrentGroup(); - diagram.gotoGroup2(code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage, + diagram.gotoGroup(ident, code, Display.getWithNewlines(display), GroupType.PACKAGE, currentPackage, NamespaceStrategy.SINGLE); final IEntity p = diagram.getCurrentGroup(); - p.setUSymbol(USymbol.getFromString(arg.get("SYMBOL", 0))); + final String symbol = arg.get("SYMBOL", 0); + if ("together".equalsIgnoreCase(symbol)) { + p.setThisIsTogether(); + } + p.setUSymbol(USymbol.fromString(symbol, diagram.getSkinParam().actorStyle(), + diagram.getSkinParam().componentStyle(), diagram.getSkinParam().packageStyle())); final String stereotype = arg.getLazzy("STEREOTYPE", 0); if (stereotype != null) { p.setStereotype(new Stereotype(stereotype, false)); @@ -166,5 +172,4 @@ protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineL p.setColors(colors); return CommandExecutionResult.ok(); } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/Labels.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/Labels.java new file mode 100644 index 000000000..3ad845aa0 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/Labels.java @@ -0,0 +1,111 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + * Contribution : Hisashi Miyashita + */ +package net.sourceforge.plantuml.descdiagram.command; + +import net.sourceforge.plantuml.StringUtils; +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.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.cucadiagram.LinkArrow; + +public class Labels { + + private String firstLabel; + private String secondLabel; + private final StringWithArrow stringWithArrow; + + public Labels(RegexResult arg) { + this.firstLabel = arg.get("FIRST_LABEL", 0); + this.secondLabel = arg.get("SECOND_LABEL", 0); + String labelLink = arg.get("LABEL_LINK", 0); + + if (labelLink != null) { + labelLink = init(labelLink); + } + + this.stringWithArrow = new StringWithArrow(labelLink); + + } + + private String init(String labelLink) { + if (firstLabel == null && secondLabel == null) { + final Pattern2 p1 = MyPattern.cmpile("^[%g]([^%g]+)[%g]([^%g]+)[%g]([^%g]+)[%g]$"); + final Matcher2 m1 = p1.matcher(labelLink); + if (m1.matches()) { + firstLabel = m1.group(1); + secondLabel = m1.group(3); + return StringUtils + .trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils.trin(m1.group(2)))); + } + final Pattern2 p2 = MyPattern.cmpile("^[%g]([^%g]+)[%g]([^%g]+)$"); + final Matcher2 m2 = p2.matcher(labelLink); + if (m2.matches()) { + firstLabel = m2.group(1); + secondLabel = null; + return StringUtils + .trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils.trin(m2.group(2)))); + } + final Pattern2 p3 = MyPattern.cmpile("^([^%g]+)[%g]([^%g]+)[%g]$"); + final Matcher2 m3 = p3.matcher(labelLink); + if (m3.matches()) { + firstLabel = null; + secondLabel = m3.group(2); + return StringUtils + .trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils.trin(m3.group(1)))); + } + } + return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(labelLink, "\""); + } + + public final String getFirstLabel() { + return firstLabel; + } + + public final String getSecondLabel() { + return secondLabel; + } + + public final String getLabelLink() { + return stringWithArrow.getLabel(); + } + + public final LinkArrow getLinkArrow() { + return stringWithArrow.getLinkArrow(); + } + + public Display getDisplay() { + return stringWithArrow.getDisplay(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/StringWithArrow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/StringWithArrow.java new file mode 100644 index 000000000..9895759c6 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/descdiagram/command/StringWithArrow.java @@ -0,0 +1,140 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + * Contribution : Hisashi Miyashita + */ +package net.sourceforge.plantuml.descdiagram.command; + +import net.sourceforge.plantuml.Direction; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.cucadiagram.LinkArrow; +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.TextBlockArrow; +import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.graphic.VerticalAlignment; +import net.sourceforge.plantuml.svek.DirectionalTextBlock; +import net.sourceforge.plantuml.svek.GuideLine; + +public class StringWithArrow { + + private final String label; + private final LinkArrow linkArrow; + + public StringWithArrow(String completeLabel) { + if (completeLabel == null) { + this.linkArrow = LinkArrow.NONE_OR_SEVERAL; + this.label = null; + return; + } + completeLabel = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(completeLabel, "\""); + if (Display.hasSeveralGuideLines(completeLabel)) { + this.linkArrow = LinkArrow.NONE_OR_SEVERAL; + this.label = completeLabel; + } else { + + if ("<".equals(completeLabel)) { + this.linkArrow = LinkArrow.BACKWARD; + this.label = null; + } else if (">".equals(completeLabel)) { + this.linkArrow = LinkArrow.DIRECT_NORMAL; + this.label = null; + } else if (completeLabel.startsWith("< ")) { + this.linkArrow = LinkArrow.BACKWARD; + this.label = StringUtils.trin(completeLabel.substring(2)); + } else if (completeLabel.startsWith("> ")) { + this.linkArrow = LinkArrow.DIRECT_NORMAL; + this.label = StringUtils.trin(completeLabel.substring(2)); + } else if (completeLabel.endsWith(" >")) { + this.linkArrow = LinkArrow.DIRECT_NORMAL; + this.label = StringUtils.trin(completeLabel.substring(0, completeLabel.length() - 2)); + } else if (completeLabel.endsWith(" <")) { + this.linkArrow = LinkArrow.BACKWARD; + this.label = StringUtils.trin(completeLabel.substring(0, completeLabel.length() - 2)); + } else { + this.linkArrow = LinkArrow.NONE_OR_SEVERAL; + this.label = completeLabel; + } + } + } + + public final String getLabel() { + return label; + } + + public final LinkArrow getLinkArrow() { + return linkArrow; + } + + public final Display getDisplay() { + return Display.getWithNewlines(label); + } + + static public TextBlock addMagicArrow(TextBlock label, GuideLine guide, FontConfiguration font) { + final TextBlock arrowRight = new TextBlockArrow(Direction.RIGHT, font); + final TextBlock arrowLeft = new TextBlockArrow(Direction.LEFT, font); + final TextBlock arrowUp = new TextBlockArrow(Direction.UP, font); + final TextBlock arrowDown = new TextBlockArrow(Direction.DOWN, font); + final TextBlock right = TextBlockUtils.mergeLR(label, arrowRight, VerticalAlignment.CENTER); + final TextBlock left = TextBlockUtils.mergeLR(arrowLeft, label, VerticalAlignment.CENTER); + final TextBlock up = TextBlockUtils.mergeTB(arrowUp, label, HorizontalAlignment.CENTER); + final TextBlock down = TextBlockUtils.mergeTB(label, arrowDown, HorizontalAlignment.CENTER); + return new DirectionalTextBlock(guide, right, left, up, down); + } + + static private TextBlock addMagicArrow2(TextBlock label, GuideLine guide, FontConfiguration font) { + final TextBlock arrowRight = new TextBlockArrow(Direction.RIGHT, font); + final TextBlock arrowLeft = new TextBlockArrow(Direction.LEFT, font); + final TextBlock arrowUp = new TextBlockArrow(Direction.UP, font); + final TextBlock arrowDown = new TextBlockArrow(Direction.DOWN, font); + final TextBlock right = TextBlockUtils.mergeLR(label, arrowRight, VerticalAlignment.CENTER); + final TextBlock left = TextBlockUtils.mergeLR(arrowLeft, label, VerticalAlignment.CENTER); + final TextBlock up = TextBlockUtils.mergeLR(arrowUp, label, VerticalAlignment.CENTER); + final TextBlock down = TextBlockUtils.mergeLR(label, arrowDown, VerticalAlignment.CENTER); + return new DirectionalTextBlock(guide, right, left, up, down); + } + + public static TextBlock addSeveralMagicArrows(Display label, GuideLine guide, FontConfiguration font, + HorizontalAlignment alignment, ISkinParam skinParam) { + TextBlock result = TextBlockUtils.EMPTY_TEXT_BLOCK; + for (CharSequence cs : label) { + StringWithArrow tmp = new StringWithArrow(cs.toString()); + TextBlock block = tmp.getDisplay().create9(font, alignment, skinParam, skinParam.maxMessageSize()); + if (tmp.getLinkArrow() != LinkArrow.NONE_OR_SEVERAL) { + block = StringWithArrow.addMagicArrow2(block, tmp.getLinkArrow().mute(guide), font); + } + result = TextBlockUtils.mergeTB(result, block, alignment); + } + return result; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/directdot/PSystemDot.java b/src/plantuml-asl/src/net/sourceforge/plantuml/directdot/PSystemDot.java index d26e2e4d0..ad8aa20d9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/directdot/PSystemDot.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/directdot/PSystemDot.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -46,10 +46,10 @@ import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; import net.sourceforge.plantuml.cucadiagram.dot.ProcessState; import net.sourceforge.plantuml.graphic.GraphicStrings; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.UGraphicUtils; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemDot extends AbstractPSystem { @@ -71,7 +71,7 @@ final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatO if (graphviz.getExeState() != ExeState.OK) { final TextBlock result = GraphicStrings.createForError( Arrays.asList("There is an issue with your Dot/Graphviz installation"), false); - UGraphicUtils.writeImage(os, null, fileFormat, seed(), new ColorMapperIdentity(), HtmlColorUtils.WHITE, + UGraphicUtils.writeImage(os, null, fileFormat, seed(), new ColorMapperIdentity(), HColorUtils.WHITE, result); return ImageDataSimple.error(); } @@ -82,7 +82,7 @@ final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatO // } if (counter.getLength() == 0 || state.differs(ProcessState.TERMINATED_OK())) { final TextBlock result = GraphicStrings.createForError(Arrays.asList("GraphViz has crashed"), false); - UGraphicUtils.writeImage(os, null, fileFormat, seed(), new ColorMapperIdentity(), HtmlColorUtils.WHITE, + UGraphicUtils.writeImage(os, null, fileFormat, seed(), new ColorMapperIdentity(), HColorUtils.WHITE, result); return ImageDataSimple.error(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/directdot/PSystemDotFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/directdot/PSystemDotFactory.java index dc476cc7d..27658749a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/directdot/PSystemDotFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/directdot/PSystemDotFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -49,7 +49,7 @@ public PSystemDot init(String startLine) { @Override public PSystemDot executeLine(PSystemDot system, String line) { - if (system == null && line.matches("(strict\\s+)?(di)?graph\\s+\\w+\\s+\\{")) { + if (system == null && line.matches("(strict\\s+)?(di)?graph\\s+\\w+\\s*\\{")) { data = new StringBuilder(line); data.append("\n"); return new PSystemDot(data.toString()); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ditaa/PSystemDitaa.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ditaa/PSystemDitaa.java index 0a7fbb1d3..a7ac0652c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ditaa/PSystemDitaa.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ditaa/PSystemDitaa.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,16 +35,19 @@ import java.io.OutputStream; import java.lang.reflect.Field; import java.lang.reflect.Method; - -import javax.imageio.ImageIO; +import java.util.ArrayList; +import java.util.List; import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormatOption; +import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; +import net.sourceforge.plantuml.security.ImageIO; +import net.sourceforge.plantuml.svek.GraphvizCrash; public class PSystemDitaa extends AbstractPSystem { @@ -116,16 +119,18 @@ final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatO // final Diagram diagram = new Diagram(grid, options, processingOptions); final Class clDiagram = Class.forName("org.stathissideris.ascii2image.graphics.Diagram"); - clDiagram.getConstructor(grid.getClass(), options.getClass(), processingOptions.getClass()).newInstance( - grid, options, processingOptions); - final Object diagram = clDiagram.getConstructor(grid.getClass(), options.getClass(), - processingOptions.getClass()).newInstance(grid, options, processingOptions); + clDiagram.getConstructor(grid.getClass(), options.getClass(), processingOptions.getClass()) + .newInstance(grid, options, processingOptions); + final Object diagram = clDiagram + .getConstructor(grid.getClass(), options.getClass(), processingOptions.getClass()) + .newInstance(grid, options, processingOptions); // final BitmapRenderer bitmapRenderer = new BitmapRenderer(); final Object bitmapRenderer = Class.forName("org.stathissideris.ascii2image.graphics.BitmapRenderer") .newInstance(); - // final BufferedImage image = (BufferedImage) bitmapRenderer.renderToImage(diagram, renderingOptions); + // final BufferedImage image = (BufferedImage) + // bitmapRenderer.renderToImage(diagram, renderingOptions); final Method renderToImage = bitmapRenderer.getClass().getMethod("renderToImage", diagram.getClass(), renderingOptions.getClass()); final BufferedImage image = (BufferedImage) renderToImage.invoke(bitmapRenderer, diagram, renderingOptions); @@ -134,10 +139,15 @@ final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatO final int width = image.getWidth(); final int height = image.getHeight(); return new ImageDataSimple(width, height); - } catch (Exception e) { - e.printStackTrace(); + } catch (Throwable e) { + final List strings = new ArrayList(); + strings.add("DITAA has crashed"); + strings.add(" "); + GraphvizCrash.youShouldSendThisDiagram(strings); + strings.add(" "); + UmlDiagram.exportDiagramError(os, e, new FileFormatOption(FileFormat.PNG), seed(), null, null, strings); + return ImageDataSimple.error(); } - return null; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ditaa/PSystemDitaaFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ditaa/PSystemDitaaFactory.java index 48f621e0a..00cc90b2e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ditaa/PSystemDitaaFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ditaa/PSystemDitaaFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/donors/PSystemDonors.java b/src/plantuml-asl/src/net/sourceforge/plantuml/donors/PSystemDonors.java index 7beeeff44..2a6df29be 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/donors/PSystemDonors.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/donors/PSystemDonors.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,22 +43,25 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.code.AsciiEncoder; import net.sourceforge.plantuml.code.CompressionBrotli; +import net.sourceforge.plantuml.code.NoPlantumlCompressionException; import net.sourceforge.plantuml.code.StringCompressorNone; import net.sourceforge.plantuml.code.Transcoder; import net.sourceforge.plantuml.code.TranscoderImpl; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicStrings; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.AffineTransformType; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.version.PSystemVersion; public class PSystemDonors extends AbstractPSystem { @@ -66,30 +69,39 @@ public class PSystemDonors extends AbstractPSystem { private static final int COLS = 6; private static final int FREE_LINES = 6; - public static final String DONORS = "6rW902mFR3hSmrTODcikzuop9yl7Q5RohVaQVmG9QrfMG8eAo04YsxAZMAlDIBlv0O82w3Lqz9ZRTthS" - + "RwI_YAvqzqqpecqsfpJFA8e5GUFvDksmpP-zgJAa53AGwKICX-1fynfBhQmb_o3XTFytdKBoK166eTaA" - + "vwCHQlz096FjZgt6TFUZgBjMNTob2jyADQPJn35S5HhbrGDVMoWP5IxzEdyBcfWL4pb4YgUis68UlQ67" - + "AxdGEYCBPDR-exu0BLB392Xo2L1iFKcYuwsbdNq7ki-HG8SJboYmcJ479Gxh7MZjt12pn2a23PTcOJGs" - + "aRFbYGaC-w05U_WVzKIEMz3AB8Ks9oxNW88zReR3I5gbYYPYTcWpeBX5jEX8O54NnuLmVHmCJSbvq70B" - + "KEnYWL9CQW1v4-iTV9gDV57dqZU12bxr3ecZsHbMLzaXPZutPlJjpqC2ol_-oSmOdotbQa6L9LzdVzHf" - + "87S96ZdiZTR6AblWNY_gb31_iK1-0BrK2og9xrat5bg0k9UK5-Jcd3-vZY8mDgK45di8KrgJ7zOLQ6n2" - + "bhiP2to4dujDi88jk7BvQj3DjE8vfVE5b9GGlttHgo7zLeWrSRDw-wXtJvbh-V-wQugP53VGIGczJTS2" - + "58KnMBKB4nF1ow2tGsu4P0EKXzAjE3I_o5_x0fct9lU0o6tEiLygtb0tEWGn3TPq8OKPmFmkHRbpudO7" - + "4Kvh0tgNgImZRUuocrBDr25ZxhfG9p_kcnchue0SyhpmeKvmSyEugZVBkxGVC0jubByiFlsSH_1O1JWF" - + "zzxpmj9SWe5sXZfQ86r6rFSzzKNX9WubikXRxEBakrnFN3nqFVZioQ9TpF_C-4yW7uFAonPAwfiCRn9e" - + "-WwPR4nV-IHlmFyoCCqSZenFCUzV9i_Kn14dJjCnd6ri0B1N5JwnE0Xk1gfkwTbPJ8gORBxwc3aJ_1XV" - + "W55P2vuAszdTI-8CQ9JO9-QzCkekldLAFXPG9he8bjA2KZqeAKB7C39YrA3dh3LW-rtC5kYrpsnOKYY-" - + "BQ9x6Xi0hLNHJUXxk06U21ML4bwBIS9W_A_nD3qOw-3ZDosr8WwIrIKnSwY0vkW9fwL-sRgaiDwYzrlN" - + "zQ9f-FF_oT4CJjMuvgiAeYi8_5-W81nozHvuBIhzz-2J4hSDZ62rdjY9bLT6JpDBI13SibwdRjECz4nK" - + "b3kGXTfnVAZuJog6mzInmVABPPAYso0dTRs8ErLGzlKlmaaEXSyxHPKTHLoNoZqn8fdO-L6S-TXdJu6R" - + "c-1cwePB1FgU_cwOn45jpHSfDGm7GvwAIAETpri3"; + public static final String DONORS = "6y8B02mFk3cOSJIBSEBLlhdPHgj_M8aA4IpF4uh3m2AUxWR47-3UwN6_aVuYkjAzRveHRVbhZfzd3DL0" + + "qEFnwshOvdzxy6_EaXV1DrE22qW1-V5gD_8XxyXnUgJAa1B4Kj7zbudRqwtZGcMSg4Oe1ufR6zvtnkRP" + + "QNpnwj44RGH-3Eoh_pTrbNLvLHMc1TsjC0QZeX4kOoh6dWhScl-V2gXm2lOT2lJqOpfrSHqELLIYkRcy" + + "LjAS3BZHDSwXmvAg6AE9b5njf90p1pFqv6JqK_gXZzw_j0leq5fTGpndGF6OAJssRdixikzW-hMAWqGw" + + "n8BD0dSevQWyGV5pqus7j0WIkdQHZMquyfidCHXgO8M--KCpET9xI6IN8SL3HWqKvBoD0TBer6C9Psk_" + + "1bJVWor6D0ZLvN7ZxhyEorDkDXfU0HOP7jG2MWZoFzW9dz5NNZ8vvwQ85V8snNFOLipNaW_JDXLzYu-c" + + "G3XjFpIBn5McR3saSUHrpBywEkHTGrPU_MQCKSWZcClBN0hkbnQe7u4UMXEHuckLNnOI4AuZzQ9tdTkl" + + "r2p2AHqg5UlqIsnvpVr3bpBOZ6Zk3XPp7_svt9K8zj2LIJNqXbPzcdK-KP8Qwk-7lBfqlWkkgLUxTvpM" + + "PzgSP_zttTBCK0xGcILcGRS21CBLj1ekDX31OQ7BG-u2j07bq-HMF2qVOeyyGV3cCeEki97I2_4y2Nd8" + + "HGWpqA4xKbG0iwUCUlAGTOE7PXk2RaMLV7gvktw6ISksPMDccRJ1Uhl36CKndT0ySR_C1HvXM6yMpUvk" + + "xIFi4jpcS9fFtRMQLmbjR-6zu2AqVyY0ds7EY4YbwPhxddQ9UwWZC4kmuAakjfVRmJyFtR_W58jMCADD" + + "EsGET2uaewRTelIXmV2t2bd7jkr5VO2juJe_X9cH1i-N9hUqv18FQTjPJe8l05NMuXExLE4y8PfMaCpH" + + "jOJ94Qid8KD-f_e4bgfoOUd6Z-cknZEcHq4UpdjarQs-JIbk2wWbfWdoia9OCwGemjO26RXMqhFS1zZz" + + "r8u5VvkV7DXoABvjekt63HQcm7GNxeq4aMXs92LwYIbHmFV-U4ezCzV1ndVtj68Sf1QI6AZ27Cx_mHXf" + + "l6vJqrYlqVzjhRqiEt_-lOviSkhrUrzT43q7cV4VfG0TvGHcy3RmDUGpoTiBArcX76IuSgtIqq1XmNvw" + + "vqVKrJAZVoUAvPRaebMq3rN_tOzo39oD3IikyYcAsPSOQUsb7bIgxVk_M2no4Folg38dawktRZL6GcUG" + + "nRaRkyrKp7sj3YnO7PC9WZtrsUaQJnbpRv4g3JU0VBz7GvBHGmjRQjeyJmIsg_Fpti8s93BwRp2Ydwgr" + + "UtohX-63z76g23HyXqCQ5ym4mqNoWGAvEUT4Wsw-yP0NrK8DBEsOOPSANkXlvaT48U6ORNmWo6qkbhkz" + + "a4Fsa7rcDOeEAAeB3RIms69d4WjLZWSgae8visKyZzf1ct1rxm0wHS7vVzw6S6wY-GMPLURP6ybSuRaN" + + "Pn3fS7ucYLrJjcwqOTzekMphYjoHjKY7jVzt0000"; + + /* + * Special thanks to our sponsors and donors: + * + * - Noam Tamim + */ @Override final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { final UDrawable result = getGraphicStrings(); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, - getMetadata(), null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, getMetadata(), + null, 1.0, HColorUtils.WHITE); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); } @@ -98,22 +110,23 @@ private UDrawable getGraphicStrings() throws IOException { final List cols = getCols(getDonors(), COLS, FREE_LINES); return new UDrawable() { public void drawU(UGraphic ug) { - final TextBlockBackcolored header = GraphicStrings.createBlackOnWhite(Arrays - .asList("Special thanks to our sponsors and donors !")); + final TextBlockBackcolored header = GraphicStrings + .createBlackOnWhite(Arrays.asList("Special thanks to our sponsors and donors !")); header.drawU(ug); final StringBounder stringBounder = ug.getStringBounder(); - ug = ug.apply(new UTranslate(0, header.calculateDimension(stringBounder).getHeight())); + ug = ug.apply(UTranslate.dy(header.calculateDimension(stringBounder).getHeight())); double x = 0; double lastX = 0; double y = 0; for (TextBlock tb : cols) { final Dimension2D dim = tb.calculateDimension(stringBounder); - tb.drawU(ug.apply(new UTranslate(x, 0))); + tb.drawU(ug.apply(UTranslate.dx(x))); lastX = x; x += dim.getWidth() + 10; y = Math.max(y, dim.getHeight()); } - final UImage logo = new UImage(PSystemVersion.getPlantumlImage()); + final UImage logo = new UImage( + new PixelImage(PSystemVersion.getPlantumlImage(), AffineTransformType.TYPE_BILINEAR)); ug.apply(new UTranslate(lastX, y - logo.getHeight())).draw(logo); } }; @@ -131,11 +144,16 @@ public static List getCols(List lines, final int nbCol, final private List getDonors() throws IOException { final List lines = new ArrayList(); - final Transcoder t = new TranscoderImpl(new AsciiEncoder(), new StringCompressorNone(), new CompressionBrotli()); - final String s = t.decode(DONORS).replace('*', '.'); - final StringTokenizer st = new StringTokenizer(s, BackSlash.NEWLINE); - while (st.hasMoreTokens()) { - lines.add(st.nextToken()); + final Transcoder t = TranscoderImpl.utf8(new AsciiEncoder(), new StringCompressorNone(), + new CompressionBrotli()); + try { + final String s = t.decode(DONORS).replace('*', '.'); + final StringTokenizer st = new StringTokenizer(s, BackSlash.NEWLINE); + while (st.hasMoreTokens()) { + lines.add(st.nextToken()); + } + } catch (NoPlantumlCompressionException e) { + e.printStackTrace(); } return lines; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/donors/PSystemDonorsFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/donors/PSystemDonorsFactory.java index d33e79198..bf2afd3aa 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/donors/PSystemDonorsFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/donors/PSystemDonorsFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/donors/PSystemSkinparameterList.java b/src/plantuml-asl/src/net/sourceforge/plantuml/donors/PSystemSkinparameterList.java index d6d5023f1..8a1f150e0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/donors/PSystemSkinparameterList.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/donors/PSystemSkinparameterList.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -42,14 +42,14 @@ import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicStrings; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemSkinparameterList extends AbstractPSystem { @@ -57,8 +57,8 @@ public class PSystemSkinparameterList extends AbstractPSystem { final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { final UDrawable result = getGraphicStrings(); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, - getMetadata(), null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), + false, null, getMetadata(), null, 1.0, HColorUtils.WHITE); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); } @@ -72,7 +72,7 @@ public void drawU(UGraphic ug) { double y = 0; for (TextBlock tb : cols) { final Dimension2D dim = tb.calculateDimension(stringBounder); - tb.drawU(ug.apply(new UTranslate(x, 0))); + tb.drawU(ug.apply(UTranslate.dx(x))); x += dim.getWidth() + 10; y = Math.max(y, dim.getHeight()); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/donors/PSystemSkinparameterListFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/donors/PSystemSkinparameterListFactory.java index 3892aecc0..5a656ce9f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/donors/PSystemSkinparameterListFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/donors/PSystemSkinparameterListFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/EggUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/EggUtils.java index 9857b3fdc..747f48d75 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/EggUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/EggUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/GraphicsPath.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/GraphicsPath.java index 945f35961..f9e7e4d86 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/GraphicsPath.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/GraphicsPath.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,11 +39,11 @@ import net.sourceforge.plantuml.EmptyImageBuilder; import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.png.PngIO; -import net.sourceforge.plantuml.ugraphic.ColorMapper; -import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.ugraphic.UChange; import net.sourceforge.plantuml.ugraphic.UMotif; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d; public class GraphicsPath { @@ -63,14 +63,14 @@ public ImageData writeImage(OutputStream os) throws IOException { } private BufferedImage createImage() { - final EmptyImageBuilder builder = new EmptyImageBuilder(50, 50, Color.WHITE); + final EmptyImageBuilder builder = new EmptyImageBuilder(null, 50, 50, Color.WHITE); final BufferedImage im = builder.getBufferedImage(); final Graphics2D g2d = builder.getGraphics2D(); final UGraphicG2d ug = new UGraphicG2d(colorMapper, g2d, 1.0); ug.setBufferedImage(im); final UMotif motif = new UMotif(path); - motif.drawHorizontal(ug.apply(new UChangeColor(HtmlColorUtils.BLACK)), 20, 20, 1); + motif.drawHorizontal(ug.apply((UChange) HColorUtils.BLACK), 20, 20, 1); g2d.dispose(); return im; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemAppleTwo.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemAppleTwo.java index 8d146bb49..b6fa75b2d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemAppleTwo.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemAppleTwo.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,8 +43,8 @@ import net.sourceforge.plantuml.graphic.GraphicPosition; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.version.PSystemVersion; public class PSystemAppleTwo extends AbstractPSystem { @@ -63,8 +63,8 @@ public PSystemAppleTwo() throws IOException { final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { final TextBlockBackcolored result = getGraphicStrings(); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, result.getBackcolor(), - getMetadata(), null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), + false, null, getMetadata(), null, 1.0, result.getBackcolor()); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemAppleTwoFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemAppleTwoFactory.java index 7c5732059..41931b79f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemAppleTwoFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemAppleTwoFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemCharlie.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemCharlie.java index fdc8c7c41..9e8e59b43 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemCharlie.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemCharlie.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,12 +38,14 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.AffineTransformType; +import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.version.PSystemVersion; public class PSystemCharlie extends AbstractPSystem { @@ -57,12 +59,12 @@ public class PSystemCharlie extends AbstractPSystem { @Override final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.BLACK, - getMetadata(), null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, getMetadata(), + null, 1.0, HColorUtils.BLACK); imageBuilder.setUDrawable(new UDrawable() { public void drawU(UGraphic ug) { - final UImage im = new UImage(image); + final UImage im = new UImage(new PixelImage(image, AffineTransformType.TYPE_BILINEAR)); ug.draw(im); } }); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemCharlieFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemCharlieFactory.java index 073c0d8b5..f4dea514d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemCharlieFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemCharlieFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemColors.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemColors.java index 11ab2cea8..0ccb7f520 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemColors.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemColors.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -50,29 +50,27 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +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; // http://www.redblobgames.com/grids/hexagons/ public class PSystemColors extends AbstractPSystem implements UDrawable { private final double rectangleHeight = 28; private final double rectangleWidth = 175; - private final HtmlColorSetSimple colors = new HtmlColorSetSimple(); + private final HColorSet colors = HColorSet.instance(); private final String paletteCentralColor; private final double size = 60; @@ -87,8 +85,8 @@ public PSystemColors(String option) { @Override final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, - getMetadata(), null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), + false, null, getMetadata(), null, 1.0, HColorUtils.WHITE); imageBuilder.setUDrawable(this); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); } @@ -98,7 +96,7 @@ public DiagramDescription getDescription() { } public void drawU(UGraphic ug) { - if (colors.getColorIfValid(paletteCentralColor) instanceof HtmlColorSimple) { + if (colors.getColorIfValid(paletteCentralColor) instanceof HColorSimple) { drawPalette(ug); } else { drawFull(ug); @@ -149,7 +147,7 @@ private double getWidth() { } private void drawOneHexa(UGraphic ug, String colorName, int i, int j, UPolygon hexa) { - final HtmlColorSimple color = (HtmlColorSimple) colors.getColorIfValid(colorName); + final HColorSimple color = (HColorSimple) colors.getColorIfValid(colorName); ug = applyColor(ug, color); ug = ug.apply(new UTranslate(centerHexa(i, j))); ug.draw(hexa); @@ -173,7 +171,7 @@ private String findShortest(StringBounder stringBounder, UFont font, String colo continue; } final String candidat = colorName.substring(0, i) + BackSlash.BS_BS_N + colorName.substring(i); - final TextBlock tt = getTextName(font, candidat, (HtmlColorSimple) HtmlColorUtils.BLACK); + final TextBlock tt = getTextName(font, candidat, (HColorSimple) HColorUtils.BLACK); final double width = tt.calculateDimension(stringBounder).getWidth(); if (width < min) { result = candidat; @@ -183,8 +181,8 @@ private String findShortest(StringBounder stringBounder, UFont font, String colo return result; } - private UGraphic applyColor(UGraphic ug, HtmlColor color) { - return ug.apply(new UChangeColor(color)).apply(new UChangeBackColor(color)); + private UGraphic applyColor(UGraphic ug, HColor color) { + return ug.apply(color).apply(color.bg()); } private Point2D corner(int i) { @@ -230,11 +228,11 @@ private boolean containsCaseInsensitive(Collection source, String target } private Comparator closeComparator(String center) { - final HtmlColorSimple centerColor = (HtmlColorSimple) colors.getColorIfValid(center); + final HColorSimple centerColor = (HColorSimple) colors.getColorIfValid(center); return new Comparator() { public int compare(String col1, String col2) { - final double dist1 = centerColor.distance((HtmlColorSimple) colors.getColorIfValid(col1)); - final double dist2 = centerColor.distance((HtmlColorSimple) colors.getColorIfValid(col2)); + final double dist1 = centerColor.distance((HColorSimple) colors.getColorIfValid(col1)); + final double dist2 = centerColor.distance((HColorSimple) colors.getColorIfValid(col2)); return (int) Math.signum(dist1 - dist2); } }; @@ -243,12 +241,12 @@ public int compare(String col1, String col2) { private void drawFull(UGraphic ug) { final UFont font = UFont.sansSerif(14).bold(); - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); + ug = ug.apply(HColorUtils.BLACK); int i = 0; int j = 0; for (String name : colors.names()) { UGraphic tmp = getPositioned(ug, i, j); - final HtmlColorSimple color = (HtmlColorSimple) colors.getColorIfValid(name); + final HColorSimple color = (HColorSimple) colors.getColorIfValid(name); applyColor(tmp, color).draw(new URectangle(rectangleWidth, rectangleHeight)); final TextBlock tt = getTextName(font, name, color); final Dimension2D dimText = tt.calculateDimension(ug.getStringBounder()); @@ -262,9 +260,9 @@ private void drawFull(UGraphic ug) { } } - private TextBlock getTextName(final UFont font, String name, final HtmlColorSimple color) { - final HtmlColorSimple opposite = color.opposite(); - final FontConfiguration fc = new FontConfiguration(font, opposite, HtmlColorUtils.BLUE, true); + private TextBlock getTextName(final UFont font, String name, final HColorSimple color) { + final HColorSimple opposite = color.opposite(); + final FontConfiguration fc = new FontConfiguration(font, opposite, HColorUtils.BLUE, true); final TextBlock tt = Display.getWithNewlines(name).create(fc, HorizontalAlignment.CENTER, new SpriteContainerEmpty()); return tt; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemColorsFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemColorsFactory.java index 42970eca3..00157b5ba 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemColorsFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemColorsFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemEgg.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemEgg.java index d7fecf39c..b547ceddf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemEgg.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemEgg.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -42,8 +42,8 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemEgg extends AbstractPSystem { @@ -60,8 +60,8 @@ public class PSystemEgg extends AbstractPSystem { final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { final TextBlockBackcolored result = getGraphicStrings(); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, result.getBackcolor(), - getMetadata(), null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), + false, null, getMetadata(), null, 1.0, result.getBackcolor()); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemEggFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemEggFactory.java index 1d2d4cb95..379f83fba 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemEggFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemEggFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemLost.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemLost.java index 8d96c2bd3..fbe56cb75 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemLost.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemLost.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,8 +41,8 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemLost extends AbstractPSystem { @@ -56,8 +56,8 @@ public PSystemLost() { final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { final TextBlockBackcolored result = getGraphicStrings(); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, result.getBackcolor(), - getMetadata(), null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), + false, null, getMetadata(), null, 1.0, result.getBackcolor()); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemLostFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemLostFactory.java index 3464e6867..88c8d44e6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemLostFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemLostFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemPath.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemPath.java index c63762161..d32972db6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemPath.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemPath.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,7 +37,7 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemPath extends AbstractPSystem { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemPathFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemPathFactory.java index c055d28db..653b097a7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemPathFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemPathFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemRIP.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemRIP.java index 1cc90037e..dab5a6ced 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemRIP.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemRIP.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,17 +38,16 @@ import java.util.ArrayList; import java.util.List; -import javax.imageio.ImageIO; - import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicPosition; import net.sourceforge.plantuml.graphic.GraphicStrings; +import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemRIP extends AbstractPSystem { @@ -76,8 +75,8 @@ public PSystemRIP() throws IOException { final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { final TextBlockBackcolored result = getGraphicStrings(); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, result.getBackcolor(), - getMetadata(), null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), + false, null, getMetadata(), null, 1.0, result.getBackcolor()); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemRIPFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemRIPFactory.java index 4d2a3cc29..c29798be7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemRIPFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemRIPFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemWelcome.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemWelcome.java index 3629e4982..ab72b2764 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemWelcome.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemWelcome.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -42,8 +42,8 @@ import net.sourceforge.plantuml.graphic.GraphicPosition; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.version.PSystemVersion; public class PSystemWelcome extends AbstractPSystem { @@ -66,7 +66,7 @@ public PSystemWelcome(GraphicPosition position) { strings.add(" "); strings.add("\"\"class Example\"\""); strings.add(" "); - strings.add("You will find more information about PlantUML syntax on http://plantuml.com"); + strings.add("You will find more information about PlantUML syntax on https://plantuml.com"); if (position == GraphicPosition.BACKGROUND_CORNER_BOTTOM_RIGHT) { strings.add(" "); strings.add(" "); @@ -79,8 +79,8 @@ public PSystemWelcome(GraphicPosition position) { final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { final TextBlockBackcolored result = getGraphicStrings(); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, result.getBackcolor(), - getMetadata(), null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), + false, null, getMetadata(), null, 1.0, result.getBackcolor()); imageBuilder.setUDrawable(result); // imageBuilder.setUDrawable(TextBlockUtils.withMargin(result, 4, 4)); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemWelcomeFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemWelcomeFactory.java index 989037df4..daadd5dec 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemWelcomeFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/PSystemWelcomeFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/SentenceDecoder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/SentenceDecoder.java index 6bd90422d..4aada3aab 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/SentenceDecoder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/SentenceDecoder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/SentenceProducer.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/SentenceProducer.java index 9dc884840..9a2f9f2ad 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/SentenceProducer.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eggs/SentenceProducer.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/EpsGraphics.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/EpsGraphics.java index 1016b7ded..e342edf88 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/EpsGraphics.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/EpsGraphics.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,12 +38,12 @@ import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.Log; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.ShadowManager; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.USegment; import net.sourceforge.plantuml.ugraphic.USegmentType; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; import net.sourceforge.plantuml.utils.MathUtils; import net.sourceforge.plantuml.version.Version; @@ -92,8 +92,8 @@ public EpsGraphics() { true)); roundrect.add(new PostScriptCommandRaw( "2 index 5 index add 1 index sub 2 index 5 index add 2 index sub 2 index 0 90 arc", true)); - roundrect.add(new PostScriptCommandRaw("dup 3 index add 2 index 5 index add 2 index sub 2 index 90 180 arc", - true)); + roundrect.add( + new PostScriptCommandRaw("dup 3 index add 2 index 5 index add 2 index sub 2 index 90 180 arc", true)); roundrect.add(new PostScriptCommandRaw("pop pop pop pop pop ", true)); } @@ -213,10 +213,6 @@ private boolean isDashed3() { return dashSpace != 0 && dashVisible != 0; } - private boolean isDashed4() { - return dashSpace == 0 && dashVisible == 0; - } - public void closepathDot() { final boolean dashed = isDashed(); append("stroke", true); @@ -290,6 +286,8 @@ public void epsPath(double x, double y, UPath path) { curvetoNoMacro(coord[0] + x, coord[1] + y, coord[2] + x, coord[3] + y, coord[4] + x, coord[5] + y); } else if (type == USegmentType.SEG_CLOSE) { // Nothing + } else if (type == USegmentType.SEG_ARCTO) { + // Nothing } else { Log.println("unknown1 " + seg); } @@ -314,6 +312,8 @@ public void epsPath(double x, double y, UPath path) { curvetoNoMacro(coord[0] + x, coord[1] + y, coord[2] + x, coord[3] + y, coord[4] + x, coord[5] + y); } else if (type == USegmentType.SEG_CLOSE) { // Nothing + } else if (type == USegmentType.SEG_ARCTO) { + // Nothing } else { Log.println("unknown2 " + seg); } @@ -323,9 +323,9 @@ public void epsPath(double x, double y, UPath path) { } - public void epsPolygon(HtmlColorGradient gr, ColorMapper mapper, double... points) { + public void epsPolygon(HColorGradient gr, ColorMapper mapper, double... points) { assert points.length % 2 == 0; - setFillColor(mapper.getMappedColor(gr.getColor1())); + setFillColor(mapper.toColor(gr.getColor1())); epsPolygon(points); } @@ -396,8 +396,8 @@ public void epsRectangle(double x, double y, double width, double height, double } } - public void epsRectangle(double x, double y, double width, double height, double rx, double ry, - HtmlColorGradient gr, ColorMapper mapper) { + public void epsRectangle(double x, double y, double width, double height, double rx, double ry, HColorGradient gr, + ColorMapper mapper) { checkCloseDone(); ensureVisible(x, y); ensureVisible(x + width, y + height); @@ -405,8 +405,8 @@ public void epsRectangle(double x, double y, double width, double height, double if (rx == 0 && ry == 0) { simplerectUsed = true; - appendColorShort(mapper.getMappedColor(gr.getColor1())); - appendColorShort(mapper.getMappedColor(gr.getColor2())); + appendColorShort(mapper.toColor(gr.getColor1())); + appendColorShort(mapper.toColor(gr.getColor2())); append(format(width) + " " + format(height) + " " + format(x) + " " + format(y), true); append("100 -1 1 {", true); append("100 div", true); @@ -428,8 +428,8 @@ public void epsRectangle(double x, double y, double width, double height, double append("initclip", true); } else { roundrectUsed = true; - appendColorShort(mapper.getMappedColor(gr.getColor1())); - appendColorShort(mapper.getMappedColor(gr.getColor2())); + appendColorShort(mapper.toColor(gr.getColor1())); + appendColorShort(mapper.toColor(gr.getColor2())); append(format(width) + " " + format(height) + " " + format(x) + " " + format(y) + " " + format((rx + ry) / 2), true); append("100 -1 1 {", true); @@ -476,15 +476,21 @@ private void simpleRectangle(double x, double y, double width, double height, bo if (isDashed3()) { append("[" + dashSpace + " " + dashVisible + "] 0 setdash", true); } - if (isDashed4() || fill) { - append(format(width) + " " + format(height) + " " + format(x) + " " + format(y) + " simplerect", true); - simplerectUsed = true; - // } else { - // epsVLine(y, x, x + width); - // epsVLine(y + height, x, x + width); - // epsHLine(x, y, y + height); - // epsHLine(x + width, y, y + height); - } + // if (isDashed3() || fill) { + append(format(width) + " " + format(height) + " " + format(x) + " " + format(y) + " simplerect", true); + simplerectUsed = true; + // } + } + + /** + * Converts a counter clockwise angle to a clockwise angle. i.e. 0 -> 360, 90 -> + * 270, 180 -> 180, 270 -> 90 + * + * @param counterClockwise counter clockwise angle in degrees + * @return clockwise angle in degrees + */ + private int convertToClockwiseAngle(double counterClockwise) { + return (int) (360.0 - counterClockwise); } public void epsEllipse(double x, double y, double xRadius, double yRadius, double start, double extend) { @@ -499,7 +505,8 @@ public void epsEllipse(double x, double y, double xRadius, double yRadius, doubl // if (fillcolor != null) { // appendColor(fillcolor); // append("newpath", true); - // append(format(x) + " " + format(y / scale) + " " + format(xRadius) + " 0 360 arc", true); + // append(format(x) + " " + format(y / scale) + " " + format(xRadius) + " 0 360 + // arc", true); // append("closepath eofill", true); // } @@ -507,10 +514,10 @@ public void epsEllipse(double x, double y, double xRadius, double yRadius, doubl append(strokeWidth + " setlinewidth", true); appendColor(color); append("newpath", true); - final double a1 = -start + 180 + 5; - final double a2 = -start - extend + 180 - 5; - append(format(x) + " " + format(y / scale) + " " + format(xRadius) + " " + format(a1) + " " + format(a2) - + " arc", true); + + final double a1 = convertToClockwiseAngle(start + extend); + final double a2 = convertToClockwiseAngle(start); + append(format(x) + " " + format(y / scale) + " " + format(xRadius) + " " + a1 + " " + a2 + " arc", true); append("stroke", true); } @@ -617,8 +624,8 @@ final public void movetoNoMacro(double x1, double y1) { } final public void curvetoNoMacro(double x1, double y1, double x2, double y2, double x3, double y3) { - append(format(x1) + " " + format(y1) + " " + format(x2) + " " + format(y2) + " " + format(x3) + " " - + format(y3) + " curveto", true); + append(format(x1) + " " + format(y1) + " " + format(x2) + " " + format(y2) + " " + format(x3) + " " + format(y3) + + " curveto", true); ensureVisible(x1, y1); ensureVisible(x2, y2); ensureVisible(x3, y3); @@ -636,16 +643,16 @@ public void lineto(double x1, double y1) { } public void curveto(double x1, double y1, double x2, double y2, double x3, double y3) { - append(format(x1) + " " + format(y1) + " " + format(x2) + " " + format(y2) + " " + format(x3) + " " - + format(y3) + " curveto", true); + append(format(x1) + " " + format(y1) + " " + format(x2) + " " + format(y2) + " " + format(x3) + " " + format(y3) + + " curveto", true); ensureVisible(x1, y1); ensureVisible(x2, y2); ensureVisible(x3, y3); } public void quadto(double x1, double y1, double x2, double y2) { - append(format(x1) + " " + format(y1) + " " + format(x1) + " " + format(y1) + " " + format(x2) + " " - + format(y2) + " curveto", true); + append(format(x1) + " " + format(y1) + " " + format(x1) + " " + format(y1) + " " + format(x2) + " " + format(y2) + + " curveto", true); ensureVisible(x1, y1); ensureVisible(x2, y2); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/EpsGraphicsMacro.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/EpsGraphicsMacro.java index a694a699b..37790b1df 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/EpsGraphicsMacro.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/EpsGraphicsMacro.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/EpsGraphicsMacroAndText.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/EpsGraphicsMacroAndText.java index ab099866e..658d45a31 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/EpsGraphicsMacroAndText.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/EpsGraphicsMacroAndText.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/EpsStrategy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/EpsStrategy.java index 00119a654..7d17ee264 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/EpsStrategy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/EpsStrategy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommand.java index dae436fe1..e385a826d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommand.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandCurveTo.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandCurveTo.java index cb5b7fa89..a51048349 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandCurveTo.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandCurveTo.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandLineTo.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandLineTo.java index d18af52c7..fed29ee0f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandLineTo.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandLineTo.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandMacro.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandMacro.java index a506cf5a8..30a52d437 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandMacro.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandMacro.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandMoveTo.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandMoveTo.java index 1a4a58b42..b4209f87a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandMoveTo.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandMoveTo.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandQuadTo.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandQuadTo.java index df8f65c41..f5cc3e972 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandQuadTo.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandQuadTo.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandRaw.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandRaw.java index bb1826c1f..620de678c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandRaw.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptCommandRaw.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptData.java b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptData.java index 10af6b27d..e23dc7d11 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptData.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/eps/PostScriptData.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/error/PSystemError.java b/src/plantuml-asl/src/net/sourceforge/plantuml/error/PSystemError.java index b1c38d542..5eb5e6421 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/error/PSystemError.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/error/PSystemError.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,7 +36,6 @@ import java.awt.image.BufferedImage; import java.io.IOException; import java.io.OutputStream; -import java.io.PrintStream; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -66,27 +65,32 @@ import net.sourceforge.plantuml.graphic.GraphicPosition; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockRaw; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.VerticalAlignment; +import net.sourceforge.plantuml.security.SecurityUtils; +import net.sourceforge.plantuml.svek.GraphvizCrash; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.AffineTransformType; +import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +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; import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt; import net.sourceforge.plantuml.version.LicenseInfo; import net.sourceforge.plantuml.version.PSystemVersion; +import net.sourceforge.plantuml.version.Version; public abstract class PSystemError extends AbstractPSystem { @@ -118,23 +122,32 @@ final public String getWarningOrError() { } private TextBlockBackcolored getGraphicalFormatted() { - final FontConfiguration fc0 = GraphicStrings.sansSerif14(HtmlColorUtils.BLACK).bold(); - final FontConfiguration fc1 = GraphicStrings.sansSerif14(HtmlColorUtils.MY_GREEN).bold(); - final FontConfiguration fc2 = GraphicStrings.sansSerif14(HtmlColorUtils.RED).bold(); + final FontConfiguration fc0 = GraphicStrings.sansSerif14(HColorUtils.BLACK).bold(); + final FontConfiguration fc1 = GraphicStrings.sansSerif14(HColorUtils.MY_GREEN).bold(); + final FontConfiguration fc2 = GraphicStrings.sansSerif14(HColorUtils.RED).bold(); + final FontConfiguration fc4 = GraphicStrings.sansSerif12(HColorUtils.MY_GREEN).bold().italic(); final List fullBody = getTextFullBody(); final TextBlock result0 = TextBlockUtils.addBackcolor( - TextBlockUtils.withMargin(new TextBlockRaw(getTextFromStack(), fc0), 1, 1, 1, 4), - HtmlColorUtils.MY_GREEN); + TextBlockUtils.withMargin(new TextBlockRaw(getTextFromStack(), fc0), 1, 1, 1, 4), HColorUtils.MY_GREEN); final TextBlock result1 = new TextBlockRaw(allButLast(fullBody), fc1); - final TextBlock result2 = new TextBlockRaw(onlyLast(fullBody), fc1.wave(HtmlColorUtils.RED)); + final TextBlock result2 = new TextBlockRaw(onlyLast(fullBody), fc1.wave(HColorUtils.RED)); final TextBlock result3 = new TextBlockRaw(getTextError(), fc2); + final TextBlock result4 = TextBlockUtils.withMargin(new TextBlockRaw(header(), fc4), 0, 2, 0, 8); TextBlock result = result0; result = TextBlockUtils.mergeTB(result, result1, HorizontalAlignment.LEFT); result = TextBlockUtils.mergeTB(result, result2, HorizontalAlignment.LEFT); result = TextBlockUtils.mergeTB(result, result3, HorizontalAlignment.LEFT); + result = TextBlockUtils.mergeTB(result4, result, HorizontalAlignment.LEFT); result = TextBlockUtils.withMargin(result, 5, 5); - return TextBlockUtils.addBackcolor(result, HtmlColorUtils.BLACK); + return TextBlockUtils.addBackcolor(result, HColorUtils.BLACK); + } + + private List header() { + final List result = new ArrayList(); + result.add("PlantUML " + Version.versionString()); + GraphvizCrash.checkOldVersionWarning(result); + return result; } private List getPureAsciiFormatted() { @@ -200,16 +213,16 @@ final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatO final UGraphicTxt ugt = new UGraphicTxt(); final UmlCharArea area = ugt.getCharArea(); area.drawStringsLR(getPureAsciiFormatted(), 0, 0); - area.print(new PrintStream(os)); + area.print(SecurityUtils.createPrintStream(os)); return new ImageDataSimple(1, 1); } - // final boolean useRed = fileFormat.isUseRedForError(); final TextBlockBackcolored result = getGraphicalFormatted(); TextBlock udrawable; - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, result.getBackcolor(), - getMetadata(), null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, getMetadata(), + null, 1.0, result.getBackcolor()); + imageBuilder.setRandomPixel(true); if (getSource().getTotalLineCount() < 5) { udrawable = addWelcome(result); } else { @@ -217,11 +230,11 @@ final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatO } final int min = (int) (System.currentTimeMillis() / 60000L) % 60; // udrawable = addMessageAdopt(udrawable); - if (min == 1 || min == 8) { + if (min == 1 || min == 8 || min == 13 || min == 55) { udrawable = addMessagePatreon(udrawable); } else if (min == 15) { udrawable = addMessageLiberapay(udrawable); - } else if (min == 30) { + } else if (min == 30 || min == 39 || min == 48) { udrawable = addMessageDedication(udrawable); } else if (getSource().containsIgnoreCase("arecibo")) { udrawable = addMessageArecibo(udrawable); @@ -238,13 +251,6 @@ private void append(List result, LineLocation lineLocation) { } } - // private String getRed(boolean useRed) { - // if (useRed) { - // return "#CD0A0A"; - // } - // return "red"; - // } - // final public DiagramDescription getDescription() { return new DiagramDescription("(Error)"); } @@ -305,29 +311,30 @@ private TextBlock addMessageAdopt(final TextBlock source) throws IOException { } private TextBlock addMessageArecibo(final TextBlock source) throws IOException { - final UImage message = new UImage(PSystemVersion.getArecibo()); + final UImage message = new UImage( + new PixelImage(PSystemVersion.getArecibo(), AffineTransformType.TYPE_BILINEAR)); TextBlock result = TextBlockUtils.mergeLR(source, TextBlockUtils.fromUImage(message), VerticalAlignment.TOP); return result; } private TextBlockBackcolored getMessageDedication() { final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils(); - final HtmlColorSimple backColor = (HtmlColorSimple) new HtmlColorSetSimple().getColorIfValid("#eae2c9"); + final HColorSimple backColor = (HColorSimple) HColorSet.instance().getColorIfValid("#eae2c9"); - final BufferedImage qrcode = smaller(utils.exportFlashcode("http://plantuml.com/dedication", Color.BLACK, - backColor.getColor999())); + final BufferedImage qrcode = smaller( + utils.exportFlashcode("http://plantuml.com/dedication", Color.BLACK, backColor.getColor999())); final Display disp = Display.create("Add your own dedication into PlantUML", " ", "For just $5 per month!", "Details on [[http://plantuml.com/dedication]]"); final UFont font = UFont.sansSerif(14); - final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK, false); - final TextBlock text = TextBlockUtils.withMargin( - disp.create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty()), 10, 0); + final FontConfiguration fc = new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); + final TextBlock text = TextBlockUtils + .withMargin(disp.create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty()), 10, 0); final TextBlock result; if (qrcode == null) { result = text; } else { - final UImage qr = new UImage(qrcode).scaleNearestNeighbor(3); + final UImage qr = new UImage(new PixelImage(qrcode, AffineTransformType.TYPE_NEAREST_NEIGHBOR)).scale(3); result = TextBlockUtils.mergeLR(text, TextBlockUtils.fromUImage(qr), VerticalAlignment.CENTER); } return TextBlockUtils.addBackcolor(result, backColor); @@ -335,15 +342,15 @@ private TextBlockBackcolored getMessageDedication() { } private TextBlockBackcolored getMessageAdopt() { - final HtmlColorSimple backColor = (HtmlColorSimple) new HtmlColorSetSimple().getColorIfValid("#eff4d2"); + final HColorSimple backColor = (HColorSimple) HColorSet.instance().getColorIfValid("#eff4d2"); final Display disp = Display.create("Adopt-a-Word and put your message here!", " ", "Details on [[http://plantuml.com/adopt]]", " "); final UFont font = UFont.sansSerif(14); - final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK, false); - final TextBlock text = TextBlockUtils.withMargin( - disp.create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty()), 10, 0); + final FontConfiguration fc = new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); + final TextBlock text = TextBlockUtils + .withMargin(disp.create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty()), 10, 0); final TextBlock result; result = text; return TextBlockUtils.addBackcolor(result, backColor); @@ -351,26 +358,28 @@ private TextBlockBackcolored getMessageAdopt() { } private TextBlockBackcolored getMessagePatreon() { - final UImage message = new UImage(PSystemVersion.getTime01()); - final Color back = new Color(message.getImage().getRGB(0, 0)); - final HtmlColor backColor = new HtmlColorSimple(back, false); + final UImage message = new UImage( + new PixelImage(PSystemVersion.getTime01(), AffineTransformType.TYPE_BILINEAR)); + final Color back = new Color(message.getImage(1).getRGB(0, 0)); + final HColor backColor = new HColorSimple(back, false); final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils(); - final BufferedImage qrcode = smaller(utils.exportFlashcode("http://plantuml.com/patreon", Color.BLACK, - Color.WHITE)); + final BufferedImage qrcode = smaller( + utils.exportFlashcode("http://plantuml.com/patreon", Color.BLACK, Color.WHITE)); final int scale = 2; final double imWidth = message.getWidth() + (qrcode == null ? 0 : qrcode.getWidth() * scale + 20); - final double imHeight = qrcode == null ? message.getHeight() : Math.max(message.getHeight(), qrcode.getHeight() - * scale + 10); + final double imHeight = qrcode == null ? message.getHeight() + : Math.max(message.getHeight(), qrcode.getHeight() * scale + 10); return new TextBlockBackcolored() { public void drawU(UGraphic ug) { if (qrcode == null) { ug.apply(new UTranslate(1, 1)).draw(message); } else { - final UImage qr = new UImage(qrcode).scaleNearestNeighbor(scale); + final UImage qr = new UImage(new PixelImage(qrcode, AffineTransformType.TYPE_NEAREST_NEIGHBOR)) + .scale(scale); ug.apply(new UTranslate(1, (imHeight - message.getHeight()) / 2)).draw(message); ug.apply(new UTranslate(1 + message.getWidth(), (imHeight - qr.getHeight()) / 2)).draw(qr); } @@ -388,7 +397,7 @@ public MinMax getMinMax(StringBounder stringBounder) { return MinMax.fromMax(imWidth + 1, imHeight + 1); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return backColor; } }; @@ -396,9 +405,10 @@ public HtmlColor getBackcolor() { } private TextBlockBackcolored getMessageLiberapay() { - final UImage message = new UImage(PSystemVersion.getTime15()); - final Color back = new Color(message.getImage().getRGB(0, 0)); - final HtmlColor backColor = new HtmlColorSimple(back, false); + final UImage message = new UImage( + new PixelImage(PSystemVersion.getTime15(), AffineTransformType.TYPE_BILINEAR)); + final Color back = new Color(message.getImage(1).getRGB(0, 0)); + final HColor backColor = new HColorSimple(back, false); final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils(); final BufferedImage qrcode = smaller(utils.exportFlashcode("http://plantuml.com/lp", Color.BLACK, Color.WHITE)); @@ -406,15 +416,16 @@ private TextBlockBackcolored getMessageLiberapay() { final int scale = 2; final double imWidth = message.getWidth() + (qrcode == null ? 0 : qrcode.getWidth() * scale + 20); - final double imHeight = qrcode == null ? message.getHeight() : Math.max(message.getHeight(), qrcode.getHeight() - * scale + 10); + final double imHeight = qrcode == null ? message.getHeight() + : Math.max(message.getHeight(), qrcode.getHeight() * scale + 10); return new TextBlockBackcolored() { public void drawU(UGraphic ug) { if (qrcode == null) { ug.apply(new UTranslate(1, 1)).draw(message); } else { - final UImage qr = new UImage(qrcode).scaleNearestNeighbor(scale); + final UImage qr = new UImage(new PixelImage(qrcode, AffineTransformType.TYPE_NEAREST_NEIGHBOR)) + .scale(scale); ug.apply(new UTranslate(1, (imHeight - message.getHeight()) / 2)).draw(message); ug.apply(new UTranslate(1 + message.getWidth(), (imHeight - qr.getHeight()) / 2)).draw(qr); } @@ -432,7 +443,7 @@ public MinMax getMinMax(StringBounder stringBounder) { return MinMax.fromMax(imWidth + 1, imHeight + 1); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return backColor; } }; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/error/PSystemErrorPreprocessor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/error/PSystemErrorPreprocessor.java index a38334e81..b1d38931b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/error/PSystemErrorPreprocessor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/error/PSystemErrorPreprocessor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/error/PSystemErrorUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/error/PSystemErrorUtils.java index 3aeed9256..0fcc3060d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/error/PSystemErrorUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/error/PSystemErrorUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/error/PSystemErrorV2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/error/PSystemErrorV2.java index e432f8982..e541c49ff 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/error/PSystemErrorV2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/error/PSystemErrorV2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractFunction.java b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractFunction.java index 45e6dbdfd..3ef93be7d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractFunction.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractFunction.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractLazyFunction.java b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractLazyFunction.java index ff104a137..243d803db 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractLazyFunction.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractLazyFunction.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractLazyOperator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractLazyOperator.java index 31a3bc5a5..7bdb17d8d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractLazyOperator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractLazyOperator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractOperator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractOperator.java index 5ff318a01..69901970c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractOperator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractOperator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractUnaryOperator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractUnaryOperator.java index dfa2c94cb..cde43edf4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractUnaryOperator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/AbstractUnaryOperator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Expression.java b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Expression.java index a1bd4c801..9e59e1bef 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Expression.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Expression.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Function.java b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Function.java index 0a0bd04d7..8b367cb67 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Function.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Function.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/LazyFunction.java b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/LazyFunction.java index 491c3c769..66fbb027b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/LazyFunction.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/LazyFunction.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/LazyOperator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/LazyOperator.java index b7dfdec5b..2b067d667 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/LazyOperator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/LazyOperator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/NString.java b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/NString.java index 22079b173..89887b495 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/NString.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/NString.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Operator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Operator.java index 56059f1d9..102363722 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Operator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Operator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Snipset1.java b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Snipset1.java index 748bc6a62..ec49af05c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Snipset1.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Snipset1.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Snipset2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Snipset2.java index 542a678e6..4cf6a33fb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Snipset2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Snipset2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Snipset3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Snipset3.java index 58a402f1f..de9b2eb36 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Snipset3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/evalex/Snipset3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/flashcode/FlashCodeFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/flashcode/FlashCodeFactory.java index 372c95c3d..7b688c52c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/flashcode/FlashCodeFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/flashcode/FlashCodeFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/flashcode/FlashCodeUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/flashcode/FlashCodeUtils.java index 9cc592565..13b7c0226 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/flashcode/FlashCodeUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/flashcode/FlashCodeUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/flashcode/FlashCodeUtilsNone.java b/src/plantuml-asl/src/net/sourceforge/plantuml/flashcode/FlashCodeUtilsNone.java index 961d555d7..371b4bdee 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/flashcode/FlashCodeUtilsNone.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/flashcode/FlashCodeUtilsNone.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/ActivityBox.java b/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/ActivityBox.java index a148d44b2..20d16f79b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/ActivityBox.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/ActivityBox.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,17 +39,15 @@ import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.Shadowable; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class ActivityBox extends AbstractTextBlock { @@ -88,9 +86,9 @@ public void drawU(UGraphic ug) { final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final Shadowable rect = new URectangle(widthTotal, heightTotal, CORNER, CORNER); - ug = ug.apply(new UChangeColor(HtmlColorUtils.MY_RED)); - ug = ug.apply(new UChangeBackColor(HtmlColorUtils.MY_YELLOW)); + final Shadowable rect = new URectangle(widthTotal, heightTotal).rounded(CORNER); + ug = ug.apply(HColorUtils.MY_RED); + ug = ug.apply(HColorUtils.MY_YELLOW.bg()); ug.apply(new UStroke(1.5)).draw(rect); tb.drawU(ug.apply(new UTranslate(MARGIN, MARGIN))); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/CommandLineSimple.java b/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/CommandLineSimple.java index 15db767f7..4b459d75b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/CommandLineSimple.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/CommandLineSimple.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/CommandLink.java b/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/CommandLink.java index a718fa968..9b07f7c25 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/CommandLink.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/CommandLink.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/FlowDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/FlowDiagram.java index 3e11a3c7a..6321ea632 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/FlowDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/FlowDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -52,20 +52,18 @@ import net.sourceforge.plantuml.golem.TileArea; import net.sourceforge.plantuml.golem.TileGeometry; import net.sourceforge.plantuml.golem.TilesField; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.MinMax; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicUtils; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class FlowDiagram extends UmlDiagram implements TextBlock { @@ -121,7 +119,7 @@ private Tile getTileById(String id) { @Override protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - UGraphicUtils.writeImage(os, null, fileFormatOption, seed(), new ColorMapperIdentity(), HtmlColorUtils.WHITE, + UGraphicUtils.writeImage(os, null, fileFormatOption, seed(), new ColorMapperIdentity(), HColorUtils.WHITE, this); return ImageDataSimple.ok(); } @@ -145,8 +143,8 @@ public void drawU(UGraphic ug) { box.drawU(ug.apply(new UTranslate((x + xmin * SINGLE_SIZE_X + deltaX / 2), (y + ymin * SINGLE_SIZE_Y + deltaY / 2)))); } - ug = ug.apply(new UChangeColor(HtmlColorUtils.MY_RED)); - ug = ug.apply(new UChangeBackColor(HtmlColorUtils.MY_RED)); + ug = ug.apply(HColorUtils.MY_RED); + ug = ug.apply(HColorUtils.MY_RED.bg()); final UShape arrow = new UEllipse(7, 7); for (Path p : field.getPaths()) { final TileArea start = p.getStart(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/FlowDiagramFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/FlowDiagramFactory.java index f1fdbfcb8..84a84fa7a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/FlowDiagramFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/flowdiagram/FlowDiagramFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/font/PSystemListFonts.java b/src/plantuml-asl/src/net/sourceforge/plantuml/font/PSystemListFonts.java index 2ab5854d6..5b8581355 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/font/PSystemListFonts.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/font/PSystemListFonts.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -42,8 +42,8 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemListFonts extends AbstractPSystem { @@ -68,8 +68,8 @@ public PSystemListFonts(String text) { final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { final TextBlockBackcolored result = getGraphicStrings(); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, result.getBackcolor(), - getMetadata(), null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), + false, null, getMetadata(), null, 1.0, result.getBackcolor()); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/font/PSystemListFontsFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/font/PSystemListFontsFactory.java index b6b661030..2822533bf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/font/PSystemListFontsFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/font/PSystemListFontsFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ftp/FtpConnexion.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ftp/FtpConnexion.java index 0ad9d0dfd..aeba71da5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ftp/FtpConnexion.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ftp/FtpConnexion.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ftp/FtpLoop.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ftp/FtpLoop.java index c3992a637..59e766578 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ftp/FtpLoop.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ftp/FtpLoop.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -49,6 +49,7 @@ import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileUtils; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.security.SecurityUtils; class FtpLoop implements Runnable { enum Mode { @@ -69,7 +70,7 @@ public FtpLoop(Socket socket, FtpServer ftpServer) throws IOException { this.incoming = socket; this.ftpServer = ftpServer; this.br = new BufferedReader(new InputStreamReader(incoming.getInputStream(), ftpServer.getCharset())); - this.pw = new PrintWriter(incoming.getOutputStream(), true); + this.pw = SecurityUtils.createPrintWriter(incoming.getOutputStream(), true); } // http://www.ncftp.com/libncftp/doc/ftp_overview.html @@ -173,7 +174,8 @@ private boolean manage(final String cmd) throws UnknownHostException, IOExceptio private void localLog(String s) { } - private void retr(final String fileName, Socket soc) throws UnknownHostException, IOException, InterruptedException { + private void retr(final String fileName, Socket soc) + throws UnknownHostException, IOException, InterruptedException { final OutputStream os = soc.getOutputStream(); final byte[] data = connexion.getData(fileName); @@ -286,7 +288,7 @@ private void listPassif() throws UnknownHostException, IOException { } private void list(final Socket soc) throws IOException { - final PrintWriter listing = new PrintWriter(soc.getOutputStream(), true); + final PrintWriter listing = SecurityUtils.createPrintWriter(soc.getOutputStream(), true); final Collection files = connexion.getFiles(); if (files.size() > 0) { int total = 0; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ftp/FtpServer.java b/src/plantuml-asl/src/net/sourceforge/plantuml/ftp/FtpServer.java index 34f3b8b0f..f65bc66d5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ftp/FtpServer.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/ftp/FtpServer.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/fun/IconLoader.java b/src/plantuml-asl/src/net/sourceforge/plantuml/fun/IconLoader.java index 6e385fde5..5e23c9a92 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/fun/IconLoader.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/fun/IconLoader.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,26 +33,39 @@ import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import javax.imageio.ImageIO; +import net.sourceforge.plantuml.security.ImageIO; public class IconLoader { - private static final int NUMBER_OF_ICONS = 29; - + private static final int NUMBER_OF_ICONS = 30; + private final static Map all = new ConcurrentHashMap(); + static private final List tmp = new ArrayList(); public static BufferedImage getRandom() { - // return addTransparent(getIcon("sprite028.png")); + // return addTransparent(getIcon("sprite029.png")); return addTransparent(getIcon(getSomeQuote())); } private static String getSomeQuote() { - final int v = (int) (System.currentTimeMillis() / 1000L); - final int n = v % NUMBER_OF_ICONS; - return "sprite" + String.format("%03d", n) + ".png"; + synchronized (tmp) { + if (tmp.size() == 0) { + for (int i = 0; i < NUMBER_OF_ICONS; i++) { + tmp.add("sprite" + String.format("%03d", i) + ".png"); + } + Collections.shuffle(tmp); + } + final int size = tmp.size(); + final String result = tmp.get(size - 1); + tmp.remove(size - 1); + return result; + } } private static BufferedImage getIcon(String name) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite021.png b/src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite021.png index ef4522ed43bd076484d0ac4dde8220f302679ef9..3b6b5418f48a68923df9aaf85e94004984c517ad 100644 GIT binary patch delta 982 zcmV;{11bFW59>A17ODk1KxWuCjr3&rLx7LiXj+^^B&lESLQ5$9qJq)Ne>mB z0-VwRfd3=_pMWG;uJ>7h&IbVXO}qqvTl!J&0G%@(08|TcL1>;0k<22;uRK%Wf>ta%TUnt6{vMo zZUNS#4L1pp;Pl*GvBB5!ee_yy0N&EcNyXrK&qXwH>MsbPOHTGt^Kfh?(T`3maM{a_ zX{Y_sb$^}a;*N=?3AvZ|asz1GP}3~CKl{@(mbLEcI~BSz%;^>|uC{Sv(cjrunWk}Q z5`l(WfUUyB_-Z*%O#k>~vj%8ZtXhLp;vt(%DpMI0l{B_(wN+KyOB$Zu061;{bhff- zfVaRkRRHfjI<3I8Vmk!f0SKUA%nB?((C&)8&3|(Wl8jl7=KwrBJ~XoMDhAB~iUMfE z6k~Xu0leZ))BX=;#bTjaMoH<<5g-O&W8Psd6c{_oO9udC*&`Sf0mTJ|mDuE@@w^WZ zK>09ahysSu^yb5(?jC?U+DXy|`@^tV*s2;F8ju?Ep|You@k2l#0xNGv`&jsKY9Gi# z(0{Z6AZ(@}JNDpVVp=&+18ItE*0bT-Y{Y7i;}9M@0LUJa`EY+wc6I<643`Q+mKC~o zhzpDg*aM6{hm9ULbCSwOQ_6XUj(%Jkh}QwGnO$kx z7_R|rRrRcS{`Cc31hC#bUj41a%K*NL2Ty((0Lygv^8j`{cmf*34C3E=;PYM}{=x%j z&c3-GcmVqE0PNQQejU)tms-f%sc;&wekCfNC2)c^ng0001XcFTf- z-&IwV_V)C`!omm$9G{<`L_|bRaH{>`1pBw&;tVl zXlQ6kN<({l(ujzN<>lr2`ue`Uz7P-)OG}9f2?U0mqs=l}o#;^N{sI5_wB_WS$&{{H?UAt8T%e~gTbety|{dU}9>-S6-3VPUGY zw6i26BmFp#(&1{?)cQy?;ai=(b3UxaBypDYpkrSf`ZWZ_x#Px?EL)wG&D5I%F0Ja zN05-!Wo2dW@9tGqRhpWb$jHY60s{B<_ph(7m6erPSXdPm6>e^B!^6W$N=mxAy5QjR ze0+2jG9D94(L_~NmFE56M<`NPhZf?k+pq&;LDD(6B3kx6Y?CgGi zei#@S&wtO(+}zxBbjq@_vhwo!Q&Ur4U#Fp=+nAV`#l^*;p`pRS!GC|-baZsPyX8zw zi(z45UteE|iPDUW(};-aO-)Fqrrk|Vj+>j=$H(fpxa4GH#F&`a+uQN8v*H*S7Sht~ zb#--zhljAR;bLN9Cnq2*EG$DqL(I&~6ciM9cYk-@-rj0z$9;X=NJxELT%SWjbmr#f zQBh3;0}kNe;6+7(-QC$vPFhDtdO<;PTU(-1Qek6bV^~<4KtMWdY`U(lu2)yUGBRLe zW5Y{JgnWF>kdTno)$iTi@yW^RXlTU-1{05u_Rr7kq@Xm&svl2T>ib!VjjLJy4BULe)!MB)eBeA zA3^+qkT9w<0kpHVP}bjx9AwtIb+|{17KPD07jo>&A4m#1Onb!vc4RZcmh2P&D=3Uc ziUj)i?W+Npu!z#d0?E2SQpiRU2eh3Oq5)VokBI_eX~BX86l*?^I;6X99U24X&3~I0 z5FTwN@G`C0)>E%-F|3~^)5qojeZ#iw>}ax`TO5RRi9YQG!fUU0)dxB+1gsRmMk+fBKIRBl z(@h_UltTpsy+cI%w7|rP@b!bDf$ZrEMZFDxp`DaK|KyYJ(vr|k_VzUls4SiGIc_W~ z9(6wVn_^r#QjGoM*Or(9o`w<#*}R?H0n|p1%LifR=~@ooCda4RK$t4iZ5D4UfNY`-a zMgXLz4wcL7>jJ8}z$c?QpvnDgWK;G7_Z7_unDeSG(4!x)E)+%pK!2m{|IVkyb11=s z0Is^w8+npC3U>E_0l+c_+{mRIvLe4ma`WzlRdbut=C6*#QhA^i%mb`wB#_?hP}aSc zB-KQXD`^$b7}tPD0~|DYNcdlaGeQ9@cZMeS?|+zd;R_*P9C5CmeM3vU|`&^yMI8RK7G)M$V!R_Q`tl+<-bxk;D64U&U|hHz;e1vv=G2b;=s2e zKrJH^dIm@HE&vG2ILuw)v#nCkIx$P!vbjTb#=M#!%Kq?2LtT?c^JOIa2{NI40v;wfQ*C#%U zJY@Sv^aBGxCV+adq!Cf!U(KBn3!wyoOoE~Vd&s^+EW`u;&p_Goy-~Fg2L$%Z7%b0+ zy0UPH1fD3I`eNKjsOw=5(Lgn{h3>Hu4|qYFcM)0vqzB7`(F(vjZEzp72B3VPRRHJF zT0rvO0M`U4n_xZ=)!a+dlQc9+H82}+>7?7rXw~4j6lV1=g5ZA0py*?w00000NkvXX Hu0mjfZ7c=; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite022.png b/src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite022.png index 664051211482e033b818aea0822efbde177d03da..eb90ab9f84f4079515c51b6783449d16d2bc88b9 100644 GIT binary patch delta 325 zcmV-L0lNO^0^kCWB!3l9OjJex|NkH$Pyk`l5TO9#!m*;4r9CURN%)L0M9kV09L=X3lpN^?pwPFfPc(hb?xFx%Osqd;Zu#- z;tI)x#4|28rpnKJE8Qh9GmQuph*HkJLPP*)u!t`n8xtJmX$(I{(AMsRc1J6$Y4vSkn?zSyM*=&JBH X#Oz49+dV5-00000NkvXXu0mjf3(%Kw delta 333 zcmV-T0kZz!0_XyeB!3uCOjJbxVbcHq{~#bx5TO9#!mDj98^=9bAKdcVM&0(e(1i-=EgP| zU&DHDKTsE`Q^k70k{nEpL70^pO+ndry7xet5$`IX{HbN+4v%)4fU(xtRMi<~oKd1G zu2nRqcY)hc+3AmF?367u+oUl*mrc4_GBNyKu(soGs!nSG<+|{rb^enb>~gi{=1)HF z^W&2J?RMPfYDRGt<7S$DTQVXFJ89{+3^ f4`wKgvl#yXA!}s+`{AYm00000NkvXXu0mjfzr3J6 diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite023.png b/src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite023.png index 1af6a883ba42b34d481cb7cd6a2f64109c61a823..fc2749e21cf47710a8a62b533a41f7e813f5154c 100644 GIT binary patch delta 388 zcmV-~0ek*}29yJk8Gi!+005$mL4p7P09sH?R7C*+{|W%v^8o?+|NjjQ{{R5=vaNklco41WdC&;o&qc&)vj|NqTX zK~1C;-A|6QCWa6Jj|AAWb_D>aOHTQZuscdykoJ?T@=!<_P)2!M?5m!kP1V4JqAGu@ zu9!=Sp{j;fQ`$x8xs<3v8DQxb)kzuAeR@TymM@kNk-A~3YU-<<#yMcB6zkr@h^)G& ziX9fvK^TF+RDCsk5?#1srbJAOYZZ2Zl!GH-T| z>7Yp&rd%>=rcR`;v$Comk8omn(dIb51)#2YrjRtF)Bve`e0000Cg%VE0?A24K~#7FwbnIk9DNW4@G&#n=O)Zdb(oox z)=i*t7fv6hF7O3=ne8w(VP+;X!|E7bMjGj_?_hTgd!u&@KhMsrb%efE00S#?ue21a zSHorlk&2_XRi!NM1b=m5A@cL3 zIdw2)cpU5cd-smNjxlbIF>a1AX^uU9i5V4lSJ!~OapRDi%boG$)RAO~BgW^!gP$#3 z`grr^_rr(3J%4x3QC*FS3f+{Ko+n${EaF$xgD zF#aP)nsxh|G>NArGn39Zydxm`P+9pIp(R_x*Wr-?qp0Y&?(uAI2NAc$7oHYwXU`8Z4)rj5$9^H@0x5ugo=6Up}6^2E!EJPx4)Jgpg`c)YFEtkF& z#BjdyH7AKaoV}s}F!!cT1ram<|BuCa1%rx-bP}vz(kpN7T=7DNQQOngqwmFlh_6+I zbnV(@?tksvsfI6~6%WUbeKGffNk5UhqQb=EH>l4BFWVo$Z|((?K3<#e-;F#jqR9I_ zZ{GX9c^vk*QDblE(g>b>=d4*jfPneF1jn6~W#s+(C4X*2l4C!0%CBjV@&k4vji^UI z{A$~b8M+?ViWNrx5`*LV+3E%0HjdwK&Jap&a8 n?Gq++j~P?f(cz4qXJ!2Zr|@5irA|B*00000NkvXXu0mjfCTV#E diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite024.png b/src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite024.png index 0a7599d86986a9b7af9f4b9447cff5034faaf5b1..53ea06ccdefb253dcc53959923cf9c81bd1a6731 100644 GIT binary patch delta 1000 zcmV>B_80aH*+R7L;)|GK)m$^rtq009052BiQ1&(YCX z0RdQGU`hf4`~Cf$006B30P5`QdjSE2j*i+02>!Xb|Mc|#BqZVj0*wFw>HGUvP*DGS zd(PtG+1S{}*x0fG0iUt4!N$f`T3SyI4*%%rm7JXaQd0dmIDcI-GHGdPX#fDp%F1+j zczlF}shyo#MMYE=7Qp}j+k}LTlauQg7wrH5wL(Ju)6=Z8v-4bBStuynXT(c9bV zDk}SAWbM?{kbiJ+)>~Wg|NnSRO}!BjpA{AH^76LS)QEn5Y)nkSuCAsV8+0@@*t)t& zK0c&$bg+quR00Bi85xT)F~fFtTxVyscX#}bj{UE%+ek?Nsj03vH_wui`kQ6CkZaD7>Owdmlh8#U>WYXz$yHrwD<;c8K zzsQ%r!GK_FVF1nXkmvbkTU9Ykt0ydLHgvc8oeAQ^(qQL1KY9MKgkhnOwln9}4KEv! zihmMev;b54X}jG|Dn>tpcUx>YK=^SoY8X1^mjR|s%|C8T`#pmT2jPI5z;RMsjM7rq zLh$f}#j@6WhWWx(B;a;S_~qep7iv~pU(Z5pv$FxUf delta 1465 zcmV;q1xEVw2fz!E8Gix*006>hi+%tA1&2vQK~#7FwUz^P-B}mKPhZEZZQHhk^3`on zBN}{@^-|lm%~iz4s@qY}uZo@2O0v4zrufe<@6JTE?mFRn+52RlefIr}_7>;a)2IK| z!-vnbcRQ~mcz*4gW^e!8$45&~f2?WgCr;cHNiJA0rcj|PbARTf`1%-4KPt)lXN3@^c|D&Ui1qOz#S;MREMnJ#Xty@|^fL5rGR;G+rubyTw zJleeZftA(ma^)03tfoaoMErf>LXf-r0g-5D=eH$z5*DU$A|tf|1%RfYK?)>FGuHKI z&yrTIjF~+7a({5}`P9@isi{Flifk3}U%&n>2wYt?b8mf+AKO`So5vef7E$dOr}Ik^b< z4;Zo{_*>+ph_{oI^Tv%kix;0!y7XV+;jbn@Ze#&bjeh}^0t2y-dJ&24J$`)s{{6&= z2!$Rha?VKLV{3c#*s<;I?yC$2i+=rHP5=<-$PIL!*HPBqo6>wQ6;(NRf!Wd#PZ(UbXLU zl<1I~+ka*V)~z$tsnb>D1pUAn|qs1T8o!UlxI#hs3f z3^;JW)!f`|@#1|xJ`gNhz1p!uhrS~GJ}&_%NWoz99-!F(+Ghi9_3M|^vSqZH8P*I5 z4gKTKKTn-L?SJf;dq~KkLWP*{+L0sYtXyelZhsEJ?12Mw2#A-=UAx#uzTuz1IoOFs zqfiWJg--i%HEWU(w6D-vV{dP7#=BRiV-Hq{%n}*bpus?$Zb-3WIRtDLg-M_x3?A01 z^{`13iq*Xr5pi$BhMN`^sdeju9$vKQ`Jf=$&qimq2lwvXDY8zdTPR`>8Cj>!5F49r zwSQ~p5a6HtDJiTdLK8J-7wl z_V*n>zO_x8?Dofs4C&q-0<&t>atKgAv43L4>lZGd11Y8oL1Hs96!e7)7m$S&1y}jf zLxgM~+3Gw5^v>RMbznhS#_3t}BncWdA}oRS3lAp`ve9>lsKG9r zI(5p_sWx_Y!-o&2@nPS62LYQ*YUPg#B8BZoX!_;zSyNNwrh<&3dw%()i-W_VcI}kq zQ3iCfbMoTF3Y~*QptA%Hdi_hXh<{-c>j;e+xRCF`&DMk>49Lr^&dvnR(sASFG;fa3 zb_N5DBMzTgF4aDP`0}`BCq0@pAx01cf^29s*`GB5f8eT{>s}e5Q&iK^*eM z7eJ#v6YgEE9Ne$G50H(aDL5jGZxDoGqRHkyeTZTOjp$63NB}*%&_{1!VSi;}@`fvu z+X_c-G$JC%Dm%Ni_3LvNE}1)5c@bztN0Z#>v=2Hf_EwiZ_aZwv<@3)MZrn)A;8Ohf zzh=!yO63-0$wo(+o&yG8(|3C=LMyWl9Y&2CN55lDOprS_B7)E_W%l*gl*f)8@AG8G z{f^C{0fOC8r7vF|HE5aNGcsF}?t>m3vmNZRWeb_ZNN^Ee;$e#02R7L;)|NN`~j5Mf#yc1u*Fyk~Z^?U&T zy8!uw0RH~{0GZ_GH7=Djob7A@;4V1gHZ#UJRsf^zpD&tYTeelX9Za(mTe~OS?9}4x z==J;a1CZ9#=)rQnN8B41V_UUKwBW$uubwWM$2eAm%I5UTkbn5L1cVuhrqqwRpUH{G zXPnjO^wC)R@xfD4w1>rJ>ywu6%FdU~cO|FZ?5t7bU{@IbOsjK%~km`v3p|DoI2^R4C7Nl8bhNFbsynR+;FW+iZaf37eCggvZvj>hzE=^VFIloVpp7X_{-> d=ww>u7Zl5}Cvsf0ulfpY{q;#+gjVU zZQHhu7=yJn@$P2F!OX?ZO!xi2ukkuL1@nHXRMl7C|5bOjNUYD#D+rQPSf01Xv^cxS z{EuZ+S2_FyFB}LB(|z&HiKjk4Mk($K4Hp%Z9?w`Kemc>llYj2rUWU*gk2iOfS{u=+ zz|5VzYd;@v)lKgUI_usa6#p^u4HQ*>IOm z!XNSgiFDUh9C#01F!(*T$(%F2k@N`FSmgq|Owl1}4LPR3l!Th&Mp+e{-6;!yk86pu z`D0|$dFT3KyMOlNpp2`+f@+dR>+!NI9I5J#E7{~cZ^_G0H?Fxh1}AjFsb6n6Pe~c9 z!cWV&Ug0TKu8=AZ@0M6=f>`Bc3wfnEIIi{)@3oG8wRQYUf5g7rG3tHvb=6_;c&nwI zw{uPN&h_dL^A=W7_D9UCzsIx~qx&V@eM3DVglf2m<9{>vpqKWEuXWRZ2rv!MRsR7p z*oOTbqdsUG@di$UQsb-EV1O9i>WgDoqaKl@7IvCeejfQ)Cu2YdgAeFr@UI0+8hs@z zC-p&q`+;ye8v}oeZI0_qp8j3e(E-P3rmoqv#OJ3cHc>&S^*L~A6sY-`2~UqW@nD?g z5EHEw#eb?3B*tlom8{CYWK`mr6^@fwZh|6aPGzpch=n+Sol=G3NW>|Y?-x{cWeY6Y zs<5xCWQu%H<)+q5F_Aol)dByu%Bh+~Rny3Q@E1`M z<;_yw{Ez?aPws*D$_%OlDAR!L_OADPM0rX~)HZqH-8X&i`i4oEnGFYK_;56sfx4t{ zmw(sae&u!Nl9e9*OhLbtd+MzDwHGZRfil5C*3dv8g;szNAXI$RsHhv$nl&l8kzC1j z*=>s08RFvz_OSOg6Y$H~u+|c1U~BoB z5S$BdeO5)uFv8lNe(U2C;hkBh87VpAnt!if6uf_a@NU?J!FwCVf{{R|aof6})K`Y@Mi4xtiOlFVEqJ&qZ_YW>0T2dyDV-y0F;?D8B0Wt(o6^ z$(5rw_zLimghgHhGBU0Ih?qV2uyhL$|9>aH zQJU{I)7CuN;ntvrF0BI#lma;Uv_7*$en)%dPN9qcMb+iBESc8YXuXv-I%%VsV`bqg z8!f-X>{=&na7dsATC_2n7MM~C3h}td^Au_%s|&I&-nY-KPo*U`TIXP_%BK100ef!` zKjmCcS0M6tDRiJlHNP8J({OjEWPcTD{_Obe#h2`8 zA1z3qAsi9mrc~z-k>;^>IcSO73%uqDCsI}00000NkvXXu0mjf{J(Bg diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite026.png b/src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite026.png index 5c8cc8477817565b88ef481667b786936d064e7e..165d71828ff0b9a671ed97e32f7ef4c93d56301f 100644 GIT binary patch delta 726 zcmV;{0xA9E2jc~h8Gi!+002UQ_0RwS069=hR7Lmq_jq`CQBhIE#Ke=6lWA#bs;a90 z|Nj920f&c&wY9aLo}NWTMHLklUS3`!BO^66HRtE&*4EZ1#_=cs00L!6L_t(Y$BkBt zvg$AhECfQxoBsdDUet3udTnc%+HpEtmcRntwoePTEt#wWw|~5^dRzsv$`UT76jqRu zQW|T(G13{(p0^v2$`g2%D5(|u5_QD>ewY)tQfAFd9!uv%AojQf1cu+z*hz-&&qa|* zF4Fk)NT6kjx&y7{Q9)m+?ObJ`u;j6V;*ubN%8$qE-Z4a&rygH)779gL=tIfC+V>S; z)DquxW+$4^u79u~AIU_etN>L#NIH>^y=o#e#7kA!kH--FI0M@hc|i_hq3wU>AD7TKBJTU2be{aqWP**C$*$Bszy zfgb+IC3^Mt_Sy1cBc!Q++q?+MZdPIFgYfF z$t$PACn6OTsQGptnd}GqpZI06CZDX`!^FFs{)%rOF7E*T2S557Ff(VFBLDyZ07*qo IM6N<$f)k}``v3p{ delta 985 zcmV;~119|A1>^^i8Gir(002-oT0Q^(1FK0yK~#7Fjno5}><4LMNKy|!2fabxS0df5j!pHpP($Tet+ko0VY`I>cgiJ8g#;b@4=EVydnV>^Vt{W2+#E6QSpig946caoaE-+$%^8Zo_>Jk~C@*6Xo zu}DOWsckUdT-*c?q09QSrmaTC=Nrp3(3^RA;-T#`jZRNQX}0%e(yBd7<(03ST{!_K^ngWp*5K>Sv6 zX1Jld>vY9`Fa%LSt~5*y!9qfAzQArG126zJ@6F3gHGdM<9F>Y5_)lp7D!AG65A5B! zZ|(6FQw?4tH{unx_}THXp%rO1FKP@x`b@Y(KPbiU*5YS40}%I1YmPuB!;-G-Y0wWf zBR}qZx#T=7dt%!+FRArHh+DlYMmd=bl^wpVh0q7(c&H%hVaR1N<&X11s;BFPC&6sJHKqXpUeZi||G*PlgO4useLhZU(M}7_K$5`eT!z74*^p z6n_*|;vL_faI1QrUWLlPrgZzhaMPK;aot$@cK3sCdN)mh{0c__fl%e(XAedLy!^Gzs2o`GU0>&Wx9e1q7Dv< zpdi>7ko&ywLCAC`2We? diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite027.png b/src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite027.png index f1d203684efec10bd52e70b91f7a6ab31654928f..b460f5007665a289dfa42f724c578a5785b8d6f9 100644 GIT binary patch delta 205 zcmV;;05boO1Kk0T7=Hu<0001}GL-WG000DMK}|sb0I`n?{9y$E0004VQb$4nuFf3k z0000IP)t-syT#Yu-{DtehX4Qn_NxQ(aB;x)M#KOB0BK1?K~y-))znc6fFKZr;kklW z@Cwrrx`Ow=N-G&zV(csw^b5XxFDkg;Ja{bCbTi0ze8-k`Z$>=KqaCDLfAtRy2}aPZ z6*WZdOt9R=m@#IQ?D_(_(QO>bXSHH$_TT?*rPg-E#5uSD@dVLTH;kKO00000NkvXX Hu0mjfL5Wz_ delta 370 zcmV-&0ge9M0gwZb7#0Wy000159ErdH0004VQb$4nuFf3kks%X*32;bRa{vGlumAuN zumQ*?^;7@=0VPR9K~!i%?bkaB!axuP;3&3ULA3J#R@UCaQ)m~g#ZC{PU?o@xUclNj z*!aLg>;)~=U1tji^4x69uKx#NC#0JE%x+S8zIhHR)9M`U#Ez#kRpA=-8ddo~Vq8#C z{%|4J(V#0=F0bT&oJ|ak+2(7;9;*sf$z59qs={H$G|9$9QaWiB(SOWX5^=vcILw$P zG-jLBjqNXYc`5v!i+Y|l?26oGyQ3M}Qd%VtUrn{XBJv`1Uq QasU7T07*qoM6N<$f*Z%C#{d8T diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite028.png b/src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite028.png index e86483d8aa5085c0ef1d61f20390db3e59dbeda3..a0bce63da86426e94226aa3736d556816c9beeb8 100644 GIT binary patch delta 1555 zcmV+u2JHF!4Ves(8Gi!+0027n{`yz8|B?Uyihq-BVqI6}?0=De{p|W=$m3C;&2po$h{*Yok$+{j?8V*P z+Uf9DZE3RU_%mK}V%pk~qoXz?B%ijnWNm*IF;U3c$XiZMZOFDrbC*KS$lBV-wzi|} z+U$SG$XbbWl79dI1nNmdK~zY`wU>!P;z$sN(>I+CIS9mn3X0q}3V6F-tK-b>`@has zcLD~4*&WBN2!zCZsr+?xVdefGv;O^GkPw0i#=e}3fy)^BLM{;D53pQX+UW8GhcD=J zTz#2l8nC2>OY~uVg4pVFT!w|-1jF36HZ1k{zjGOQhkwv2SQt}6=|?WZhsS~jo6%*W zzk_Q;#LHXs(}&+~c+aZg_$0Ll<1{KgA*Fm1^l(PvqEJQT-=n4m3Okz54a zLxBmkcl&B1#>8gsdNUd(QRo^nnt(Rz$GSWWut%FYx=8V@FdEm zUwqVM^Z8*CH{-7okMt3^-jb_qrnw3l4_OZuy{A7Q z-L$jZah}@k_B5JSN~O|mYtZUU-OBaViVFg=@TB+ZKV&4$Y5d;))p}<2IiKkEuDKV| zKY_fO=6gjrvIo9K?r@ma1%tfC!mnBf-GAmqrYYFAco#LZFOs|>)t7I(r{5=2_%Vi5NGr?70cKa`@a8u|4-Pi^ot>SlNRcauo2b^g?h1A z)Lihj)`>>8wW?#xF_Nc%If!3%wI!yrOmZIbC(avBJZx|-8&X-E>xy;wqz%~$C4Vq7 z!73IDg~D9B^4=c=$E->%rS9UUTpDndmF!-OPsbO@?)V7qWjgg(wn5l#xvP_)Rj!qx ze&Gi%-Y$R2s*}r@94QgB;iC?M|V0@X170T(_3br@<6#T~!*@H@JF00ItFfDYt;^lI~EE{xI33n0Sf}+~Gtybh#BK!IIiNVORV=e*ivONbt z$xxxEd4w9>sq_~;Eo$z}RBX-dbdzrXlX)i%m^5SAJD5Vdg1D(vhef?oHdcddy@SJ$ zX333qanm*3#6i#YJ*DGJC7tDE{{3sW$CF)GOUdpm5%C{?kP7au2WE!3@vl>%)|x5+ zcmId0kT&NcC17R|S#H_)Js!Z!`7n3?tE(`7L`_aYh)A<}xqqdUk}r}oXm?$&*URPd zS69KzVCp4| zdbpoe;3XMy{GtL8q5gyKsvsio+K+t63Qa_36&xxEcNMB}4c0!eh)5OE{u3~@&#Dw5 zweBM42M`eo4?f51tm}%rYuJmH-&R35=?p#}$gpNK4*&X@f^lPcizTnBA|$}Lj3)Koz{Bz%uPQv`We zp{PGp0arejL64eV@t-&NYpmSf^`^g>Hn!VdR!qy zjs0#cz)vDOa=wYmwT;SZ8#8T`BBTdUFM52A*nfHCe;PEUR4tADSp;|+b7o&-e)si& zW#^(&s_cb4$odeE60wgEDDE0jBP?PwXNziKe#F8YS5xI>Vj1ow*Ya4!HOMFf|k zyAQ*?Z(Raxh(Sas@-5QuwpC>x2y=Bt{@3)sOL!dY5o^{3R7Y?(7FvF(YH5~_SU*&d zYk&69Cy2%N6z%eWZ>;`!)hR-p$g%ie!WUimhM zpW_;H1@QDgTOd-_dar9jl%lqwV&e+gLw}Bl5es{Z$@OX5-EUS( z(l+~_VYc_7PT}M|1=J%UcZoKFy<3j4k}TaZ?*2dpcZUk-Lq}=sDqLuz%!t=EOLm|J zP~G+PGvC%h|4U2{j_`_f6?kW&u0kKA-SZe4$&~*dV!_sn!ew~zVF!)lpf23uPYESEN}S7yY5JSJ6uCHEd6`P0^C+U?uArh>nmZs4-rRmkQyg2K65?vo0R z>}Yd#%2f2yO}V!D$VHGJ?2Ze4CAd2uRa=KM-{ZKC>7m`5pC$u+8e#9f>vdsU4Iw`?{i%k z*L<9~y+!WC&YKHw7(zYcfVmiQ{$`%~-#MqR>3<*2AD!~$I`6FCA?pH~(`N15sBeQ6 z|FrvFo*Pi1EzSxeSTbwib5wdjGhNk(B^&om(-6Kv6XlwX|qfT^@$4e zpA4V^N?pHQ7;+$zk-Kerx_<^wf&~gZKik?nG!TT!s0HHg_!g}pw zgNzt{3$#*v&|c@P0+&J&#WUOI;ex$Tc7BH7UoR_N*Ns@r3=NvQ|6eMARN>Ll1&;TD zJOf5zV}dxE>dRC(h6>v-IA(lIQ~!f5P%I?kd`{D*Z~krSoW_tQ4u2pyGyg0Bq9Ci| zWdziNjHoo6OyM^Jme=fm8Jm+Vets72TPoydo%yAcLEvOiU{2t6sDS2wxyNzI>~%pb zIG_Uh!dwK~@W01prF`z6|JPa{od0YAE$$xPm0BUqPbU<-qc6-MHRz`J)xXyF7aS@~ zTGU}DOwDM@5-WqB_itm{P=UrykucP0xAt@#QZ}LgPT%5ysb67R*T3s`Sr7}a&>o2n zDrbN-+VFq43Md)>*zYyr)OdMD9sFZe0LwG};oo<3_dLb31D}|0`P-|IHhlctzm5w3 Y14?;0ft^JmtpET307*qoM6N<$g6gblbpQYW diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite029.png b/src/plantuml-asl/src/net/sourceforge/plantuml/fun/sprite029.png new file mode 100644 index 0000000000000000000000000000000000000000..f8e8a9111a9af94c8b4ed639ee8e325c1682a35d GIT binary patch literal 731 zcmV<10wn#3P)Px#T~JI^MgRZ*xFIC}9aC2^3j8x-|MCE?ARPZUY_K03 z|21W;1qZnf4sk>${2Ng3Cs3uS$F0TV!XGElDm$>8h?{2WwNxGh%ck<*ih}ASab3 zE76K)0ifN|y zI+U3f>=$=NE{#ledF`D5G&H4?@0=6^GzMdZb2K zU(bSv(&nMIHXu^%zLURzXuil|{gGQH7P+Oe$>FlR4cR5C@B+dNi0y^wTE#wSm6hXO zMy1#u*6p&pJJR6>X0mN`-KnDmJKM+o4qb;Zqt=)hnPj6-1p^};M#M%>Sf?Cglx!FV zCP$Ss;)wPevN0xx5ThGz=jMDHx>1F7YGFi?O$fD?!?{772btz0iQqMYWI0)ykL(7` zCTM styles; private final UFont currentFont; private final UFont motherFont; - private final HtmlColor motherColor; - private final HtmlColor hyperlinkColor; - private final HtmlColor currentColor; - private final HtmlColor extendedColor; + private final HColor motherColor; + private final HColor hyperlinkColor; + private final HColor currentColor; + private final HColor extendedColor; private final FontPosition fontPosition; private final SvgAttributes svgAttributes; private final boolean hyperlink; private final boolean useUnderlineForHyperlink; private final int tabSize; - public FontConfiguration(UFont font, HtmlColor color, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) { + public FontConfiguration(UFont font, HColor color, HColor hyperlinkColor, boolean useUnderlineForHyperlink) { this(font, color, hyperlinkColor, useUnderlineForHyperlink, 8); } - public FontConfiguration(UFont font, HtmlColor color, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink, + public FontConfiguration(UFont font, HColor color, HColor hyperlinkColor, boolean useUnderlineForHyperlink, int tabSize) { this(getStyles(font), font, color, font, color, null, FontPosition.NORMAL, new SvgAttributes(), false, hyperlinkColor, useUnderlineForHyperlink, tabSize); } public static FontConfiguration blackBlueTrue(UFont font) { - return new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true, 8); + return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLUE, true, 8); } public FontConfiguration(ISkinParam skinParam, FontParam fontParam, Stereotype stereo) { - this(SkinParamUtils.getFont(skinParam, fontParam, stereo), SkinParamUtils.getFontColor(skinParam, fontParam, - stereo), skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink(), skinParam.getTabSize()); + this(SkinParamUtils.getFont(skinParam, fontParam, stereo), + SkinParamUtils.getFontColor(skinParam, fontParam, stereo), skinParam.getHyperlinkColor(), + skinParam.useUnderlineForHyperlink(), skinParam.getTabSize()); + } + + public FontConfiguration(Style style, ISkinParam skinParam, Stereotype stereo, FontParam fontParam) { + this(style.getUFont(), style.value(PName.FontColor).asColor(skinParam.getIHtmlColorSet()), + skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink(), skinParam.getTabSize()); } // --- @@ -81,7 +91,7 @@ public final boolean useUnderlineForHyperlink() { return useUnderlineForHyperlink; } - public final HtmlColor getHyperlinkColor() { + public final HColor getHyperlinkColor() { return hyperlinkColor; } @@ -107,9 +117,9 @@ public String toString() { return styles.toString() + " " + currentColor; } - private FontConfiguration(EnumSet styles, UFont motherFont, HtmlColor motherColor, UFont currentFont, - HtmlColor currentColor, HtmlColor extendedColor, FontPosition fontPosition, SvgAttributes svgAttributes, - boolean hyperlink, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink, int tabSize) { + private FontConfiguration(EnumSet styles, UFont motherFont, HColor motherColor, UFont currentFont, + HColor currentColor, HColor extendedColor, FontPosition fontPosition, SvgAttributes svgAttributes, + boolean hyperlink, HColor hyperlinkColor, boolean useUnderlineForHyperlink, int tabSize) { this.styles = styles; this.currentFont = currentFont; this.motherFont = motherFont; @@ -124,7 +134,7 @@ private FontConfiguration(EnumSet styles, UFont motherFont, HtmlColor this.tabSize = tabSize; } - public FontConfiguration forceFont(UFont newFont, HtmlColor htmlColorForStereotype) { + public FontConfiguration forceFont(UFont newFont, HColor htmlColorForStereotype) { if (newFont == null) { return add(FontStyle.ITALIC); } @@ -148,7 +158,7 @@ private FontConfiguration withHyperlink() { fontPosition, svgAttributes, true, hyperlinkColor, useUnderlineForHyperlink, tabSize); } - public FontConfiguration changeColor(HtmlColor htmlColor) { + public FontConfiguration changeColor(HColor htmlColor) { return new FontConfiguration(styles, motherFont, motherColor, currentFont, htmlColor, extendedColor, fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); } @@ -157,14 +167,14 @@ public FontConfiguration mute(Colors colors) { if (colors == null) { throw new IllegalArgumentException(); } - final HtmlColor color = colors.getColor(ColorType.TEXT); + final HColor color = colors.getColor(ColorType.TEXT); if (color == null) { return this; } return changeColor(color); } - FontConfiguration changeExtendedColor(HtmlColor newExtendedColor) { + FontConfiguration changeExtendedColor(HColor newExtendedColor) { return new FontConfiguration(styles, motherFont, motherColor, currentFont, currentColor, newExtendedColor, fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); } @@ -185,9 +195,9 @@ public FontConfiguration changeFontPosition(FontPosition fontPosition) { } public FontConfiguration changeFamily(String family) { - return new FontConfiguration(styles, motherFont, motherColor, new UFont(family, currentFont.getStyle(), - currentFont.getSize()), currentColor, extendedColor, fontPosition, svgAttributes, hyperlink, - hyperlinkColor, useUnderlineForHyperlink, tabSize); + return new FontConfiguration(styles, motherFont, motherColor, + new UFont(family, currentFont.getStyle(), currentFont.getSize()), currentColor, extendedColor, + fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); } public FontConfiguration resetFont() { @@ -195,14 +205,14 @@ public FontConfiguration resetFont() { FontPosition.NORMAL, new SvgAttributes(), hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); } - FontConfiguration add(FontStyle style) { + public FontConfiguration add(FontStyle style) { final EnumSet r = styles.clone(); if (style == FontStyle.PLAIN) { r.clear(); } r.add(style); - return new FontConfiguration(r, motherFont, motherColor, currentFont, currentColor, extendedColor, - fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); + return new FontConfiguration(r, motherFont, motherColor, currentFont, currentColor, extendedColor, fontPosition, + svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); } public FontConfiguration italic() { @@ -213,11 +223,19 @@ public FontConfiguration bold() { return add(FontStyle.BOLD); } + public FontConfiguration unbold() { + return remove(FontStyle.BOLD); + } + + public FontConfiguration unitalic() { + return remove(FontStyle.ITALIC); + } + public FontConfiguration underline() { return add(FontStyle.UNDERLINE); } - public FontConfiguration wave(HtmlColor color) { + public FontConfiguration wave(HColor color) { return add(FontStyle.WAVE).changeExtendedColor(color); } @@ -228,11 +246,11 @@ public FontConfiguration hyperlink() { return withHyperlink(); } - FontConfiguration remove(FontStyle style) { + public FontConfiguration remove(FontStyle style) { final EnumSet r = styles.clone(); r.remove(style); - return new FontConfiguration(r, motherFont, motherColor, currentFont, currentColor, extendedColor, - fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); + return new FontConfiguration(r, motherFont, motherColor, currentFont, currentColor, extendedColor, fontPosition, + svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); } public UFont getFont() { @@ -243,14 +261,14 @@ public UFont getFont() { return fontPosition.mute(result); } - public HtmlColor getColor() { + public HColor getColor() { if (hyperlink) { return hyperlinkColor; } return currentColor; } - public HtmlColor getExtendedColor() { + public HColor getExtendedColor() { return extendedColor; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/FontFamilyChange.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/FontFamilyChange.java index d24336146..b86935b99 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/FontFamilyChange.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/FontFamilyChange.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/FontPosition.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/FontPosition.java index 699b48567..6d68f71c3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/FontPosition.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/FontPosition.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/FontStyle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/FontStyle.java index 451c96032..da92efbf9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/FontStyle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/FontStyle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,6 +36,8 @@ import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public enum FontStyle { PLAIN, ITALIC, BOLD, UNDERLINE, STRIKE, WAVE, BACKCOLOR; @@ -114,14 +116,14 @@ public String getCreoleSyntax() { throw new UnsupportedOperationException(); } - public HtmlColor getExtendedColor(String s) { + public HColor getExtendedColor(String s) { final Matcher2 m = MyPattern.cmpile(getActivationPattern()).matcher(s); if (m.find() == false || m.groupCount() != 1) { return null; } final String color = m.group(1); - if (HtmlColorSet.getInstance().getColorIfValid(color) != null) { - return HtmlColorSet.getInstance().getColorIfValid(color); + if (HColorSet.instance().getColorIfValid(color) != null) { + return HColorSet.instance().getColorIfValid(color); } return null; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/GraphicPosition.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/GraphicPosition.java index d9c647da4..30d224190 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/GraphicPosition.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/GraphicPosition.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/GraphicStrings.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/GraphicStrings.java index d3b95402a..4dce829ac 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/GraphicStrings.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/GraphicStrings.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -42,25 +42,29 @@ import net.sourceforge.plantuml.svek.Margins; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.ugraphic.AffineTransformType; +import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class GraphicStrings extends AbstractTextBlock implements IEntityImage { private final double margin = 5; - private final HtmlColor background; + private final HColor background; - private final static HtmlColor hyperlinkColor = HtmlColorUtils.BLUE; + private final static HColor hyperlinkColor = HColorUtils.BLUE; private final static boolean useUnderlineForHyperlink = true; private final List strings; private final BufferedImage image; + private final double imagePadding = 30; private final GraphicPosition position; @@ -71,56 +75,56 @@ public static IEntityImage createForError(List strings, boolean useRed) CreoleMode.NO_CREOLE); } - private static HtmlColor getForeColor(boolean useRed) { + private static HColor getForeColor(boolean useRed) { if (useRed) { - return HtmlColorUtils.BLACK; + return HColorUtils.BLACK; } - return HtmlColorUtils.MY_GREEN; + return HColorUtils.MY_GREEN; } - private static HtmlColor getBackColor(boolean useRed) { + private static HColor getBackColor(boolean useRed) { if (useRed) { - return HtmlColorUtils.RED_LIGHT; + return HColorUtils.RED_LIGHT; } - return HtmlColorUtils.BLACK; + return HColorUtils.BLACK; } public static TextBlockBackcolored createGreenOnBlackMonospaced(List strings) { - return new GraphicStrings(strings, monospaced14(HtmlColorUtils.GREEN), HtmlColorUtils.BLACK, null, null, + return new GraphicStrings(strings, monospaced14(HColorUtils.GREEN), HColorUtils.BLACK, null, null, CreoleMode.SIMPLE_LINE); } public static TextBlockBackcolored createBlackOnWhite(List strings) { - return new GraphicStrings(strings, sansSerif12(HtmlColorUtils.BLACK), HtmlColorUtils.WHITE, null, null, + return new GraphicStrings(strings, sansSerif12(HColorUtils.BLACK), HColorUtils.WHITE, null, null, CreoleMode.FULL); } public static TextBlockBackcolored createBlackOnWhiteMonospaced(List strings) { - return new GraphicStrings(strings, monospaced14(HtmlColorUtils.BLACK), HtmlColorUtils.WHITE, null, null, + return new GraphicStrings(strings, monospaced14(HColorUtils.BLACK), HColorUtils.WHITE, null, null, CreoleMode.FULL); } public static TextBlockBackcolored createBlackOnWhite(List strings, BufferedImage image, GraphicPosition position) { - return new GraphicStrings(strings, sansSerif12(HtmlColorUtils.BLACK), HtmlColorUtils.WHITE, image, position, + return new GraphicStrings(strings, sansSerif12(HColorUtils.BLACK), HColorUtils.WHITE, image, position, CreoleMode.FULL); } - private static FontConfiguration sansSerif12(HtmlColor color) { + public static FontConfiguration sansSerif12(HColor color) { return new FontConfiguration(UFont.sansSerif(12), color, hyperlinkColor, useUnderlineForHyperlink); } - public static FontConfiguration sansSerif14(HtmlColor color) { + public static FontConfiguration sansSerif14(HColor color) { return new FontConfiguration(UFont.sansSerif(14), color, hyperlinkColor, useUnderlineForHyperlink); } - private static FontConfiguration monospaced14(HtmlColor color) { + private static FontConfiguration monospaced14(HColor color) { return new FontConfiguration(UFont.monospaced(14), color, hyperlinkColor, useUnderlineForHyperlink); } private final CreoleMode mode; - private GraphicStrings(List strings, FontConfiguration fontConfiguration, HtmlColor background, + private GraphicStrings(List strings, FontConfiguration fontConfiguration, HColor background, BufferedImage image, GraphicPosition position, CreoleMode mode) { this.strings = strings; this.background = background; @@ -137,24 +141,25 @@ private TextBlock getTextBlock() { return new TextBlockRaw(strings, fontConfiguration); } else { - return display.create(fontConfiguration, HorizontalAlignment.LEFT, new SpriteContainerEmpty(), mode); + return display.create7(fontConfiguration, HorizontalAlignment.LEFT, new SpriteContainerEmpty(), mode); } } public void drawU(UGraphic ug) { ug = ug.apply(new UTranslate(margin, margin)); final Dimension2D size = calculateDimensionInternal(ug.getStringBounder()); - getTextBlock().drawU(ug.apply(new UChangeColor(fontConfiguration.getColor()))); + getTextBlock().drawU(ug.apply(fontConfiguration.getColor())); if (image != null) { if (position == GraphicPosition.BOTTOM) { ug.apply(new UTranslate((size.getWidth() - image.getWidth()) / 2, size.getHeight() - image.getHeight())) - .draw(new UImage(image)); + .draw(new UImage(new PixelImage(image, AffineTransformType.TYPE_BILINEAR))); } else if (position == GraphicPosition.BACKGROUND_CORNER_BOTTOM_RIGHT) { ug.apply(new UTranslate(size.getWidth() - image.getWidth(), size.getHeight() - image.getHeight())) - .draw(new UImage(image)); + .draw(new UImage(new PixelImage(image, AffineTransformType.TYPE_BILINEAR))); } else if (position == GraphicPosition.BACKGROUND_CORNER_TOP_RIGHT) { - ug.apply(new UTranslate(size.getWidth() - image.getWidth() - 1, 1)).draw(new UImage(image)); + ug.apply(new UTranslate(size.getWidth() - image.getWidth() - 1, 1)) + .draw(new UImage(new PixelImage(image, AffineTransformType.TYPE_BILINEAR))); } } } @@ -169,9 +174,9 @@ private Dimension2D calculateDimensionInternal(StringBounder stringBounder) { if (position == GraphicPosition.BOTTOM) { dim = new Dimension2DDouble(dim.getWidth(), dim.getHeight() + image.getHeight()); } else if (position == GraphicPosition.BACKGROUND_CORNER_BOTTOM_RIGHT) { - dim = new Dimension2DDouble(dim.getWidth() + image.getWidth(), dim.getHeight()); + dim = new Dimension2DDouble(dim.getWidth() + imagePadding + image.getWidth(), dim.getHeight()); } else if (position == GraphicPosition.BACKGROUND_CORNER_TOP_RIGHT) { - dim = new Dimension2DDouble(dim.getWidth() + image.getWidth(), dim.getHeight()); + dim = new Dimension2DDouble(dim.getWidth() + imagePadding + image.getWidth(), dim.getHeight()); } } return dim; @@ -181,7 +186,7 @@ public ShapeType getShapeType() { return ShapeType.RECTANGLE; } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return background; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HorizontalAlignment.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HorizontalAlignment.java index 3218b50da..3844f1209 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HorizontalAlignment.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HorizontalAlignment.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,7 +30,11 @@ */ package net.sourceforge.plantuml.graphic; +import java.awt.geom.Dimension2D; + import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UTranslate; public enum HorizontalAlignment { @@ -68,4 +72,17 @@ public String getGraphVizValue() { return toString().substring(0, 1).toLowerCase(); } + public void draw(UGraphic ug, TextBlock tb, double padding, Dimension2D dimTotal) { + if (this == HorizontalAlignment.LEFT) { + tb.drawU(ug.apply(new UTranslate(padding, padding))); + } else if (this == HorizontalAlignment.RIGHT) { + final Dimension2D dimTb = tb.calculateDimension(ug.getStringBounder()); + tb.drawU(ug.apply(new UTranslate(dimTotal.getWidth() - dimTb.getWidth() - padding, padding))); + } else if (this == HorizontalAlignment.CENTER) { + final Dimension2D dimTb = tb.calculateDimension(ug.getStringBounder()); + tb.drawU(ug.apply(new UTranslate((dimTotal.getWidth() - dimTb.getWidth()) / 2, padding))); + } + + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HtmlColorAndStyle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HtmlColorAndStyle.java index 152b3c250..464d10ca0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HtmlColorAndStyle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HtmlColorAndStyle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,70 +30,80 @@ */ package net.sourceforge.plantuml.graphic; -import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.LinkStyle; -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.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class HtmlColorAndStyle { - private final static Rose rose = new Rose(); - - private final HtmlColor color; + private final HColor arrowHeadColor; + private final HColor arrowColor; private final LinkStyle style; @Override public String toString() { - return color + " " + style; - } - - public static Rainbow fromColor(HtmlColor color) { - if (color == null) { - return Rainbow.none(); - } - return Rainbow.build(new HtmlColorAndStyle(color)); - } - - public static Rainbow build(ISkinParam skinParam) { - return fromColor(rose.getHtmlColor(skinParam, ColorParam.arrow)); + return arrowColor + " " + style; } - private HtmlColorAndStyle(HtmlColor color) { - this(color, LinkStyle.NORMAL()); + public HtmlColorAndStyle(HColor color, HColor arrowHeadColor) { + this(color, LinkStyle.NORMAL(), arrowHeadColor); } - public HtmlColorAndStyle(HtmlColor color, LinkStyle style) { - if (color == null) { + public HtmlColorAndStyle(HColor arrowColor, LinkStyle style, HColor arrowHeadColor) { + if (arrowColor == null) { throw new IllegalArgumentException(); } - this.color = color; + this.arrowColor = arrowColor; + this.arrowHeadColor = arrowHeadColor == null ? arrowColor : arrowHeadColor; this.style = style; } - public HtmlColor getColor() { - return color; + public HColor getArrowColor() { + return arrowColor; + } + + public HColor getArrowHeadColor() { + return arrowHeadColor; } public LinkStyle getStyle() { return style; } + static final public StyleSignature getDefaultStyleDefinitionArrow() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow); + } + public static HtmlColorAndStyle build(ISkinParam skinParam, String definition) { - HtmlColor color = build(skinParam).getColors().get(0).color; + HColor arrowColor; + HColor arrowHeadColor = null; + if (SkinParam.USE_STYLES()) { + final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam.getCurrentStyleBuilder()); + arrowColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); + } else { + arrowColor = Rainbow.build(skinParam).getColors().get(0).arrowColor; + arrowColor = Rainbow.build(skinParam).getColors().get(0).arrowHeadColor; + } LinkStyle style = LinkStyle.NORMAL(); - final IHtmlColorSet set = skinParam.getIHtmlColorSet(); + final HColorSet set = skinParam.getIHtmlColorSet(); for (String s : definition.split(",")) { final LinkStyle tmpStyle = LinkStyle.fromString1(s); if (tmpStyle.isNormal() == false) { style = tmpStyle; continue; } - final HtmlColor tmpColor = set.getColorIfValid(s); + final HColor tmpColor = set.getColorIfValid(s); if (tmpColor != null) { - color = tmpColor; + arrowColor = tmpColor; } } - return new HtmlColorAndStyle(color, style); + return new HtmlColorAndStyle(arrowColor, style, arrowHeadColor); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HtmlColorUserDef.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HtmlColorUserDef.java deleted file mode 100644 index d65b24fb7..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HtmlColorUserDef.java +++ /dev/null @@ -1,35 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.graphic; - -public class HtmlColorUserDef implements HtmlColor { - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HtmlCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HtmlCommand.java index c8409f45a..f8a6c50bd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HtmlCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HtmlCommand.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HtmlCommandFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HtmlCommandFactory.java index 6ac9faa4e..1b7398793 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HtmlCommandFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/HtmlCommandFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Img.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Img.java index 49f485784..8cf573c5d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Img.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Img.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,12 +31,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.image.BufferedImage; -import java.io.ByteArrayOutputStream; -import java.io.File; import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; import net.sourceforge.plantuml.FileSystem; import net.sourceforge.plantuml.FileUtils; @@ -44,12 +39,15 @@ 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.security.SFile; +import net.sourceforge.plantuml.security.SURL; public class Img implements HtmlCommand { final static private Pattern2 srcPattern = MyPattern.cmpile("(?i)src[%s]*=[%s]*[\"%q]?([^%s\">]+)[\"%q]?"); final static private Pattern2 vspacePattern = MyPattern.cmpile("(?i)vspace[%s]*=[%s]*[\"%q]?(\\d+)[\"%q]?"); - final static private Pattern2 valignPattern = MyPattern.cmpile("(?i)valign[%s]*=[%s]*[\"%q]?(top|bottom|middle)[\"%q]?"); + final static private Pattern2 valignPattern = MyPattern + .cmpile("(?i)valign[%s]*=[%s]*[\"%q]?(top|bottom|middle)[\"%q]?"); final static private Pattern2 noSrcColonPattern = MyPattern.cmpile("(?i)" + Splitter.imgPatternNoSrcColon); private final TextBlock tileImage; @@ -91,29 +89,36 @@ private static HtmlCommand build(final Matcher2 m, final ImgValign valign, final } final String src = m.group(1); try { - final File f = FileSystem.getInstance().getFile(src); + final SFile f = FileSystem.getInstance().getFile(src); if (f.exists() == false) { // Check if valid URL if (src.startsWith("http:") || src.startsWith("https:")) { -// final byte image[] = getFile(src); -// final BufferedImage read = ImageIO.read(new ByteArrayInputStream(image)); - final BufferedImage read = FileUtils.ImageIO_read(new URL(src)); + final SURL tmp = SURL.create(src); + if (tmp == null) { + return new Text("(Cannot decode: " + src + ")"); + } + final BufferedImage read = tmp.readRasterImageFromURL(); if (read == null) { return new Text("(Cannot decode: " + src + ")"); } return new Img(new TileImage(read, valign, vspace)); } - return new Text("(File not found: " + f + ")"); + return new Text("(Cannot decode: " + f + ")"); } if (f.getName().endsWith(".svg")) { - return new Img(new TileImageSvg(f)); + final String tmp = FileUtils.readSvg(f); + if (tmp == null) { + return new Text("(Cannot decode: " + f + ")"); + } + return new Img(new TileImageSvg(tmp)); } - final BufferedImage read = FileUtils.ImageIO_read(f); + final BufferedImage read = f.readRasterImageFromFile(); if (read == null) { return new Text("(Cannot decode: " + f + ")"); } - return new Img(new TileImage(FileUtils.ImageIO_read(f), valign, vspace)); + return new Img(new TileImage(f.readRasterImageFromFile(), valign, vspace)); } catch (IOException e) { + e.printStackTrace(); return new Text("ERROR " + e.toString()); } } @@ -122,27 +127,4 @@ public TextBlock createMonoImage() { return tileImage; } - // Added by Alain Corbiere - static byte[] getFile(String host) throws IOException { - final ByteArrayOutputStream image = new ByteArrayOutputStream(); - InputStream input = null; - try { - final URL url = new URL(host); - final URLConnection connection = url.openConnection(); - input = connection.getInputStream(); - final byte[] buffer = new byte[1024]; - int read; - while ((read = input.read(buffer)) > 0) { - image.write(buffer, 0, read); - } - image.close(); - return image.toByteArray(); - } finally { - if (input != null) { - input.close(); - } - } - } - // End - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/ImgValign.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/ImgValign.java index 323c73ad7..b3009e971 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/ImgValign.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/ImgValign.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/InnerStrategy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/InnerStrategy.java index 46357cfc1..e4ef74c64 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/InnerStrategy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/InnerStrategy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Line.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Line.java index e980792bd..b46c4e6cd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Line.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Line.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/QuoteUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/QuoteUtils.java index d25ee0099..83847c727 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/QuoteUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/QuoteUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,293 +30,263 @@ */ package net.sourceforge.plantuml.graphic; +import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; public class QuoteUtils { - static private final List quotes = Arrays - .asList("Ur'f qrnq, Wvz.", - "Ol Tenogune'f unzzre, ol gur fbaf bs Jbeina, lbh funyy or niratrq.", - "Ebnqf? Jurer jr'er tbvat, jr qba'g arrq ebnqf.", - "Gur gvzr vf bhg bs wbvag.", - "P'rfg phevrhk purm yrf znevaf pr orfbva qr snver qrf cuenfrf.", - "V'z gnyxvat nobhg gur bgure Crgre, gur bar ba gur bgure fvqr.", - "Znl gur Sbepr or jvgu lbh!", - "Arire tvir hc, arire fheeraqre...", - "Unfgn yn ivfgn, onol.", - "Url, Qbp, jr orggre onpx hc. Jr qba'g unir rabhtu ebnq gb trg hc gb 88.", - "Terrgvatf, Cebsrffbe Snyxra. Funyy jr cynl n tnzr?", - "V pna'g punatr gur ynj bs culfvpf!", - "N fgenatr tnzr. Gur bayl jvaavat zbir vf abg gb cynl.", - "V'z gur Tngrxrrcre, ner lbh gur Xrlznfgre?", - "V nz gur Znfgre Pbageby Cebtenz. Ab bar Hfre jebgr zr.", - "Yvsr? Qba'g gnyx gb zr nobhg yvsr.", - "V nyjnlf gubhtug fbzrguvat jnf shaqnzragnyyl jebat jvgu gur havirefr.", - "N ebobg znl abg vawher n uhzna orvat be, guebhtu vanpgvba, nyybj n uhzna orvat gb pbzr gb unez.", - "Fheeraqre znl or bhe bayl bcgvba.", - "Fvk ol avar. Sbegl gjb.", - "Vg'f yvsr, Wvz, ohg abg nf jr xabj vg.", - "Qba'g Cnavp!", - "Jung qb lbh zrna? Na Nsevpna be Rhebcrna fjnyybj?", - "V arrq lbhe obbgf lbhe pybgurf naq lbhe zbgbeplpyr", - "Lbh sbetbg gb fnl cyrnfr...", - "Lbh unir qvrq bs qlfragrel.", - "Jbhyqa'g lbh cersre n avpr tnzr bs purff?", - "Jura lbh unir ryvzvangrq gur vzcbffvoyr, jungrire erznvaf, ubjrire vzcebonoyr, zhfg or gur gehgu.", - "V xabj abj jul lbh pel. Ohg vg'f fbzrguvat V pna arire qb.", - "Erfvfgnapr vf shgvyr. Lbh jvyy or nffvzvyngrq.", - "Nalguvat qvssrerag vf tbbq.", - "Penpxrq ol Nyqb Erfrg naq Ynherag Ehrvy.", - "V'z obgu. V'z n pryroevgl va na rzretrapl.", - "Qb lbh xabj guvf terng terng cbyvfu npgbe, Wbfrcu Ghen?", - "Gb vasvavgl naq orlbaq!", - "Fcnpr: gur svany sebagvre...", - "Fhe zba ovyyrg, grarm, l n rpevg Fnvag-Ynmner, p'rfg zrf lrhk bh dhbv ?", - "Gur obl vf vzcbegnag. Ur unf gb yvir.", - "Bapr hcba n gvzr va n tnynkl sne, sne njnl...", - "Naq lbh xabj gurer'f n ybat ybat jnl nurnq bs lbh...", - "Na nyyretl gb bkltra? Ryz oyvtug?", - "Ohg nybef lbh ner Serapu!", - "A'nv-wr qbap gnag irph dhr cbhe prggr vasnzvr?", - "Fbzrguvat vf ebggra va gur Fgngr bs Qraznex.", - "Url, jung qb lbh jnag? Zvenpyrf?", - "1.21 tvtnjnggf! 1.21 tvtnjnggf. Terng Fpbgg! ", - "Jung gur uryy vf n tvtnjngg?", - "V arrq n inpngvba.", - "Ba qrienvg wnznvf dhvggre Zbagnhona.", - "Zl sbepr vf n cyngsbez gung lbh pna pyvzo ba...", - "Gurer'f fbzrguvat jrveq, naq vg qba'g ybbx tbbq...", - "Rg evra ienvzrag ar punatr znvf gbhg rfg qvssrerag", - "Ornz zr hc, Fpbggl.", - "Gurer vf ab fcbba.", - "Sbyybj gur juvgr enoovg.", - "Arire fraq n uhzna gb qb n znpuvar'f wbo.", - "Theh zrqvgngvba. Cerff yrsg zbhfr ohggba gb pbagvahr.", - "V qba'g guvax jr'er va Xnafnf nalzber.", - "Yhxr, V nz lbhe sngure.", - "Oybbq, Fjrng naq Grnef", - "Ubhfgba, jr unir n ceboyrz.", - "Xrlobneq snvyher, cerff nal xrl gb pbagvahr", - "Ovt zvfgnxr!", - "Ubj znal HZY qrfvtaref qbrf vg gnxr gb punatr n yvtugohyo ?", - "Qb lbh yvxr zbivrf nobhg tynqvngbef ?", - "Gur fcvevg bs yrneavat vf n ynfgvat sebagvre.", - "Vg vf phevbhf sbe fnvybef guvf arrq sbe znxvat fragraprf.", - "Ubcvat sbe gur orfg, ohg rkcrpgvat gur jbefg", - "Gur jvyy gb tb ba jura V'z uheg qrrc vafvqr.", - "Vs vg oyrrqf, jr pna xvyy vg.", - "Ubhfgba, V unir n onq srryvat nobhg guvf zvffvba.", - "Znzn nyjnlf fnvq yvsr jnf yvxr n obk bs pubpbyngrf. Lbh arire xabj jung lbh'er tbaan trg.", - "Ol gur jnl, vf gurer nalbar ba obneq jub xabjf ubj gb syl n cynar?", - "Qnir, guvf pbairefngvba pna freir ab checbfr nalzber. Tbbqolr.", - "Vg pna bayl or nggevohgnoyr gb uhzna reebe.", - "Ybbxf yvxr V cvpxrq gur jebat jrrx gb dhvg fzbxvat.", - "Lbh uhznaf npg fb fgenatr. Rirelguvat lbh perngr vf hfrq gb qrfgebl.", - "Jurer qvq lbh yrnea ubj gb artbgvngr yvxr gung?", - "Fve, ner lbh pynffvsvrq nf uhzna?", - "Jr'er abg tbaan znxr vg, ner jr?", - "Vg'f va lbhe angher gb qrfgebl lbhefryirf.", - "Gur zber pbagnpg V unir jvgu uhznaf, gur zber V yrnea.", - "Jbhyq vg fnir lbh n ybg bs gvzr vs V whfg tnir hc naq jrag znq abj?", - "Ernyvgl vf serdhragyl vanpphengr.", - "Qba'g oryvrir nalguvat lbh ernq ba gur arg. Rkprcg guvf. Jryy, vapyhqvat guvf, V fhccbfr.", - "N phc bs grn jbhyq erfgber zl abeznyvgl.", - "Nalguvat gung guvaxf ybtvpnyyl pna or sbbyrq ol fbzrguvat ryfr gung guvaxf ng yrnfg nf ybtvpnyyl nf vg qbrf.", - "Va na vasvavgr Havirefr nalguvat pna unccra.", - "Fbzrgvzrf vs lbh erprvirq na nafjre, gur dhrfgvba zvtug or gnxra njnl.", - "Cyrnfr pnyy zr Rqqvr vs vg jvyy uryc lbh gb erynk.", - "V qba'g oryvrir vg. Cebir vg gb zr naq V fgvyy jba'g oryvrir vg.", - "Gbgnyyl znq, hggre abafrafr. Ohg jr'yy qb vg orpnhfr vg'f oevyyvnag abafrafr.", - "Guvf fragrapr vf abg gehr.", - "V jbhyq engure qvr fgnaqvat guna yvir ba zl xarrf.", - "Lbh ner orvat jngpurq.", - "Qvq lbh srrq gurz nsgre zvqavtug?", - "Ubj qb lbh rkcynva fpubby gb uvture vagryyvtrapr?", - "Crbcyr fbzrgvzrf znxr zvfgnxrf.", - "Ybbx, V qba'g unir gvzr sbe n pbairefngvba evtug abj.", - "Nyy ceboyrzf va pbzchgre fpvrapr pna or fbyirq ol nabgure yriry bs vaqverpgvba", - "...rkprcg sbe gur ceboyrz bs gbb znal yriryf bs vaqverpgvba", - "V xabj orpnhfr V ohvyg vg", - "Rira gur fznyyrfg crefba pna punatr gur pbhefr bs gur shgher.", - "Vs lbh ner n sevraq, lbh fcrnx gur cnffjbeq, naq gur qbbef jvyy bcra.", - "Lbh Funyy Abg Cnff", - "73.6% Bs Nyy Fgngvfgvpf Ner Znqr Hc", - "Jr pna arvgure pbasvez abe qral gung guvf vf penfuvat", - "Jura gur orngvat bs lbhe urneg rpubrf gur orngvat bs gur qehzf", - "Arire gehfg n pbzchgre lbh pna'g guebj bhg n jvaqbj", - "Lrnu, V'z pnyz. V'z n pnyz crefba. Vf gurer fbzr ernfba V fubhyqa'g or pnyz?", - "Rirelobql whfg fgnl pnyz. Gur fvghngvba vf haqre pbageby.", - "Uvccl, lbh guvax rirelguvat vf n pbafcvenpl.", - "Gurfr thlf ner nobhg nf zhpu sha nf n gnk nhqvg.", - "Gurer vf fbzrguvat qbja gurer! Fbzrguvat abg hf.", - "V fnj n tyvzcfr bs zl shgher naq rirelguvat'f punatrq sbe zr abj.", - "Va fcnpr ab bar pna urne lbh fpernz", - "V pna'g yvr gb lbh nobhg lbhe punaprf, ohg... lbh unir zl flzcnguvrf.", - "Gurer vf na rkcynangvba sbe guvf, lbh xabj.", - "V'z nsenvq V unir fbzr onq arjf.", - "Qb zr n snibhe. Qvfpbaarpg zr. V pbhyq or erjbexrq, ohg V'yy arire or gbc bs gur yvar ntnva.", - "Gnxr vg rnfl, qba'g chfu gur yvggyr ohggba ba gur wblfgvpx!", - "V'z n irel cevingr crefba.", - "Gb fphycg na ryrcunag sebz n ovt oybpx bs zneoyr, whfg xabpx njnl nyy gur ovgf gung qba'g ybbx yvxr na ryrcunag.", - "Jub fnvq lbh pbhyq gnyx gb zr? Unir V tbg fbzrguvat ba zl snpr ?", - "Jr'ir orra guebhtu jbefg", - "Havgrq jr fgnaq", - "Jr funyy arire fheeraqre", - "Nofbyhgr ubarfgl vfa'g nyjnlf gur zbfg qvcybzngvp abe gur fnsrfg sbez bs pbzzhavpngvba jvgu rzbgvbany orvatf.", - "Vg'f... pbzcyvpngrq.", - "Qb abg bcra hagvy 1985", - "V fgvyy zrff hc ohg V'yy whfg fgneg ntnva", - "V jba'g tvir hc, ab V jba'g tvir va; Gvyy V ernpu gur raq; Naq gura V'yy fgneg ntnva", - "V jnaan gel rira gubhtu V pbhyq snvy", - "Fbzrgvzrf jr pbzr ynfg ohg jr qvq bhe orfg", - "Vs lbh frr fbzrguvat, fnl fbzrguvat", - "Va gurbel gurer vf ab qvssrerapr orgjrra gurbel naq cenpgvpr. Ohg, va cenpgvpr, gurer vf.", - "Vs V pnaabg oevat lbh pbzsbeg gura ng yrnfg V oevat lbh ubcr", - "Jr nyy zhfg yrnea sebz fznyy zvfsbeghar, pbhag gur oyrffvatf gung ner erny", - "Cercner Guerr Frnyrq Rairybcrf...", - "Lbh xabj gung guvat lbh whfg qvq? Qba'g qb gung", - "Vg gbbx zr n ybat gvzr gb haqrefgnaq gung vs lbh jnag gb qb guvf wbo jryy lbh unir gb fgnl qrgnpurq.", - "Qb lbh yvxr lbhe zbeavat grn jrnx be fgebat ?", - "Jvagre vf pbzvat", - "Jung sbbyf gurfr zbegnyf or!", - "Fbzrguvat jvpxrq guvf jnl pbzrf.", - "V guvax V trg vg, jung jnf vg? Cbxre Avtug? Onpurybe Cnegl?", - "Vg'f nyevtug gb or fpnerq. Erzrzore, gurer vf ab pbhentr jvgubhg srne.", - "Guebhtu ernqvarff naq qvfpvcyvar jr ner znfgref bs bhe sngr.", - "Jvgu terng cbjre pbzrf terng erfcbafvovyvgl", - "Vs n znpuvar pna yrnea gur inyhr bs uhzna yvsr, znlor jr pna gbb ?", - "Bayl tbvat sbejneq 'pnhfr jr pna'g svaq erirefr.", - "Jr'er abg tbaan fvg va fvyrapr, jr'er abg tbaan yvir jvgu srne", - "Oba, qnaf qvk zvahgrf wr abhf pbafvqrer pbzzr qrsvavgvirzrag creqhf.", - "Pn fren fherzrag ovra dhnaq pn fren svav.", - "Vg'f gur ynfg cvrpr bs gur chmmyr ohg lbh whfg pna'g znxr vg svg", - "Qbpgbe fnlf lbh'er pherq ohg lbh fgvyy srry gur cnva", - "Vf negvsvpvny vagryyvtrapr gur rknpg bccbfvgr bs angheny fghcvqvgl ?", - "Sbeprzrag, pn qrcraq, pn qrcnffr...", - "Gurer'f orra n cnggrea bs vafhobeqvangr orunivbe erpragyl.", - "Ab. Jr ner abg na rssrpgvir grnz.", - "Bhe wbo vf abg gb erzrzore... erzrzore?", - "Guvf vf zvffvba pbageby. Ubj ner lbh nyy qbvat guvf ybiryl zbeavat?", - "Vs lbh pbhyq frr lbhe jubyr yvsr ynvq bhg va sebag bs lbh, jbhyq lbh punatr guvatf?", - "Vf guvf n aba-mreb-fhz tnzr?", - "Abj gung'f n cebcre vagebqhpgvba.", - "Rirelguvat unf punatrq naq vg jba'g fgbc punatvat nalgvzr fbba.", - "Jung znxrf lbh qvssrerag znxrf lbh qnatrebhf", - "Qviretrapr vf rkgerzryl qnatrebhf", - "V'z Qviretrag. Naq V pna'g or pbagebyyrq", - "Znl gur bqqf or rire va lbhe snibe", - "Ab WninFpevcg senzrjbexf jrer perngrq qhevat gur jevgvat bs guvf zrffntr.", - "P'rfg cerffr-cherr dhv g'nf vagreebtr ?", - "Ybbx, nygreangvir snpgf ner abg snpgf. Gurl'er snyfrubbqf", - "Guvf vf abg n penfu, guvf vf zber bs na nygreangvir erfhyg.", - "Lbh yrnearq gb cebtenz va SBEGENA qvqa'g lbh?", - "Guvf oht vf n srngher nf qrfpevorq ol gur znexrgvat qrcnegzrag.", - "Abg rirelobql haqrefgnaqf gur uhzbe bs cebtenzzref.", - "Vs lbh yvir na beqvanel yvsr, nyy lbh'yy unir ner beqvanel fgbevrf.", - "Pbzr jvgu zr vs lbh jnag gb yvir", - "Gh y'nf gebhir bh pryhv-yn ?", - "Qb lbh ernyyl guvax lbh unir n punapr ntnvafg hf, Ze. Pbjobl?", - "Nggragvba, jubrire lbh ner, guvf punaary vf erfreirq sbe rzretrapl pnyyf bayl.", - "Qbrf vg fbhaq yvxr V'z beqrevat n cvmmn? ", - "Jr'er tbaan arrq fbzr zber SOV thlf, V thrff.", - "Trg ernql sbe ehfu ubhe", - "V unir gb jnea lbh, V'ir urneq eryngvbafuvcf onfrq ba vagrafr rkcrevraprf arire jbex.", - "Nalguvat ryfr ohg gur onfrzrag gung'yy xrrc guvf ryringbe sebz snyyvat?", - "Vf guvf grfgvat jurgure V'z n ercyvpnag be n yrfovna, Ze. Qrpxneq? ", - "V'ir qbar... dhrfgvbanoyr guvatf", - "Jbhyq lbh... yvxr gb or hctenqrq?", - "Snhg erpbaanvger... p'rfg qh oehgny!", - "Fv ba oevpbynvg cyhf fbhirag, ba nhenvg zbvaf yn grgr nhk orgvfrf.", - "Wr invf yhv snver har beqbaanapr, rg har frirer...", - "Znvf vy pbaanvg cnf Enbhy, pr zrp! vy in nibve ha erirvy cravoyr.", - "W'nv ibhyh rger qvcybzngr n pnhfr qr ibhf gbhf, rivgre dhr yr fnat pbhyr.", - "Vtabenapr oevatf punbf, abg xabjyrqtr.", - "Yrneavat vf nyjnlf n cnvashy cebprff.", - "V'z fbeel, ner lbh sebz gur cnfg ?", - "Unir lbh gevrq gheavat vg bss naq ba ntnva ?", - "Vs lbh qba'g xabj jurer lbh ner tbvat nal ebnq pna gnxr lbh gurer", - "Xrrc pnyz naq cerff Pgey-Nyg-Qry", - "Vs lbh glcr Tbbtyr vagb Tbbtyr, lbh pna oernx gur Vagrearg.", - "V unir cneg bs n cyna.", - "V'z cerggl fher gur nafjre vf: V nz Tebbg.", - "Nalguvat gung pna cbffvoyl tb jebat, qbrf", - "Cyhf pn engr, cyhf ba n qr punapr dhr pn znepur", - "Fb V thrff gur sbeghar gryyre'f evtug...", - "Jura rirelguvat'f tbar jebat fbzrubj...", - "V qba'g jnag gb yvir ba guvf cynarg nalzber", - "Oba, p'rfg y'urher bh yrf fbhiravef fr enzrarag...", - "Fhpprff pbafvfgf bs tbvat sebz snvyher gb snvyher jvgubhg ybff bs raguhfvnfz", - "Vs lbh'er tbvat guebhtu uryy, xrrc tbvat", - "Jre xnzcsg, xnaa ireyvrera. Jre avpug xnzcsg, ung fpuba ireybera.", - "P'rfg nh cvrq qh zhe dhr y'ba ibvg yr zvrhk yr zhe.", - "Jr xabj ubj uhznaf jbex. Gurl ner nyy fb cerqvpgnoyr.", - "Pyrneyl, lbh unir arire zrg n jbzna.", - "Gur qbtznf bs gur dhvrg cnfg ner vanqrdhngr gb gur fgbezl cerfrag", - "Ab jnl gb cerirag guvf, fnlf bayl angvba jurer guvf erthyneyl unccraf", - "L'n dhrydhrf dhrfgvbaf dhv erfgrag fbhf fvyrapr...", - "Vs gurer vf ab fbyhgvba, gurer vf ab ceboyrz", - "V unir zrzbevrf, ohg V pna'g gryy vs gurl'er erny.", - "L n pbzzr ha tbhg nzre ra abhf", - "L n qrf fvyraprf dhv qvfrag ornhpbhc", - "V frr lbh'ir unq fbzr qvfpvcyvanel ceboyrzf va gur cnfg.", - "Cercnengvba vf gur xrl gb fhpprffshy, vapbafcvphbhf gvzr geniry.", - "Vg'f arire gbb yngr gb or jub lbh zvtug unir orra.", - "Rg cbhe nyyre purm Zvpxrl vyf ibag fherzrag cnf pbafgehver har tner gbhf yrf 100 zrgerf", - "Nyy lbhe onfr ner orybat gb hf", - "Znqr ba Rnegu ol uhznaf", - "Jvaaref Qba'g Hfr Qehtf", - "Lbh xabj jung fhecevfrq zr gur zbfg? Vg jnfa'g zrrgvat gurz. Vg jnf zrrgvat lbh.", - "Va jne gurer ner ab jvaaref, bayl jvqbjf", - "Vs lbh guvax guvf Havirefr vf onq, lbh fubhyq frr fbzr bs gur bguref", - "Cnp-Zna'f n onq thl?", - "Zl ernyvgl vf whfg qvssrerag guna lbhef", - "L'ra n dh'bag rffnlr, vyf bag rh qrf ceboyrzrf", - "Gb ree vf uhzna, ohg gb ernyyl sbhy guvatf hc erdhverf n pbzchgre.", - "Vs lbh oryvrir rirelguvat lbh ernq, lbh orggre abg ernq", - "Gurer vf ab ceboyrz fb onq lbh pna'g znxr vg jbefr", - "Pn p'rfg qh ybheq... Ha gehp qr znynqr.", - "V qb abg guvax, gung V guvax.. V guvax.", - "Gurer ner cynprf ybjre guna gur onfrzrag", - "Gurer ner 10 glcrf bs crbcyr: gubfr jub haqrefgnaq ovanel, naq gubfr jub qba'g.", - "Cyrnfr zvaq gur tnc orgjrra gur genva naq gur cyngsbez", - "Nfuvzbgb av tb-puhv xhqnfnv", - "Vs lbh'er erprvivat guvf genafzvffvba, znxr ab nggrzcg gb pbzr gb vgf cbvag bs bevtva.", - "Obl, qb V ungr orvat evtug nyy gur gvzr!", - "Jub funirf gur oneore jub funirf nyy gur zra jub qba'g funir gurzfryirf?", - "V haqrefgnaq uhzna rzbgvbaf, nygubhtu V qb abg srry gurz zlfrys.", - "Lbh qvqa'g fnl gur zntvp jbeq!", - "Gurer vf ab ceboyrz gung n ynpx bs fbyhgvba jba'g svanyyl erfbyir.", - "V unir n inthr srryvat bs vzcraqvat zvfsbeghar.", - "Jura lbh'er va gebhoyr, pbashfr rirelguvat", - "Jung gur uryy vf Cebwrpg Ryebaq?", - "Qba'g qvt hc gur ovt obk bs cyhgbavhz, Znex", - "Uryc vf bayl 140 zvyyvba zvyrf njnl.", - "P unf gur fcrrq naq rssvpvrapl bs nffrzoyl ynathntr pbzovarq jvgu ernqnovyvgl bs nffrzoyl ynathntr", - "Crey vf gur bayl ynathntr gung ybbxf gur fnzr orsber naq nsgre EFN rapelcgvba", - "Gur zber vg snvyf, gur zber yvxryl vg vf gung vg jvyy jbex", - "V ubcr V qvqa'g gnxr hc gbb zhpu bs lbhe gvzr", "Lbh'er tbaan arrq n ovttre obng", - "Dhnaq ibhf rgrf rzorgrf, rzoebhvyyrm gbhg", "Gurer nva'g ab phevat jung'f jebat jvgu gung guvat", - "Vs lbh cevpx hf, qb jr abg oyrrq?", "V qvq lbhe wbo bapr - V jnf tbbq ng vg.", - "Vyf cbheenvrag snver har fryrpgvba nh fgnaqneq...", "Gung'f ab jnl gb gerng n sevraq.", - "Ubjrire ornhgvshy gur fgengrtl, lbh fubhyq bppnfvbanyyl ybbx ng gur erfhygf", - "Qba'g svk vg vs vg'f abg oebxra", - "Fhqqrayl V'z gnxvat fhttrfgvbaf sebz fbzr fgebat-nez zna jvgu na VD bs zvahf 50.", - "Fur ehvaf rirelguvat fur'f va. Fur ehvaf guvatf fur'f abg rira va.", - "Byvir, V guvax lbh fubhyq xabj guvf: lbh'er n ubeevoyr npgerff.", - "Lbh'er yngr! Qb lbh unir ab pbaprcg bs gvzr ?", - "P'zba zna, yrg'f qb fbzrguvat gung ernyyl pbbxf.", - "Nh sbaq, znvagranag, yrf qvcybzngrf ceraqenvrag cyhgbg yr cnf fhe yrf ubzzrf q'npgvba.", - "Whfg zragnyyl gubhtu... ner lbh bxnl ?", "Jr xabj fur'f bxnl orpnhfr fur'f oybaq", - "Gh oyhssrf Znegbav", "Lbh thlf ner trggvat cnvq?", - "Gurer'f n erq guvatl zbivat gbjneqf gur terra guvatl... V guvax jr'er gur terra guvatl", - "Nyy flfgrzf ner shapgvbavat Pbzznaqre"); + static private final List quotes = Arrays.asList("Ur'f qrnq, Wvz.", + "Ol Tenogune'f unzzre, ol gur fbaf bs Jbeina, lbh funyy or niratrq.", + "Ebnqf? Jurer jr'er tbvat, jr qba'g arrq ebnqf.", "Gur gvzr vf bhg bs wbvag.", + "P'rfg phevrhk purm yrf znevaf pr orfbva qr snver qrf cuenfrf.", + "V'z gnyxvat nobhg gur bgure Crgre, gur bar ba gur bgure fvqr.", "Znl gur Sbepr or jvgu lbh!", + "Arire tvir hc, arire fheeraqre...", "Unfgn yn ivfgn, onol.", + "Url, Qbp, jr orggre onpx hc. Jr qba'g unir rabhtu ebnq gb trg hc gb 88.", + "Terrgvatf, Cebsrffbe Snyxra. Funyy jr cynl n tnzr?", "V pna'g punatr gur ynj bs culfvpf!", + "N fgenatr tnzr. Gur bayl jvaavat zbir vf abg gb cynl.", "V'z gur Tngrxrrcre, ner lbh gur Xrlznfgre?", + "V nz gur Znfgre Pbageby Cebtenz. Ab bar Hfre jebgr zr.", "Yvsr? Qba'g gnyx gb zr nobhg yvsr.", + "V nyjnlf gubhtug fbzrguvat jnf shaqnzragnyyl jebat jvgu gur havirefr.", + "N ebobg znl abg vawher n uhzna orvat be, guebhtu vanpgvba, nyybj n uhzna orvat gb pbzr gb unez.", + "Fheeraqre znl or bhe bayl bcgvba.", "Fvk ol avar. Sbegl gjb.", "Vg'f yvsr, Wvz, ohg abg nf jr xabj vg.", + "Qba'g Cnavp!", "Jung qb lbh zrna? Na Nsevpna be Rhebcrna fjnyybj?", + "V arrq lbhe obbgf lbhe pybgurf naq lbhe zbgbeplpyr", "Lbh sbetbg gb fnl cyrnfr...", + "Lbh unir qvrq bs qlfragrel.", "Jbhyqa'g lbh cersre n avpr tnzr bs purff?", + "Jura lbh unir ryvzvangrq gur vzcbffvoyr, jungrire erznvaf, ubjrire vzcebonoyr, zhfg or gur gehgu.", + "V xabj abj jul lbh pel. Ohg vg'f fbzrguvat V pna arire qb.", + "Erfvfgnapr vf shgvyr. Lbh jvyy or nffvzvyngrq.", "Nalguvat qvssrerag vf tbbq.", + "Penpxrq ol Nyqb Erfrg naq Ynherag Ehrvy.", "V'z obgu. V'z n pryroevgl va na rzretrapl.", + "Qb lbh xabj guvf terng terng cbyvfu npgbe, Wbfrcu Ghen?", "Gb vasvavgl naq orlbaq!", + "Fcnpr: gur svany sebagvre...", "Fhe zba ovyyrg, grarm, l n rpevg Fnvag-Ynmner, p'rfg zrf lrhk bh dhbv ?", + "Gur obl vf vzcbegnag. Ur unf gb yvir.", "Bapr hcba n gvzr va n tnynkl sne, sne njnl...", + "Naq lbh xabj gurer'f n ybat ybat jnl nurnq bs lbh...", "Na nyyretl gb bkltra? Ryz oyvtug?", + "Ohg nybef lbh ner Serapu!", "A'nv-wr qbap gnag irph dhr cbhe prggr vasnzvr?", + "Fbzrguvat vf ebggra va gur Fgngr bs Qraznex.", "Url, jung qb lbh jnag? Zvenpyrf?", + "1.21 tvtnjnggf! 1.21 tvtnjnggf. Terng Fpbgg! ", "Jung gur uryy vf n tvtnjngg?", "V arrq n inpngvba.", + "Ba qrienvg wnznvf dhvggre Zbagnhona.", "Zl sbepr vf n cyngsbez gung lbh pna pyvzo ba...", + "Gurer'f fbzrguvat jrveq, naq vg qba'g ybbx tbbq...", "Rg evra ienvzrag ar punatr znvf gbhg rfg qvssrerag", + "Ornz zr hc, Fpbggl.", "Gurer vf ab fcbba.", "Sbyybj gur juvgr enoovg.", + "Arire fraq n uhzna gb qb n znpuvar'f wbo.", "Theh zrqvgngvba. Cerff yrsg zbhfr ohggba gb pbagvahr.", + "V qba'g guvax jr'er va Xnafnf nalzber.", "Yhxr, V nz lbhe sngure.", "Oybbq, Fjrng naq Grnef", + "Ubhfgba, jr unir n ceboyrz.", "Xrlobneq snvyher, cerff nal xrl gb pbagvahr", "Ovt zvfgnxr!", + "Ubj znal HZY qrfvtaref qbrf vg gnxr gb punatr n yvtugohyo ?", "Qb lbh yvxr zbivrf nobhg tynqvngbef ?", + "Gur fcvevg bs yrneavat vf n ynfgvat sebagvre.", + "Vg vf phevbhf sbe fnvybef guvf arrq sbe znxvat fragraprf.", "Ubcvat sbe gur orfg, ohg rkcrpgvat gur jbefg", + "Gur jvyy gb tb ba jura V'z uheg qrrc vafvqr.", "Vs vg oyrrqf, jr pna xvyy vg.", + "Ubhfgba, V unir n onq srryvat nobhg guvf zvffvba.", + "Znzn nyjnlf fnvq yvsr jnf yvxr n obk bs pubpbyngrf. Lbh arire xabj jung lbh'er tbaan trg.", + "Ol gur jnl, vf gurer nalbar ba obneq jub xabjf ubj gb syl n cynar?", + "Qnir, guvf pbairefngvba pna freir ab checbfr nalzber. Tbbqolr.", + "Vg pna bayl or nggevohgnoyr gb uhzna reebe.", "Ybbxf yvxr V cvpxrq gur jebat jrrx gb dhvg fzbxvat.", + "Lbh uhznaf npg fb fgenatr. Rirelguvat lbh perngr vf hfrq gb qrfgebl.", + "Jurer qvq lbh yrnea ubj gb artbgvngr yvxr gung?", "Fve, ner lbh pynffvsvrq nf uhzna?", + "Jr'er abg tbaan znxr vg, ner jr?", "Vg'f va lbhe angher gb qrfgebl lbhefryirf.", + "Gur zber pbagnpg V unir jvgu uhznaf, gur zber V yrnea.", + "Jbhyq vg fnir lbh n ybg bs gvzr vs V whfg tnir hc naq jrag znq abj?", "Ernyvgl vf serdhragyl vanpphengr.", + "Qba'g oryvrir nalguvat lbh ernq ba gur arg. Rkprcg guvf. Jryy, vapyhqvat guvf, V fhccbfr.", + "N phc bs grn jbhyq erfgber zl abeznyvgl.", + "Nalguvat gung guvaxf ybtvpnyyl pna or sbbyrq ol fbzrguvat ryfr gung guvaxf ng yrnfg nf ybtvpnyyl nf vg qbrf.", + "Va na vasvavgr Havirefr nalguvat pna unccra.", + "Fbzrgvzrf vs lbh erprvirq na nafjre, gur dhrfgvba zvtug or gnxra njnl.", + "Cyrnfr pnyy zr Rqqvr vs vg jvyy uryc lbh gb erynk.", + "V qba'g oryvrir vg. Cebir vg gb zr naq V fgvyy jba'g oryvrir vg.", + "Gbgnyyl znq, hggre abafrafr. Ohg jr'yy qb vg orpnhfr vg'f oevyyvnag abafrafr.", + "Guvf fragrapr vf abg gehr.", "V jbhyq engure qvr fgnaqvat guna yvir ba zl xarrf.", + "Lbh ner orvat jngpurq.", "Qvq lbh srrq gurz nsgre zvqavtug?", + "Ubj qb lbh rkcynva fpubby gb uvture vagryyvtrapr?", "Crbcyr fbzrgvzrf znxr zvfgnxrf.", + "Ybbx, V qba'g unir gvzr sbe n pbairefngvba evtug abj.", + "Nyy ceboyrzf va pbzchgre fpvrapr pna or fbyirq ol nabgure yriry bs vaqverpgvba", + "...rkprcg sbe gur ceboyrz bs gbb znal yriryf bs vaqverpgvba", "V xabj orpnhfr V ohvyg vg", + "Rira gur fznyyrfg crefba pna punatr gur pbhefr bs gur shgher.", + "Vs lbh ner n sevraq, lbh fcrnx gur cnffjbeq, naq gur qbbef jvyy bcra.", "Lbh Funyy Abg Cnff", + "73.6% Bs Nyy Fgngvfgvpf Ner Znqr Hc", "Jr pna arvgure pbasvez abe qral gung guvf vf penfuvat", + "Jura gur orngvat bs lbhe urneg rpubrf gur orngvat bs gur qehzf", + "Arire gehfg n pbzchgre lbh pna'g guebj bhg n jvaqbj", + "Lrnu, V'z pnyz. V'z n pnyz crefba. Vf gurer fbzr ernfba V fubhyqa'g or pnyz?", + "Rirelobql whfg fgnl pnyz. Gur fvghngvba vf haqre pbageby.", "Uvccl, lbh guvax rirelguvat vf n pbafcvenpl.", + "Gurfr thlf ner nobhg nf zhpu sha nf n gnk nhqvg.", "Gurer vf fbzrguvat qbja gurer! Fbzrguvat abg hf.", + "V fnj n tyvzcfr bs zl shgher naq rirelguvat'f punatrq sbe zr abj.", "Va fcnpr ab bar pna urne lbh fpernz", + "V pna'g yvr gb lbh nobhg lbhe punaprf, ohg... lbh unir zl flzcnguvrf.", + "Gurer vf na rkcynangvba sbe guvf, lbh xabj.", "V'z nsenvq V unir fbzr onq arjf.", + "Qb zr n snibhe. Qvfpbaarpg zr. V pbhyq or erjbexrq, ohg V'yy arire or gbc bs gur yvar ntnva.", + "Gnxr vg rnfl, qba'g chfu gur yvggyr ohggba ba gur wblfgvpx!", "V'z n irel cevingr crefba.", + "Gb fphycg na ryrcunag sebz n ovt oybpx bs zneoyr, whfg xabpx njnl nyy gur ovgf gung qba'g ybbx yvxr na ryrcunag.", + "Jub fnvq lbh pbhyq gnyx gb zr? Unir V tbg fbzrguvat ba zl snpr ?", "Jr'ir orra guebhtu jbefg", + "Havgrq jr fgnaq", "Jr funyy arire fheeraqre", + "Nofbyhgr ubarfgl vfa'g nyjnlf gur zbfg qvcybzngvp abe gur fnsrfg sbez bs pbzzhavpngvba jvgu rzbgvbany orvatf.", + "Vg'f... pbzcyvpngrq.", "Qb abg bcra hagvy 1985", "V fgvyy zrff hc ohg V'yy whfg fgneg ntnva", + "V jba'g tvir hc, ab V jba'g tvir va; Gvyy V ernpu gur raq; Naq gura V'yy fgneg ntnva", + "V jnaan gel rira gubhtu V pbhyq snvy", "Fbzrgvzrf jr pbzr ynfg ohg jr qvq bhe orfg", + "Vs lbh frr fbzrguvat, fnl fbzrguvat", + "Va gurbel gurer vf ab qvssrerapr orgjrra gurbel naq cenpgvpr. Ohg, va cenpgvpr, gurer vf.", + "Vs V pnaabg oevat lbh pbzsbeg gura ng yrnfg V oevat lbh ubcr", + "Jr nyy zhfg yrnea sebz fznyy zvfsbeghar, pbhag gur oyrffvatf gung ner erny", + "Cercner Guerr Frnyrq Rairybcrf...", "Lbh xabj gung guvat lbh whfg qvq? Qba'g qb gung", + "Vg gbbx zr n ybat gvzr gb haqrefgnaq gung vs lbh jnag gb qb guvf wbo jryy lbh unir gb fgnl qrgnpurq.", + "Qb lbh yvxr lbhe zbeavat grn jrnx be fgebat ?", "Jvagre vf pbzvat", "Jung sbbyf gurfr zbegnyf or!", + "Fbzrguvat jvpxrq guvf jnl pbzrf.", "V guvax V trg vg, jung jnf vg? Cbxre Avtug? Onpurybe Cnegl?", + "Vg'f nyevtug gb or fpnerq. Erzrzore, gurer vf ab pbhentr jvgubhg srne.", + "Guebhtu ernqvarff naq qvfpvcyvar jr ner znfgref bs bhe sngr.", + "Jvgu terng cbjre pbzrf terng erfcbafvovyvgl", + "Vs n znpuvar pna yrnea gur inyhr bs uhzna yvsr, znlor jr pna gbb ?", + "Bayl tbvat sbejneq 'pnhfr jr pna'g svaq erirefr.", + "Jr'er abg tbaan fvg va fvyrapr, jr'er abg tbaan yvir jvgu srne", + "Oba, qnaf qvk zvahgrf wr abhf pbafvqrer pbzzr qrsvavgvirzrag creqhf.", + "Pn fren fherzrag ovra dhnaq pn fren svav.", + "Vg'f gur ynfg cvrpr bs gur chmmyr ohg lbh whfg pna'g znxr vg svg", + "Qbpgbe fnlf lbh'er pherq ohg lbh fgvyy srry gur cnva", + "Vf negvsvpvny vagryyvtrapr gur rknpg bccbfvgr bs angheny fghcvqvgl ?", + "Sbeprzrag, pn qrcraq, pn qrcnffr...", "Gurer'f orra n cnggrea bs vafhobeqvangr orunivbe erpragyl.", + "Ab. Jr ner abg na rssrpgvir grnz.", "Bhe wbo vf abg gb erzrzore... erzrzore?", + "Guvf vf zvffvba pbageby. Ubj ner lbh nyy qbvat guvf ybiryl zbeavat?", + "Vs lbh pbhyq frr lbhe jubyr yvsr ynvq bhg va sebag bs lbh, jbhyq lbh punatr guvatf?", + "Vf guvf n aba-mreb-fhz tnzr?", "Abj gung'f n cebcre vagebqhpgvba.", + "Rirelguvat unf punatrq naq vg jba'g fgbc punatvat nalgvzr fbba.", + "Jung znxrf lbh qvssrerag znxrf lbh qnatrebhf", "Qviretrapr vf rkgerzryl qnatrebhf", + "V'z Qviretrag. Naq V pna'g or pbagebyyrq", "Znl gur bqqf or rire va lbhe snibe", + "Ab WninFpevcg senzrjbexf jrer perngrq qhevat gur jevgvat bs guvf zrffntr.", + "P'rfg cerffr-cherr dhv g'nf vagreebtr ?", "Ybbx, nygreangvir snpgf ner abg snpgf. Gurl'er snyfrubbqf", + "Guvf vf abg n penfu, guvf vf zber bs na nygreangvir erfhyg.", + "Lbh yrnearq gb cebtenz va SBEGENA qvqa'g lbh?", + "Guvf oht vf n srngher nf qrfpevorq ol gur znexrgvat qrcnegzrag.", + "Abg rirelobql haqrefgnaqf gur uhzbe bs cebtenzzref.", + "Vs lbh yvir na beqvanel yvsr, nyy lbh'yy unir ner beqvanel fgbevrf.", "Pbzr jvgu zr vs lbh jnag gb yvir", + "Gh y'nf gebhir bh pryhv-yn ?", "Qb lbh ernyyl guvax lbh unir n punapr ntnvafg hf, Ze. Pbjobl?", + "Nggragvba, jubrire lbh ner, guvf punaary vf erfreirq sbe rzretrapl pnyyf bayl.", + "Qbrf vg fbhaq yvxr V'z beqrevat n cvmmn? ", "Jr'er tbaan arrq fbzr zber SOV thlf, V thrff.", + "Trg ernql sbe ehfu ubhe", + "V unir gb jnea lbh, V'ir urneq eryngvbafuvcf onfrq ba vagrafr rkcrevraprf arire jbex.", + "Nalguvat ryfr ohg gur onfrzrag gung'yy xrrc guvf ryringbe sebz snyyvat?", + "Vf guvf grfgvat jurgure V'z n ercyvpnag be n yrfovna, Ze. Qrpxneq? ", "V'ir qbar... dhrfgvbanoyr guvatf", + "Jbhyq lbh... yvxr gb or hctenqrq?", "Snhg erpbaanvger... p'rfg qh oehgny!", + "Fv ba oevpbynvg cyhf fbhirag, ba nhenvg zbvaf yn grgr nhk orgvfrf.", + "Wr invf yhv snver har beqbaanapr, rg har frirer...", + "Znvf vy pbaanvg cnf Enbhy, pr zrp! vy in nibve ha erirvy cravoyr.", + "W'nv ibhyh rger qvcybzngr n pnhfr qr ibhf gbhf, rivgre dhr yr fnat pbhyr.", + "Vtabenapr oevatf punbf, abg xabjyrqtr.", "Yrneavat vf nyjnlf n cnvashy cebprff.", + "V'z fbeel, ner lbh sebz gur cnfg ?", "Unir lbh gevrq gheavat vg bss naq ba ntnva ?", + "Vs lbh qba'g xabj jurer lbh ner tbvat nal ebnq pna gnxr lbh gurer", "Xrrc pnyz naq cerff Pgey-Nyg-Qry", + "Vs lbh glcr Tbbtyr vagb Tbbtyr, lbh pna oernx gur Vagrearg.", "V unir cneg bs n cyna.", + "V'z cerggl fher gur nafjre vf: V nz Tebbg.", "Nalguvat gung pna cbffvoyl tb jebat, qbrf", + "Cyhf pn engr, cyhf ba n qr punapr dhr pn znepur", "Fb V thrff gur sbeghar gryyre'f evtug...", + "Jura rirelguvat'f tbar jebat fbzrubj...", "V qba'g jnag gb yvir ba guvf cynarg nalzber", + "Oba, p'rfg y'urher bh yrf fbhiravef fr enzrarag...", + "Fhpprff pbafvfgf bs tbvat sebz snvyher gb snvyher jvgubhg ybff bs raguhfvnfz", + "Vs lbh'er tbvat guebhtu uryy, xrrc tbvat", + "Jre xnzcsg, xnaa ireyvrera. Jre avpug xnzcsg, ung fpuba ireybera.", + "P'rfg nh cvrq qh zhe dhr y'ba ibvg yr zvrhk yr zhe.", + "Jr xabj ubj uhznaf jbex. Gurl ner nyy fb cerqvpgnoyr.", "Pyrneyl, lbh unir arire zrg n jbzna.", + "Gur qbtznf bs gur dhvrg cnfg ner vanqrdhngr gb gur fgbezl cerfrag", + "Ab jnl gb cerirag guvf, fnlf bayl angvba jurer guvf erthyneyl unccraf", + "L'n dhrydhrf dhrfgvbaf dhv erfgrag fbhf fvyrapr...", "Vs gurer vf ab fbyhgvba, gurer vf ab ceboyrz", + "V unir zrzbevrf, ohg V pna'g gryy vs gurl'er erny.", "L n pbzzr ha tbhg nzre ra abhf", + "L n qrf fvyraprf dhv qvfrag ornhpbhc", "V frr lbh'ir unq fbzr qvfpvcyvanel ceboyrzf va gur cnfg.", + "Cercnengvba vf gur xrl gb fhpprffshy, vapbafcvphbhf gvzr geniry.", + "Vg'f arire gbb yngr gb or jub lbh zvtug unir orra.", + "Rg cbhe nyyre purm Zvpxrl vyf ibag fherzrag cnf pbafgehver har tner gbhf yrf 100 zrgerf", + "Nyy lbhe onfr ner orybat gb hf", "Znqr ba Rnegu ol uhznaf", "Jvaaref Qba'g Hfr Qehtf", + "Lbh xabj jung fhecevfrq zr gur zbfg? Vg jnfa'g zrrgvat gurz. Vg jnf zrrgvat lbh.", + "Va jne gurer ner ab jvaaref, bayl jvqbjf", + "Vs lbh guvax guvf Havirefr vf onq, lbh fubhyq frr fbzr bs gur bguref", "Cnp-Zna'f n onq thl?", + "Zl ernyvgl vf whfg qvssrerag guna lbhef", "L'ra n dh'bag rffnlr, vyf bag rh qrf ceboyrzrf", + "Gb ree vf uhzna, ohg gb ernyyl sbhy guvatf hc erdhverf n pbzchgre.", + "Vs lbh oryvrir rirelguvat lbh ernq, lbh orggre abg ernq", + "Gurer vf ab ceboyrz fb onq lbh pna'g znxr vg jbefr", "Pn p'rfg qh ybheq... Ha gehp qr znynqr.", + "V qb abg guvax, gung V guvax.. V guvax.", "Gurer ner cynprf ybjre guna gur onfrzrag", + "Gurer ner 10 glcrf bs crbcyr: gubfr jub haqrefgnaq ovanel, naq gubfr jub qba'g.", + "Cyrnfr zvaq gur tnc orgjrra gur genva naq gur cyngsbez", "Nfuvzbgb av tb-puhv xhqnfnv", + "Vs lbh'er erprvivat guvf genafzvffvba, znxr ab nggrzcg gb pbzr gb vgf cbvag bs bevtva.", + "Obl, qb V ungr orvat evtug nyy gur gvzr!", + "Jub funirf gur oneore jub funirf nyy gur zra jub qba'g funir gurzfryirf?", + "V haqrefgnaq uhzna rzbgvbaf, nygubhtu V qb abg srry gurz zlfrys.", "Lbh qvqa'g fnl gur zntvp jbeq!", + "Gurer vf ab ceboyrz gung n ynpx bs fbyhgvba jba'g svanyyl erfbyir.", + "V unir n inthr srryvat bs vzcraqvat zvfsbeghar.", "Jura lbh'er va gebhoyr, pbashfr rirelguvat", + "Jung gur uryy vf Cebwrpg Ryebaq?", "Qba'g qvt hc gur ovt obk bs cyhgbavhz, Znex", + "Uryc vf bayl 140 zvyyvba zvyrf njnl.", + "P unf gur fcrrq naq rssvpvrapl bs nffrzoyl ynathntr pbzovarq jvgu ernqnovyvgl bs nffrzoyl ynathntr", + "Crey vf gur bayl ynathntr gung ybbxf gur fnzr orsber naq nsgre EFN rapelcgvba", + "Gur zber vg snvyf, gur zber yvxryl vg vf gung vg jvyy jbex", + "V ubcr V qvqa'g gnxr hc gbb zhpu bs lbhe gvzr", "Lbh'er tbaan arrq n ovttre obng", + "Dhnaq ibhf rgrf rzorgrf, rzoebhvyyrm gbhg", "Gurer nva'g ab phevat jung'f jebat jvgu gung guvat", + "Vs lbh cevpx hf, qb jr abg oyrrq?", "V qvq lbhe wbo bapr - V jnf tbbq ng vg.", + "Vyf cbheenvrag snver har fryrpgvba nh fgnaqneq...", "Gung'f ab jnl gb gerng n sevraq.", + "Ubjrire ornhgvshy gur fgengrtl, lbh fubhyq bppnfvbanyyl ybbx ng gur erfhygf", + "Qba'g svk vg vs vg'f abg oebxra", + "Fhqqrayl V'z gnxvat fhttrfgvbaf sebz fbzr fgebat-nez zna jvgu na VD bs zvahf 50.", + "Fur ehvaf rirelguvat fur'f va. Fur ehvaf guvatf fur'f abg rira va.", + "Byvir, V guvax lbh fubhyq xabj guvf: lbh'er n ubeevoyr npgerff.", + "Lbh'er yngr! Qb lbh unir ab pbaprcg bs gvzr ?", "P'zba zna, yrg'f qb fbzrguvat gung ernyyl pbbxf.", + "Nh sbaq, znvagranag, yrf qvcybzngrf ceraqenvrag cyhgbg yr cnf fhe yrf ubzzrf q'npgvba.", + "Whfg zragnyyl gubhtu... ner lbh bxnl ?", "Jr xabj fur'f bxnl orpnhfr fur'f oybaq", "Gh oyhssrf Znegbav", + "Lbh thlf ner trggvat cnvq?", + "Gurer'f n erq guvatl zbivat gbjneqf gur terra guvatl... V guvax jr'er gur terra guvatl", + "Nyy flfgrzf ner shapgvbavat Pbzznaqre", "V erzrzore gung fbhaq! Gung'f n onq fbhaq!", + "V xabj vg'f uneq sbe lbh gb haqrefgnaq rira fubeg fragraprf", + "Gur havirefr vf shyy bs vagryyvtrag yvsr. Vg'f whfg orra gbb vagryyvtrag gb pbzr urer.", + "Uryyb, jbhyq lbh yvxr gb urne n GPC wbxr ?", "Rirel snvel gnyr arrqf n tbbq byq-snfuvbarq ivyynva", + "Fvapr gurer'f ab pbapyhfvba gb gur cnenqbk gurbel, gurer'f ab jnl gb cebir gurer'f ab cnenqbk.", + "Gnxr zr guebhtu gur qnexarff gb gur oernx bs gur qnl", + "Vg znxrf gur gehgu rira zber vapbzcerurafvoyr orpnhfr rirelguvat vf arj", + "V qba'g xabj ubj ohg V fhqqrayl ybfr pbageby", "Gurer ner zbzragf jura V guvax V'z tbvat penml", + "Jbhyq gung vg jrer fb fvzcyr", "Pnyy gung n xavsr? Guvf vf n xavsr.", "Fhe y'bprna qh grzcf dhv tyvffr...", + "Snvyher serr bcrengvbaf erdhver rkcrevrapr jvgu snvyher.", "Pngnfgebcur vf nyjnlf whfg nebhaq gur pbeare.", + "Orjner bs ohtf va gur nobir pbqr; V unir bayl cebirq vg pbeerpg, abg gevrq vg", + "V'z abg n erny cebtenzzre. V guebj gbtrgure guvatf hagvy vg jbexf gura V zbir ba", + "#qrsvar DHRFGVBA ((oo)||!(oo))", "Pbzchgref ner hfryrff. Gurl pna bayl tvir lbh nafjref", + "Gur Vagrearg? Vf gung guvat fgvyy nebhaq?", + "Va beqre gb haqrefgnaq erphefvba, bar zhfg svefg haqrefgnaq erphefvba", + "Obhagl Uhagvat vf n pbzcyvpngrq cebsrffvba.", + "Znahsnpghere'f cebgbpby qvpgngrf V pna abg or pncgherq. V zhfg frys-qrfgehpg.", "Snvyher vf abg na bcgvba", + "Rirelguvat snvyf nyy gur gvzr", "Gur orfg jnl gb nibvq snvyher vf gb snvy pbafgnagyl", + "Cerzngher bcgvzvmngvba vf gur ebbg bs nyy rivy", "Chgnva, w'ra nv zneer q'nibve gbhwbhef envfba", + "Guvf vf gur jnl", "Cngvrapr lbh zhfg unir zl lbhat cnqnjna", "V gubhtug lbh jrer ba zl fvqr", + "Qba'g cnavp. Abar bs lbh cnavp. Nofbyhgryl ab ernfba gb cnavp.", + "Gung jnf hacyrnfnag. V'z fbeel lbh unq gb frr gung.", "Gur neg bs fvzcyvpvgl vf n chmmyr bs pbzcyrkvgl.", + "Xrrc pnyz naq fgnl ng ubzr", + "Gur terngrfg fubegpbzvat bs gur uhzna enpr vf bhe vanovyvgl gb haqrefgnaq gur rkcbaragvny shapgvba", + "Vs gur Znegvnaf vainqrq rnegu, bhe svefg erfcbafr jbhyq or gb ybjre vagrerfg engrf.", + "Rnfl gvzrf qba'g sbetr punenpgre. Vg'f gur gbhtu gvzrf gung sbetr punenpgre", + "Fbzrgvzrf va beqre gb qb gur evtug guvat, lbh unir gb qb gur jebat guvat.", + "Gur fgeratgu bs WninFpevcg vf gung lbh pna qb nalguvat. Gur jrnxarff vf gung lbh jvyy.", + "Vg'f tbvat gb qvfnccrne. Bar qnl vg'f yvxr n zvenpyr, vg jvyy qvfnccrne. Cebonoyl ol Rnfgre, BX?", + "V'ir sryg vg jnf n oht ybat orsber vg jnf pnyyrq n oht", + "Yrg'f frr guvf nf n pbyyngreny qnzntr sebz fbzr ureq vzzhavgl pybja'f gurbel.", + "Lbh'q unir gb or eryngviryl vagryyvtrag gb ernyvmr ubj fghcvq lbh ner", + "Guvf rkcynvaf abg whfg Ubyyljbbq, ohg nyzbfg gur ragvergl bs Sbk Arjf", + "Gur terngrfg rarzl bs xabjyrqtr vf abg vtabenapr; vg vf gur vyyhfvba bs xabjyrqtr", + "N fghql sbhaq gung vtabenag crbcyr ner zber yvxryl gb oryvrir gurl'er oevyyvnag", + "Dh'rfg-pr dh'ba n qbap n fbaare pbzzr pn, pr zngva ?", "Ernyvgl vf gur bayl guvat gung'f erny", + "V jbhyq tvir zlfrys na N+", "Lbh rire unir frpbaq gubhtugf nobhg fbzrguvat ?", + "V oryvrir vg'f n ebhtu fvghngvba bire gurer", "Whfg fb lbh xabj, V tbg zl yvprafr fhfcraqrq", + "Gunax lbh sbe pubbfvat Bprnavp Nveyvarf", "4-8-15-16-23-42", + "...naq gnk phgf. Gung'yy fubj gurz znegvnaf.", + "Jurarire V srry gur arrq gb rkrepvfr, V yvr qbja hagvy vg tbrf njnl", "Ernyvgl pbagvahrf gb ehva zl yvsr", + "Vs lbh gvpxyr hf, qb jr abg ynhtu?", "V xabj n HQC wbxr, ohg lbh zvtug abg trg vg", + "Chvfdhr prf zlfgrerf abhf qrcnffrag, srvtabaf q'ra rger y'betnavfngrhe.", + "V qba'g gnxr erfcbafvovyvgl ng nyy", + "Gurer'f n jbeq sbe crbcyr jub guvax rirelbar vf pbafcvevat ntnvafg gurz: creprcgvir", + "V'yy yrg gung cnff orpnhfr guvf vf tbbqolr", "V ybir vg jura n cyna pbzrf gbtrgure", + "Znxr hf nyy fnsr. Tb onpx gb lbhe ohaxre", "Gh z'nf qrph, Ongzna", "Gurerfr, p'rfg har pngnfgebcur", + "Vs lbh ner abg rzoneenffrq ol gur svefg irefvba bs lbhe cebqhpg, lbh'ir ynhapurq gbb yngr", + "Zvfgnxrf znqr zl fhpprff: V znxr ehoore renfre", "Ovt Oebgure vf Jngpuvat Lbh.", + "Ab bar'f gnyxvat nobhg yrnivat gur fvatyr znexrg"); private QuoteUtils() { } + static private final List tmp = new ArrayList(); + public static String getSomeQuote() { - final int v = (int) (System.currentTimeMillis() / 1000L); - return quotes.get(v % quotes.size()); + synchronized (tmp) { + if (tmp.size() == 0) { + tmp.addAll(quotes); + Collections.shuffle(tmp); + } + final int size = tmp.size(); + final String result = tmp.get(size - 1); + tmp.remove(size - 1); + return result; + } } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Rainbow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Rainbow.java index 2487efa67..de402ea24 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Rainbow.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Rainbow.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,10 +34,19 @@ import java.util.Collections; import java.util.List; +import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; +import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class Rainbow { + private final static Rose rose = new Rose(); + private final List colors = new ArrayList(); private final int colorArrowSeparationSpace; @@ -54,6 +63,27 @@ public static Rainbow none() { return new Rainbow(0); } + public static Rainbow fromColor(HColor arrowColor, HColor arrowHeadColor) { + if (arrowColor == null) { + return Rainbow.none(); + } + return Rainbow.build(new HtmlColorAndStyle(arrowColor, arrowHeadColor)); + } + + public static Rainbow build(ISkinParam skinParam) { + if (SkinParam.USE_STYLES()) { + throw new IllegalStateException(); + } + final HColor arrow = rose.getHtmlColor(skinParam, ColorParam.arrow); + final HColor arrowHead = rose.getHtmlColor(skinParam, null, ColorParam.arrowHead, ColorParam.arrow); + return fromColor(arrow, arrowHead); + } + + public static Rainbow build(Style style, HColorSet set) { + final HColor color = style.value(PName.LineColor).asColor(set); + return fromColor(color, null); + } + public Rainbow withDefault(Rainbow defaultColor) { if (this.size() == 0) { return defaultColor; @@ -94,8 +124,8 @@ public List getColors() { return Collections.unmodifiableList(colors); } - public HtmlColor getColor() { - return colors.get(0).getColor(); + public HColor getColor() { + return colors.get(0).getArrowColor(); } public int getColorArrowSeparationSpace() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/RemoveStyle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/RemoveStyle.java index 19e999536..c85b88d49 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/RemoveStyle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/RemoveStyle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/ResetFont.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/ResetFont.java index e56af33a5..50cafe2c3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/ResetFont.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/ResetFont.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SimpleTextBlockBordered.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SimpleTextBlockBordered.java index 074087606..e91a464ea 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SimpleTextBlockBordered.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SimpleTextBlockBordered.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,17 +33,17 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.ugraphic.UChangeColor; 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; class SimpleTextBlockBordered extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; - private final HtmlColor color; + private final HColor color; - public SimpleTextBlockBordered(TextBlock textBlock, HtmlColor color) { + public SimpleTextBlockBordered(TextBlock textBlock, HColor color) { this.textBlock = textBlock; this.color = color; } @@ -56,6 +56,6 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { public void drawU(UGraphic ug) { final Dimension2D dim = textBlock.calculateDimension(ug.getStringBounder()); textBlock.drawU(ug.apply(new UTranslate(1, 1))); - ug.apply(new UChangeColor(color)).draw(new URectangle(dim.getWidth(), dim.getHeight())); + ug.apply(color).draw(new URectangle(dim.getWidth(), dim.getHeight())); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SingleLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SingleLine.java index 66885e067..56131babd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SingleLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SingleLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,9 +37,9 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.SpriteContainer; import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; class SingleLine extends AbstractTextBlock implements Line { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SizeChange.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SizeChange.java index dfc0a4295..e48892b77 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SizeChange.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SizeChange.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SkinParameter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SkinParameter.java index 84cbccea7..7c8e55a57 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SkinParameter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SkinParameter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,89 +36,96 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.UStroke; public class SkinParameter { - public static final SkinParameter DATABASE = new SkinParameter("DATABASE", ColorParam.databaseBackground, - ColorParam.databaseBorder, FontParam.DATABASE, FontParam.DATABASE_STEREOTYPE); + public static final SkinParameter DATABASE = new SkinParameter(SName.databse, "DATABASE", + ColorParam.databaseBackground, ColorParam.databaseBorder, FontParam.DATABASE, + FontParam.DATABASE_STEREOTYPE); - public static final SkinParameter ARTIFACT = new SkinParameter("ARTIFACT", ColorParam.artifactBackground, - ColorParam.artifactBorder, FontParam.ARTIFACT, FontParam.ARTIFACT_STEREOTYPE); + public static final SkinParameter ARTIFACT = new SkinParameter(SName.artifact, "ARTIFACT", + ColorParam.artifactBackground, ColorParam.artifactBorder, FontParam.ARTIFACT, + FontParam.ARTIFACT_STEREOTYPE); - public static final SkinParameter COMPONENT1 = new SkinParameter("COMPONENT1", ColorParam.componentBackground, - ColorParam.componentBorder, FontParam.COMPONENT, FontParam.COMPONENT_STEREOTYPE, LineParam.componentBorder, - CornerParam.component); + public static final SkinParameter COMPONENT1 = new SkinParameter(SName.component, "COMPONENT1", + ColorParam.componentBackground, ColorParam.componentBorder, FontParam.COMPONENT, + FontParam.COMPONENT_STEREOTYPE, LineParam.componentBorder, CornerParam.component); - public static final SkinParameter NODE = new SkinParameter("NODE", ColorParam.nodeBackground, + public static final SkinParameter NODE = new SkinParameter(SName.node, "NODE", ColorParam.nodeBackground, ColorParam.nodeBorder, FontParam.NODE, FontParam.NODE_STEREOTYPE); - public static final SkinParameter STORAGE = new SkinParameter("STORAGE", ColorParam.storageBackground, - ColorParam.storageBorder, FontParam.STORAGE, FontParam.STORAGE_STEREOTYPE); + public static final SkinParameter STORAGE = new SkinParameter(SName.storage, "STORAGE", + ColorParam.storageBackground, ColorParam.storageBorder, FontParam.STORAGE, FontParam.STORAGE_STEREOTYPE); - public static final SkinParameter QUEUE = new SkinParameter("QUEUE", ColorParam.queueBackground, + public static final SkinParameter QUEUE = new SkinParameter(SName.queue, "QUEUE", ColorParam.queueBackground, ColorParam.queueBorder, FontParam.QUEUE, FontParam.QUEUE_STEREOTYPE); - public static final SkinParameter STACK = new SkinParameter("STACK", ColorParam.stackBackground, + public static final SkinParameter STACK = new SkinParameter(SName.stack, "STACK", ColorParam.stackBackground, ColorParam.stackBorder, FontParam.STACK, FontParam.STACK_STEREOTYPE); - public static final SkinParameter CLOUD = new SkinParameter("CLOUD", ColorParam.cloudBackground, + public static final SkinParameter CLOUD = new SkinParameter(SName.cloud, "CLOUD", ColorParam.cloudBackground, ColorParam.cloudBorder, FontParam.CLOUD, FontParam.CLOUD_STEREOTYPE); - public static final SkinParameter FRAME = new SkinParameter("FRAME", ColorParam.frameBackground, + public static final SkinParameter FRAME = new SkinParameter(SName.frame, "FRAME", ColorParam.frameBackground, ColorParam.frameBorder, FontParam.FRAME, FontParam.FRAME_STEREOTYPE); - public static final SkinParameter COMPONENT2 = new SkinParameter("COMPONENT2", ColorParam.componentBackground, - ColorParam.componentBorder, FontParam.COMPONENT, FontParam.COMPONENT_STEREOTYPE, LineParam.componentBorder, - CornerParam.component); + public static final SkinParameter COMPONENT2 = new SkinParameter(SName.component, "COMPONENT2", + ColorParam.componentBackground, ColorParam.componentBorder, FontParam.COMPONENT, + FontParam.COMPONENT_STEREOTYPE, LineParam.componentBorder, CornerParam.component); - public static final SkinParameter AGENT = new SkinParameter("AGENT", ColorParam.agentBackground, - ColorParam.agentBorder, FontParam.AGENT, FontParam.AGENT_STEREOTYPE, LineParam.agentBorder, CornerParam.agent); + public static final SkinParameter AGENT = new SkinParameter(SName.agent, "AGENT", ColorParam.agentBackground, + ColorParam.agentBorder, FontParam.AGENT, FontParam.AGENT_STEREOTYPE, LineParam.agentBorder, + CornerParam.agent); - public static final SkinParameter FOLDER = new SkinParameter("FOLDER", ColorParam.folderBackground, + public static final SkinParameter FOLDER = new SkinParameter(SName.folder, "FOLDER", ColorParam.folderBackground, ColorParam.folderBorder, FontParam.FOLDER, FontParam.FOLDER_STEREOTYPE); - public static final SkinParameter FILE = new SkinParameter("FILE", ColorParam.fileBackground, + public static final SkinParameter FILE = new SkinParameter(SName.file, "FILE", ColorParam.fileBackground, ColorParam.fileBorder, FontParam.FILE, FontParam.FILE_STEREOTYPE); - public static final SkinParameter PACKAGE = new SkinParameter("PACKAGE", ColorParam.packageBackground, - ColorParam.packageBorder, FontParam.PACKAGE, FontParam.PACKAGE_STEREOTYPE); + public static final SkinParameter PACKAGE = new SkinParameter(SName.package_, "PACKAGE", + ColorParam.packageBackground, ColorParam.packageBorder, FontParam.PACKAGE, FontParam.PACKAGE_STEREOTYPE); - public static final SkinParameter CARD = new SkinParameter("CARD", ColorParam.cardBackground, - ColorParam.cardBorder, FontParam.CARD, FontParam.CARD_STEREOTYPE, LineParam.cardBorder, - CornerParam.card); + public static final SkinParameter CARD = new SkinParameter(SName.card, "CARD", ColorParam.cardBackground, + ColorParam.cardBorder, FontParam.CARD, FontParam.CARD_STEREOTYPE, LineParam.cardBorder, CornerParam.card); - public static final SkinParameter RECTANGLE = new SkinParameter("RECTANGLE", ColorParam.rectangleBackground, - ColorParam.rectangleBorder, FontParam.RECTANGLE, FontParam.RECTANGLE_STEREOTYPE, LineParam.rectangleBorder, - CornerParam.rectangle); + public static final SkinParameter RECTANGLE = new SkinParameter(SName.rectangle, "RECTANGLE", + ColorParam.rectangleBackground, ColorParam.rectangleBorder, FontParam.RECTANGLE, + FontParam.RECTANGLE_STEREOTYPE, LineParam.rectangleBorder, CornerParam.rectangle); - public static final SkinParameter ARCHIMATE = new SkinParameter("ARCHIMATE", ColorParam.archimateBackground, - ColorParam.archimateBorder, FontParam.ARCHIMATE, FontParam.ARCHIMATE_STEREOTYPE, LineParam.archimateBorder, - CornerParam.archimate); + public static final SkinParameter ARCHIMATE = new SkinParameter(SName.archimate, "ARCHIMATE", + ColorParam.archimateBackground, ColorParam.archimateBorder, FontParam.ARCHIMATE, + FontParam.ARCHIMATE_STEREOTYPE, LineParam.archimateBorder, CornerParam.archimate); - public static final SkinParameter COLLECTIONS = new SkinParameter("COLLECTIONS", ColorParam.collectionsBackground, - ColorParam.collectionsBorder, FontParam.RECTANGLE, FontParam.RECTANGLE_STEREOTYPE); + public static final SkinParameter COLLECTIONS = new SkinParameter(SName.collection, "COLLECTIONS", + ColorParam.collectionsBackground, ColorParam.collectionsBorder, FontParam.RECTANGLE, + FontParam.RECTANGLE_STEREOTYPE); - public static final SkinParameter ACTOR = new SkinParameter("ACTOR", ColorParam.actorBackground, + public static final SkinParameter ACTOR = new SkinParameter(SName.actor, "ACTOR", ColorParam.actorBackground, ColorParam.actorBorder, FontParam.ACTOR, FontParam.ACTOR_STEREOTYPE); - public static final SkinParameter USECASE = new SkinParameter("USECASE", ColorParam.usecaseBackground, - ColorParam.usecaseBorder, FontParam.USECASE, FontParam.USECASE_STEREOTYPE); + public static final SkinParameter USECASE = new SkinParameter(SName.usecase, "USECASE", + ColorParam.usecaseBackground, ColorParam.usecaseBorder, FontParam.USECASE, FontParam.USECASE_STEREOTYPE); - public static final SkinParameter BOUNDARY = new SkinParameter("BOUNDARY", ColorParam.boundaryBackground, - ColorParam.boundaryBorder, FontParam.BOUNDARY, FontParam.BOUNDARY_STEREOTYPE); + public static final SkinParameter BOUNDARY = new SkinParameter(SName.boundary, "BOUNDARY", + ColorParam.boundaryBackground, ColorParam.boundaryBorder, FontParam.BOUNDARY, + FontParam.BOUNDARY_STEREOTYPE); - public static final SkinParameter CONTROL = new SkinParameter("CONTROL", ColorParam.controlBackground, - ColorParam.controlBorder, FontParam.CONTROL, FontParam.CONTROL_STEREOTYPE); + public static final SkinParameter CONTROL = new SkinParameter(SName.control, "CONTROL", + ColorParam.controlBackground, ColorParam.controlBorder, FontParam.CONTROL, FontParam.CONTROL_STEREOTYPE); - public static final SkinParameter ENTITY_DOMAIN = new SkinParameter("ENTITY_DOMAIN", ColorParam.entityBackground, + public static final SkinParameter ENTITY = new SkinParameter(SName.entity, "ENTITY", ColorParam.entityBackground, ColorParam.entityBorder, FontParam.ENTITY, FontParam.ENTITY_STEREOTYPE); - public static final SkinParameter INTERFACE = new SkinParameter("INTERFACE", ColorParam.interfaceBackground, - ColorParam.interfaceBorder, FontParam.INTERFACE, FontParam.INTERFACE_STEREOTYPE); + public static final SkinParameter INTERFACE = new SkinParameter(SName.interface_, "INTERFACE", + ColorParam.interfaceBackground, ColorParam.interfaceBorder, FontParam.INTERFACE, + FontParam.INTERFACE_STEREOTYPE); - public static final SkinParameter PARTICIPANT = new SkinParameter("PARTICIPANT", ColorParam.participantBackground, - ColorParam.participantBorder, FontParam.PARTICIPANT, FontParam.PARTICIPANT_STEREOTYPE); + public static final SkinParameter PARTICIPANT = new SkinParameter(SName.participant, "PARTICIPANT", + ColorParam.participantBackground, ColorParam.participantBorder, FontParam.PARTICIPANT, + FontParam.PARTICIPANT_STEREOTYPE); private final ColorParam colorParamBorder; private final ColorParam colorParamBack; @@ -127,10 +134,21 @@ public class SkinParameter { private final String name; private final LineParam lineParam; private final CornerParam roundParam; + private final SName styleName; + + @Override + public String toString() { + return name; + } + + public SName getStyleName() { + return styleName; + } - private SkinParameter(String name, ColorParam colorParamBack, ColorParam colorParamBorder, FontParam fontParam, - FontParam fontParamStereotype, LineParam lineParam, CornerParam roundParam) { + private SkinParameter(SName styleName, String name, ColorParam colorParamBack, ColorParam colorParamBorder, + FontParam fontParam, FontParam fontParamStereotype, LineParam lineParam, CornerParam roundParam) { this.name = name; + this.styleName = styleName; this.colorParamBack = colorParamBack; this.colorParamBorder = colorParamBorder; this.fontParam = fontParam; @@ -139,9 +157,10 @@ private SkinParameter(String name, ColorParam colorParamBack, ColorParam colorPa this.roundParam = roundParam; } - private SkinParameter(String name, ColorParam colorParamBack, ColorParam colorParamBorder, FontParam fontParam, - FontParam fontParamStereotype) { - this(name, colorParamBack, colorParamBorder, fontParam, fontParamStereotype, null, CornerParam.DEFAULT); + private SkinParameter(SName styleName, String name, ColorParam colorParamBack, ColorParam colorParamBorder, + FontParam fontParam, FontParam fontParamStereotype) { + this(styleName, name, colorParamBack, colorParamBorder, fontParam, fontParamStereotype, null, + CornerParam.DEFAULT); } public String getUpperCaseName() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UGraphicAddAriaLabel.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SpecialText.java similarity index 54% rename from src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UGraphicAddAriaLabel.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SpecialText.java index ccd6af396..2b4d6845d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UGraphicAddAriaLabel.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SpecialText.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,30 +30,33 @@ */ package net.sourceforge.plantuml.graphic; -import net.sourceforge.plantuml.ugraphic.UChange; +import java.awt.geom.Dimension2D; + +import net.sourceforge.plantuml.ugraphic.UEmpty; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UShape; -import net.sourceforge.plantuml.ugraphic.UText; +import net.sourceforge.plantuml.ugraphic.UShapeIgnorableForCompression; +import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.comp.CompressionMode; + +public class SpecialText implements UShapeIgnorableForCompression { -public class UGraphicAddAriaLabel extends UGraphicDelegator { + private final TextBlock title; - private final String ariaLabel; + public SpecialText(TextBlock title) { + this.title = title; + } - public UGraphicAddAriaLabel(UGraphic ug, String ariaLabel) { - super(ug); - this.ariaLabel = ariaLabel; + public boolean isIgnoreForCompressionOn(CompressionMode mode) { + return true; } - public UGraphic apply(UChange change) { - return new UGraphicAddAriaLabel(getUg().apply(change), ariaLabel); + public void drawWhenCompressed(UGraphic ug, CompressionMode mode) { + final Dimension2D dim = title.calculateDimension(ug.getStringBounder()); + ug.apply(UTranslate.dx(dim.getWidth())).draw(new UEmpty(1, 1)); } - @Override - public void draw(UShape shape) { - if (shape instanceof UText) { - shape = ((UText) shape).withAriaLabel(ariaLabel); - } - super.draw(shape); + public final TextBlock getTitle() { + return title; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Splitter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Splitter.java index 2b0b11435..e71491347 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Splitter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Splitter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,7 +41,7 @@ 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.ugraphic.sprite.SpriteUtils; +import net.sourceforge.plantuml.sprite.SpriteUtils; public class Splitter { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SpriteCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SpriteCommand.java index cbd3455b7..d125da402 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SpriteCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SpriteCommand.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/StringBounder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/StringBounder.java index fc15ef99e..6875f7783 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/StringBounder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/StringBounder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SvgAttributes.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SvgAttributes.java index 4c1f03c85..444d396d8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SvgAttributes.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SvgAttributes.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SvgAttributesChange.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SvgAttributesChange.java index b0469267e..ee7085cdb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SvgAttributesChange.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SvgAttributesChange.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SymbolContext.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SymbolContext.java index 35387f872..29935315c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SymbolContext.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/SymbolContext.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,27 +30,26 @@ */ package net.sourceforge.plantuml.graphic; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorBackground; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; public class SymbolContext { - private final HtmlColor backColor; - private final HtmlColor foreColor; + private final HColor backColor; + private final HColor foreColor; private final UStroke stroke; - private final boolean shadowing; private final double deltaShadow; private final double roundCorner; private final double diagonalCorner; - private SymbolContext(HtmlColor backColor, HtmlColor foreColor, UStroke stroke, boolean shadowing, - double deltaShadow, double roundCorner, double diagonalCorner) { + private SymbolContext(HColor backColor, HColor foreColor, UStroke stroke, double deltaShadow, double roundCorner, + double diagonalCorner) { this.backColor = backColor; this.foreColor = foreColor; this.stroke = stroke; - this.shadowing = shadowing; this.deltaShadow = deltaShadow; this.roundCorner = roundCorner; this.diagonalCorner = diagonalCorner; @@ -68,8 +67,12 @@ final public UGraphic apply(UGraphic ug) { } public UGraphic applyColors(UGraphic ug) { - ug = ug.apply(new UChangeColor(foreColor)); - ug = ug.apply(new UChangeBackColor(backColor)); + ug = ug.apply(foreColor); + if (backColor == null) { + ug = ug.apply(new HColorNone().bg()); + } else { + ug = ug.apply(backColor.bg()); + } return ug; } @@ -78,46 +81,46 @@ public UGraphic applyStroke(UGraphic ug) { } public SymbolContext transparentBackColorToNull() { - if (backColor instanceof HtmlColorTransparent) { - return new SymbolContext(null, foreColor, stroke, shadowing, deltaShadow, roundCorner, diagonalCorner); + if (backColor instanceof HColorBackground) { + return new SymbolContext(((HColorBackground) backColor).getNull(), foreColor, stroke, deltaShadow, + roundCorner, diagonalCorner); } return this; } - public SymbolContext(HtmlColor backColor, HtmlColor foreColor) { - this(backColor, foreColor, new UStroke(), false, 0, 0, 0); + public SymbolContext(HColor backColor, HColor foreColor) { + this(backColor, foreColor, new UStroke(), 0, 0, 0); } - public SymbolContext withShadow(boolean newShadow) { - return new SymbolContext(backColor, foreColor, stroke, newShadow, deltaShadow, roundCorner, diagonalCorner); + public SymbolContext withShadow(double deltaShadow2) { + return new SymbolContext(backColor, foreColor, stroke, deltaShadow2, roundCorner, diagonalCorner); } - public SymbolContext withDeltaShadow(double deltaShadow) { - return new SymbolContext(backColor, foreColor, stroke, deltaShadow != 0, deltaShadow, roundCorner, - diagonalCorner); + public SymbolContext withDeltaShadow(double deltaShadow2) { + return new SymbolContext(backColor, foreColor, stroke, deltaShadow2, roundCorner, diagonalCorner); } public SymbolContext withStroke(UStroke newStroke) { - return new SymbolContext(backColor, foreColor, newStroke, shadowing, deltaShadow, roundCorner, diagonalCorner); + return new SymbolContext(backColor, foreColor, newStroke, deltaShadow, roundCorner, diagonalCorner); } - public SymbolContext withBackColor(HtmlColor backColor) { - return new SymbolContext(backColor, foreColor, stroke, shadowing, deltaShadow, roundCorner, diagonalCorner); + public SymbolContext withBackColor(HColor backColor) { + return new SymbolContext(backColor, foreColor, stroke, deltaShadow, roundCorner, diagonalCorner); } - public SymbolContext withForeColor(HtmlColor foreColor) { - return new SymbolContext(backColor, foreColor, stroke, shadowing, deltaShadow, roundCorner, diagonalCorner); + public SymbolContext withForeColor(HColor foreColor) { + return new SymbolContext(backColor, foreColor, stroke, deltaShadow, roundCorner, diagonalCorner); } public SymbolContext withCorner(double roundCorner, double diagonalCorner) { - return new SymbolContext(backColor, foreColor, stroke, shadowing, deltaShadow, roundCorner, diagonalCorner); + return new SymbolContext(backColor, foreColor, stroke, deltaShadow, roundCorner, diagonalCorner); } - public HtmlColor getBackColor() { + public HColor getBackColor() { return backColor; } - public HtmlColor getForeColor() { + public HColor getForeColor() { return foreColor; } @@ -126,7 +129,7 @@ public UStroke getStroke() { } public boolean isShadowing() { - return shadowing || deltaShadow > 0; + return deltaShadow > 0; } public double getDeltaShadow() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Text.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Text.java index 737b628e4..afa27a6a1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Text.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/Text.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlock.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlock.java index e93786d63..f3803d166 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlock.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlock.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockArrow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockArrow.java index 68ae8b509..04429bb3e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockArrow.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockArrow.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,17 +34,16 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Direction; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class TextBlockArrow extends AbstractTextBlock implements TextBlock { private final double size; private final Direction arrow; - private final HtmlColor color; + private final HColor color; public TextBlockArrow(Direction arrow, FontConfiguration fontConfiguration) { if (arrow == null) { @@ -58,8 +57,8 @@ public TextBlockArrow(Direction arrow, FontConfiguration fontConfiguration) { } public void drawU(UGraphic ug) { - ug = ug.apply(new UChangeBackColor(color)); - ug = ug.apply(new UChangeColor(color)); + ug = ug.apply(color.bg()); + ug = ug.apply(color); int triSize = (int) (size * .8 - 3); if (triSize % 2 == 1) { triSize--; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockBordered.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockBordered.java index d5e40d242..74fe295b2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockBordered.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockBordered.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,30 +33,36 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.creole.SheetBlock2; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.ugraphic.Shadowable; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; 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.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; public class TextBlockBordered extends AbstractTextBlock implements TextBlock { private final double cornersize; - private final HtmlColor backgroundColor; - private final HtmlColor borderColor; - private final double marginX; - private final double marginY; + private final HColor backgroundColor; + private final HColor borderColor; + private final double top; + private final double right; + private final double bottom; + private final double left; private final UStroke stroke; private final boolean withShadow; private final TextBlock textBlock; - TextBlockBordered(TextBlock textBlock, UStroke stroke, HtmlColor borderColor, HtmlColor backgroundColor, + TextBlockBordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor, double cornersize, double marginX, double marginY) { - this.marginX = marginX; - this.marginY = marginY; + this.top = marginY; + this.right = marginX; + this.bottom = marginY; + this.left = marginX; this.cornersize = cornersize; this.textBlock = textBlock; this.withShadow = false; @@ -65,14 +71,28 @@ public class TextBlockBordered extends AbstractTextBlock implements TextBlock { this.backgroundColor = backgroundColor; } - TextBlockBordered(TextBlock textBlock, UStroke stroke, HtmlColor borderColor, HtmlColor backgroundColor, + TextBlockBordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor, + double cornersize, ClockwiseTopRightBottomLeft margins) { + this.top = margins.getTop(); + this.right = margins.getRight(); + this.bottom = margins.getBottom(); + this.left = margins.getLeft(); + this.cornersize = cornersize; + this.textBlock = textBlock; + this.withShadow = false; + this.stroke = stroke; + this.borderColor = borderColor; + this.backgroundColor = backgroundColor; + } + + TextBlockBordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor, double cornersize) { this(textBlock, stroke, borderColor, backgroundColor, cornersize, 6, 5); } private double getTextHeight(StringBounder stringBounder) { final Dimension2D size = textBlock.calculateDimension(stringBounder); - return size.getHeight() + 2 * marginY; + return size.getHeight() + top + bottom; } private double getPureTextWidth(StringBounder stringBounder) { @@ -81,7 +101,7 @@ private double getPureTextWidth(StringBounder stringBounder) { } private double getTextWidth(StringBounder stringBounder) { - return getPureTextWidth(stringBounder) + 2 * marginX; + return getPureTextWidth(stringBounder) + left + right; } public Dimension2D calculateDimension(StringBounder stringBounder) { @@ -111,20 +131,29 @@ public void drawU(UGraphic ug) { if (withShadow) { polygon.setDeltaShadow(4); } - if (noBorder()) { - ug = ug.apply(new UChangeBackColor(backgroundColor)).apply(new UChangeColor(backgroundColor)); + if (backgroundColor == null) { + ug = ug.apply(new HColorNone().bg()); } else { - ug = ug.apply(new UChangeBackColor(backgroundColor)).apply(new UChangeColor(borderColor)); - ug = applyStroke(ug); + ug = ug.apply(backgroundColor.bg()); } + HColor color = noBorder() ? backgroundColor : borderColor; + if (color == null) { + color = new HColorNone(); + } + ug = ug.apply(color); + ug = applyStroke(ug); ug.draw(polygon); - textBlock.drawU(ugOriginal.apply(new UTranslate(marginX, marginY))); + TextBlock toDraw = textBlock; + if (textBlock instanceof SheetBlock2) { + toDraw = ((SheetBlock2) textBlock).enlargeMe(left, right); + } + toDraw.drawU(ugOriginal.apply(color).apply(new UTranslate(left, top))); } private Shadowable getPolygonNormal(final StringBounder stringBounder) { final double height = getTextHeight(stringBounder); final double width = getTextWidth(stringBounder); - return new URectangle(width, height, cornersize, cornersize); + return new URectangle(width, height).rounded(cornersize); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockEmpty.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockEmpty.java index 2445d547c..bcdcdabb2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockEmpty.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockEmpty.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockGeneric.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockGeneric.java index 176ff68d6..db414c413 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockGeneric.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockGeneric.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,19 +32,18 @@ import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class TextBlockGeneric extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; - private final HtmlColor background; - private final HtmlColor border; + private final HColor background; + private final HColor border; - public TextBlockGeneric(TextBlock textBlock, HtmlColor background, HtmlColor border) { + public TextBlockGeneric(TextBlock textBlock, HColor background, HColor border) { this.textBlock = textBlock; this.border = border; this.background = background; @@ -56,8 +55,8 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { } public void drawU(UGraphic ug) { - ug = ug.apply(new UChangeBackColor(background)); - ug = ug.apply(new UChangeColor(border)); + ug = ug.apply(background.bg()); + ug = ug.apply(border); final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug.apply(new UStroke(2, 2, 1)).draw(new URectangle(dim.getWidth(), dim.getHeight())); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockHorizontal.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockHorizontal.java index 94869fb3e..54a6abb66 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockHorizontal.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockHorizontal.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -74,7 +74,7 @@ public void drawU(UGraphic ug) { final double dy = (dimtotal.getHeight() - dimb.getHeight()) / 2; block.drawU(ug.apply(new UTranslate(x, dy))); } else { - block.drawU(ug.apply(new UTranslate(x, 0))); + block.drawU(ug.apply(UTranslate.dx(x))); } x += dimb.getWidth(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockLineBefore.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockLineBefore.java index 8b2146107..1ba20e0ef 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockLineBefore.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockLineBefore.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,9 +36,10 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.svek.Ports; import net.sourceforge.plantuml.svek.WithPorts; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UHorizontalLine; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; public class TextBlockLineBefore extends AbstractTextBlock implements TextBlock, WithPorts { @@ -70,12 +71,16 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { } public void drawU(UGraphic ug) { - final HtmlColor color = ug.getParam().getColor(); + final HColor color = ug.getParam().getColor(); if (title == null) { UHorizontalLine.infinite(1, 1, separator).drawMe(ug); } textBlock.drawU(ug); - ug = ug.apply(new UChangeColor(color)); + if (color == null) { + ug = ug.apply(new HColorNone()); + } else { + ug = ug.apply(color); + } if (title != null) { UHorizontalLine.infinite(1, 1, title, separator).drawMe(ug); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockMarged.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockMarged.java index 77b9a7a17..5f2de476d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockMarged.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockMarged.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,6 +34,7 @@ import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.svek.Ports; import net.sourceforge.plantuml.svek.WithPorts; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -42,26 +43,34 @@ class TextBlockMarged extends AbstractTextBlock implements TextBlock, WithPorts { private final TextBlock textBlock; - private final double x1; - private final double x2; - private final double y1; - private final double y2; + private final double top; + private final double right; + private final double bottom; + private final double left; - TextBlockMarged(TextBlock textBlock, double x1, double x2, double y1, double y2) { + TextBlockMarged(TextBlock textBlock, double top, double right, double bottom, double left) { this.textBlock = textBlock; - this.x1 = x1; - this.x2 = x2; - this.y1 = y1; - this.y2 = y2; + this.top = top; + this.right = right; + this.bottom = bottom; + this.left = left; + } + + TextBlockMarged(TextBlock textBlock, ClockwiseTopRightBottomLeft margins) { + this.textBlock = textBlock; + this.top = margins.getTop(); + this.right = margins.getRight(); + this.bottom = margins.getBottom(); + this.left = margins.getLeft(); } public Dimension2D calculateDimension(StringBounder stringBounder) { final Dimension2D dim = textBlock.calculateDimension(stringBounder); - return Dimension2DDouble.delta(dim, x1 + x2, y1 + y2); + return Dimension2DDouble.delta(dim, left + right, top + bottom); } public void drawU(UGraphic ug) { - final UTranslate translate = new UTranslate(x1, y1); + final UTranslate translate = new UTranslate(left, top); textBlock.drawU(ug.apply(translate)); } @@ -71,12 +80,12 @@ public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, if (parent == null) { return null; } - final UTranslate translate = new UTranslate(x1, y1); + final UTranslate translate = new UTranslate(left, top); return translate.apply(parent); } public Ports getPorts(StringBounder stringBounder) { - return ((WithPorts) textBlock).getPorts(stringBounder).translateY(y1); + return ((WithPorts) textBlock).getPorts(stringBounder).translateY(top); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockMinWidth.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockMinWidth.java index e45633209..df2df350b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockMinWidth.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockMinWidth.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,7 +36,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -class TextBlockMinWidth extends AbstractTextBlock implements TextBlock { +class TextBlockMinWidth extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; private final double minWidth; @@ -56,10 +56,16 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { public void drawU(UGraphic ug) { if (horizontalAlignment == HorizontalAlignment.LEFT) { textBlock.drawU(ug); + } else if (horizontalAlignment == HorizontalAlignment.CENTER) { + final Dimension2D dimText = textBlock.calculateDimension(ug.getStringBounder()); + final Dimension2D dimFull = calculateDimension(ug.getStringBounder()); + final double diffx = dimFull.getWidth() - dimText.getWidth(); + textBlock.drawU(ug.apply(UTranslate.dx(diffx / 2))); } else if (horizontalAlignment == HorizontalAlignment.RIGHT) { - final Dimension2D dim = textBlock.calculateDimension(ug.getStringBounder()); - final double diffx = minWidth - dim.getWidth(); - textBlock.drawU(ug.apply(new UTranslate(diffx, 0))); + final Dimension2D dimText = textBlock.calculateDimension(ug.getStringBounder()); + final Dimension2D dimFull = calculateDimension(ug.getStringBounder()); + final double diffx = dimFull.getWidth() - dimText.getWidth(); + textBlock.drawU(ug.apply(UTranslate.dx(diffx))); } else { throw new UnsupportedOperationException(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockRaw.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockRaw.java index 1b6a0ba44..ffcd071c0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockRaw.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockRaw.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -82,7 +82,7 @@ public void drawU(UGraphic ug) { double y = 0; for (Line line : getLines(ug.getStringBounder())) { - line.drawU(ug.apply(new UTranslate(0, y))); + line.drawU(ug.apply(UTranslate.dy(y))); y += line.calculateDimension(ug.getStringBounder()).getHeight(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockRecentred.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockRecentred.java index c94fd7bbc..e054ba98b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockRecentred.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockRecentred.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,6 +36,7 @@ import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class TextBlockRecentred extends AbstractTextBlock implements TextBlockBackcolored { @@ -72,7 +73,7 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { return minMax.getDimension(); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { if (textBlock instanceof TextBlockBackcolored) { return ((TextBlockBackcolored) textBlock).getBackcolor(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockSimple.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockSimple.java index 4c3274bce..c014a042a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockSimple.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockSimple.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,69 +32,51 @@ import java.awt.geom.Dimension2D; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.StringTokenizer; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.EmbeddedDiagram; -import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.SpriteContainer; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class TextBlockSimple extends AbstractTextBlock implements TextBlock { +public final class TextBlockSimple extends AbstractTextBlock implements TextBlock { - private List lines2; + private List lines; private final Display texts; private final FontConfiguration fontConfiguration; - private final UFont fontForStereotype; private final HorizontalAlignment horizontalAlignment; private final SpriteContainer spriteContainer; private final double maxMessageSize; - private final HtmlColor htmlColorForStereotype; - - protected TextBlockSimple(Display texts, FontConfiguration fontConfiguration, - HorizontalAlignment horizontalAlignment, SpriteContainer spriteContainer, double maxMessageSize) { - this(texts, fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, null, null); - } public TextBlockSimple(Display texts, FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, - SpriteContainer spriteContainer, double maxMessageSize, UFont fontForStereotype, - HtmlColor htmlColorForStereotype) { + SpriteContainer spriteContainer, double maxMessageSize) { this.texts = texts; this.fontConfiguration = fontConfiguration; this.horizontalAlignment = horizontalAlignment; this.spriteContainer = spriteContainer; this.maxMessageSize = maxMessageSize; - this.fontForStereotype = fontForStereotype; - this.htmlColorForStereotype = htmlColorForStereotype; } private List getLines(StringBounder stringBounder) { - if (lines2 == null) { + if (lines == null) { if (stringBounder == null) { throw new IllegalStateException(); } - this.lines2 = new ArrayList(); + this.lines = new ArrayList(); for (CharSequence s : texts) { - if (s instanceof Stereotype) { - lines2.addAll(createLinesForStereotype( - fontConfiguration.forceFont(fontForStereotype, htmlColorForStereotype), (Stereotype) s, - horizontalAlignment, spriteContainer)); - } else if (s instanceof EmbeddedDiagram) { - lines2.add(((EmbeddedDiagram) s).asDraw(null)); + if (s instanceof EmbeddedDiagram) { + lines.add(((EmbeddedDiagram) s).asDraw(null)); } else { addInLines(stringBounder, s.toString()); } } } - return lines2; + return lines; } private void addInLines(StringBounder stringBounder, String s) { @@ -140,11 +122,11 @@ private void addSingleLineNoSpace(String s) { if (s.length() == 0 || MyPattern.mtches(s, "^[%s]*$ ")) { return; } - lines2.add(SingleLine.withSomeHtmlTag(s, fontConfiguration, horizontalAlignment, spriteContainer)); + lines.add(SingleLine.withSomeHtmlTag(s, fontConfiguration, horizontalAlignment, spriteContainer)); } private void addSingleLine(String s) { - lines2.add(SingleLine.withSomeHtmlTag(s, fontConfiguration, horizontalAlignment, spriteContainer)); + lines.add(SingleLine.withSomeHtmlTag(s, fontConfiguration, horizontalAlignment, spriteContainer)); } private double getTextWidth(StringBounder stringBounder, String s) { @@ -152,16 +134,6 @@ private double getTextWidth(StringBounder stringBounder, String s) { return line.calculateDimension(stringBounder).getWidth(); } - private List createLinesForStereotype(FontConfiguration fontConfiguration, Stereotype s, - HorizontalAlignment horizontalAlignment, SpriteContainer spriteContainer) { - assert s.getLabel(Guillemet.DOUBLE_COMPARATOR) != null; - final List result = new ArrayList(); - for (String st : s.getLabels(spriteContainer.guillemet())) { - result.add(SingleLine.withSomeHtmlTag(st, fontConfiguration, horizontalAlignment, spriteContainer)); - } - return Collections.unmodifiableList(result); - } - public Dimension2D calculateDimension(StringBounder stringBounder) { return getTextDimension(stringBounder); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockSprited.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockSprited.java index 2b8debe8c..b21493445 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockSprited.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockSprited.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,27 +33,24 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.SpriteContainer; -import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class TextBlockSprited extends TextBlockSimple { +public class TextBlockSprited extends AbstractTextBlock { + private final TextBlock parent; private final TextBlock sprite; - public TextBlockSprited(TextBlock sprite, Display texts, FontConfiguration fontConfiguration, - HorizontalAlignment horizontalAlignment, SpriteContainer spriteContainer) { - super(texts, fontConfiguration, horizontalAlignment, spriteContainer, 0); + public TextBlockSprited(TextBlock sprite, TextBlock parent) { this.sprite = sprite; + this.parent = parent; } - @Override public Dimension2D calculateDimension(StringBounder stringBounder) { final double widthCircledCharacter = getCircledCharacterWithAndMargin(stringBounder); final double heightCircledCharacter = sprite.calculateDimension(stringBounder).getHeight(); - final Dimension2D dim = super.calculateDimension(stringBounder); + final Dimension2D dim = parent.calculateDimension(stringBounder); return new Dimension2DDouble(dim.getWidth() + widthCircledCharacter, Math.max(heightCircledCharacter, dim.getHeight())); } @@ -62,7 +59,6 @@ private double getCircledCharacterWithAndMargin(StringBounder stringBounder) { return sprite.calculateDimension(stringBounder).getWidth() + 6.0; } - @Override public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); @@ -70,7 +66,7 @@ public void drawU(UGraphic ug) { final double widthCircledCharacter = getCircledCharacterWithAndMargin(stringBounder); - super.drawU(ug.apply(new UTranslate(widthCircledCharacter, 0))); + parent.drawU(ug.apply(UTranslate.dx(widthCircledCharacter))); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockTitle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockTitle.java index e6e7d94a9..1989025f5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockTitle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockTitle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -53,12 +53,12 @@ public class TextBlockTitle implements TextBlock { throw new IllegalArgumentException(); } final LineBreakStrategy lineBreak = LineBreakStrategy.NONE; - textBlock = stringsToDisplay.create(font, HorizontalAlignment.CENTER, spriteContainer, lineBreak, + textBlock = stringsToDisplay.create0(font, HorizontalAlignment.CENTER, spriteContainer, lineBreak, CreoleMode.FULL, null, null); } public final void drawU(UGraphic ug) { - textBlock.drawU(ug.apply(new UTranslate(outMargin, 0))); + textBlock.drawU(ug.apply(UTranslate.dx(outMargin))); } public Dimension2D calculateDimension(StringBounder stringBounder) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockUtils.java index ee6593c93..df337ac6c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,17 +32,16 @@ import java.awt.Font; import java.awt.FontMetrics; -import java.awt.Graphics2D; import java.awt.font.FontRenderContext; import java.awt.font.LineMetrics; import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; -import java.awt.image.BufferedImage; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.CornerParam; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.SkinParam; @@ -50,6 +49,7 @@ import net.sourceforge.plantuml.posimo.Positionable; import net.sourceforge.plantuml.posimo.PositionableImpl; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.ugraphic.LimitFinder; import net.sourceforge.plantuml.ugraphic.MinMax; @@ -57,27 +57,36 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class TextBlockUtils { - public static TextBlock bordered(TextBlock textBlock, UStroke stroke, HtmlColor borderColor, - HtmlColor backgroundColor, double cornersize) { + public static final TextBlock EMPTY_TEXT_BLOCK = TextBlockUtils.empty(0, 0); + + public static TextBlock bordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor, + double cornersize) { return new TextBlockBordered(textBlock, stroke, borderColor, backgroundColor, cornersize); } - public static TextBlock bordered(TextBlock textBlock, UStroke stroke, HtmlColor borderColor, - HtmlColor backgroundColor, double cornersize, double marginX, double marginY) { + public static TextBlock bordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor, + double cornersize, double marginX, double marginY) { return new TextBlockBordered(textBlock, stroke, borderColor, backgroundColor, cornersize, marginX, marginY); } + public static TextBlock bordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor, + double cornersize, ClockwiseTopRightBottomLeft margins) { + return new TextBlockBordered(textBlock, stroke, borderColor, backgroundColor, cornersize, margins); + } + public static TextBlock title(FontConfiguration font, Display stringsToDisplay, ISkinParam skinParam) { - // if (SkinParam.USE_STYLES()) { - // throw new UnsupportedOperationException(); - // } + if (SkinParam.USE_STYLES()) { + throw new UnsupportedOperationException(); + } UStroke stroke = skinParam.getThickness(LineParam.titleBorder, null); final Rose rose = new Rose(); - HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.titleBorder); - final HtmlColor backgroundColor = rose.getHtmlColor(skinParam, ColorParam.titleBackground); + HColor borderColor = rose.getHtmlColor(skinParam, ColorParam.titleBorder); + final HColor backgroundColor = rose.getHtmlColor(skinParam, ColorParam.titleBackground); final TextBlockTitle result = new TextBlockTitle(font, stringsToDisplay, skinParam); if (stroke == null && borderColor == null) { return result; @@ -86,22 +95,27 @@ public static TextBlock title(FontConfiguration font, Display stringsToDisplay, stroke = new UStroke(1.5); } if (borderColor == null) { - borderColor = HtmlColorUtils.BLACK; + borderColor = HColorUtils.BLACK; } final double corner = skinParam.getRoundCorner(CornerParam.titleBorder, null); return withMargin(bordered(result, stroke, borderColor, backgroundColor, corner), 2, 2); } public static TextBlock withMargin(TextBlock textBlock, double marginX, double marginY) { - return new TextBlockMarged(textBlock, marginX, marginX, marginY, marginY); + return new TextBlockMarged(textBlock, marginY, marginX, marginY, marginX); + } + + public static TextBlock withMargin(TextBlock textBlock, ClockwiseTopRightBottomLeft margins) { + return new TextBlockMarged(textBlock, margins); } public static TextBlock withMargin(TextBlock textBlock, double marginX1, double marginX2, double marginY1, double marginY2) { - return new TextBlockMarged(textBlock, marginX1, marginX2, marginY1, marginY2); + return new TextBlockMarged(textBlock, marginY1, marginX2, marginY2, marginX1); } - public static TextBlock withMinWidth(TextBlock textBlock, double minWidth, HorizontalAlignment horizontalAlignment) { + public static TextBlock withMinWidth(TextBlock textBlock, double minWidth, + HorizontalAlignment horizontalAlignment) { return new TextBlockMinWidth(textBlock, minWidth, horizontalAlignment); } @@ -120,32 +134,42 @@ public static Positionable asPositionable(TextBlock textBlock, StringBounder str return new PositionableImpl(pt, textBlock.calculateDimension(stringBounder)); } + public static Positionable asPositionable(Dimension2D dim, StringBounder stringBounder, Point2D pt) { + return new PositionableImpl(pt, dim); + } + public static TextBlock mergeLR(TextBlock b1, TextBlock b2, VerticalAlignment verticallAlignment) { + if (b1 == EMPTY_TEXT_BLOCK) { + return b2; + } + if (b2 == EMPTY_TEXT_BLOCK) { + return b1; + } return new TextBlockHorizontal(b1, b2, verticallAlignment); } public static TextBlock mergeTB(TextBlock b1, TextBlock b2, HorizontalAlignment horizontalAlignment) { + if (b1 == EMPTY_TEXT_BLOCK) { + return b2; + } + if (b2 == EMPTY_TEXT_BLOCK) { + return b1; + } return new TextBlockVertical2(b1, b2, horizontalAlignment); } - // public static TextBlockBackcolored mergeColoredTB(TextBlockBackcolored b1, TextBlockBackcolored b2, + // public static TextBlockBackcolored mergeColoredTB(TextBlockBackcolored b1, + // TextBlockBackcolored b2, // HorizontalAlignment horizontalAlignment) { // return addBackcolor(mergeTB(b1, b2, horizontalAlignment), b1.getBackcolor()); // } - public static MinMax getMinMax(TextBlock tb, StringBounder stringBounder) { - final LimitFinder limitFinder = new LimitFinder(stringBounder, false); + public static MinMax getMinMax(UDrawable tb, StringBounder stringBounder, boolean initToZero) { + final LimitFinder limitFinder = new LimitFinder(stringBounder, initToZero); tb.drawU(limitFinder); return limitFinder.getMinMax(); } - private static final Graphics2D gg; - - static { - final BufferedImage imDummy = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB); - gg = imDummy.createGraphics(); - } - public static boolean isEmpty(TextBlock text, StringBounder dummyStringBounder) { if (text == null) { return true; @@ -155,15 +179,15 @@ public static boolean isEmpty(TextBlock text, StringBounder dummyStringBounder) } public static FontRenderContext getFontRenderContext() { - return gg.getFontRenderContext(); + return FileFormat.gg.getFontRenderContext(); } public static LineMetrics getLineMetrics(UFont font, String text) { - return font.getLineMetrics(gg, text); + return font.getLineMetrics(FileFormat.gg, text); } public static FontMetrics getFontMetrics(Font font) { - return gg.getFontMetrics(font); + return FileFormat.gg.getFontMetrics(font); } public static TextBlock fullInnerPosition(final TextBlock bloc, final String display) { @@ -192,7 +216,7 @@ public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, }; } - public static TextBlockBackcolored addBackcolor(final TextBlock text, final HtmlColor backColor) { + public static TextBlockBackcolored addBackcolor(final TextBlock text, final HColor backColor) { return new TextBlockBackcolored() { public void drawU(UGraphic ug) { text.drawU(ug); @@ -210,7 +234,7 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { return text.calculateDimension(stringBounder); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return backColor; } }; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockVertical2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockVertical2.java index e525d9977..f1c05987c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockVertical2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockVertical2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,11 +39,10 @@ import net.sourceforge.plantuml.svek.Ports; import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.svek.WithPorts; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; 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; public class TextBlockVertical2 extends AbstractTextBlock implements TextBlock, WithPorts { @@ -75,20 +74,18 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { public void drawU(UGraphic ug) { double y = 0; final Dimension2D dimtotal = calculateDimension(ug.getStringBounder()); - // if (backColor != null) { - // ug.apply(new UChangeColor(backColor)).apply(new UChangeBackColor(backColor)).draw(new URectangle(dimtotal)); - // } + for (TextBlock block : blocks) { final Dimension2D dimb = block.calculateDimension(ug.getStringBounder()); if (block instanceof TextBlockBackcolored) { - final HtmlColor back = ((TextBlockBackcolored) block).getBackcolor(); + final HColor back = ((TextBlockBackcolored) block).getBackcolor(); if (back != null) { - ug.apply(new UTranslate(0, y)).apply(new UChangeColor(back)).apply(new UChangeBackColor(back)) + ug.apply(UTranslate.dy(y)).apply(back).apply(back.bg()) .draw(new URectangle(dimtotal.getWidth(), dimb.getHeight())); } } if (horizontalAlignment == HorizontalAlignment.LEFT) { - block.drawU(ug.apply(new UTranslate(0, y))); + block.drawU(ug.apply(UTranslate.dy(y))); } else if (horizontalAlignment == HorizontalAlignment.CENTER) { final double dx = (dimtotal.getWidth() - dimb.getWidth()) / 2; block.drawU(ug.apply(new UTranslate(dx, y))); @@ -122,7 +119,7 @@ public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, final Dimension2D dimb = block.calculateDimension(stringBounder); final Rectangle2D result = block.getInnerPosition(member, stringBounder, strategy); if (result != null) { - return new UTranslate(0, y).apply(result); + return UTranslate.dy(y).apply(result); } y += dimb.getHeight(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockWidth.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockWidth.java index 58acab1d6..5bd3aaab2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockWidth.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockWidth.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockWidthAdapter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockWidthAdapter.java index ce13a9775..4e800130e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockWidthAdapter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockWidthAdapter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockWithUrl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockWithUrl.java index ab9aab790..0a6957edb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockWithUrl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextBlockWithUrl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -58,7 +58,7 @@ private TextBlockWithUrl(TextBlock block, Url url) { public void drawU(UGraphic ug) { ug.startUrl(url); block.drawU(ug); - ug.closeAction(); + ug.closeUrl(); } public Dimension2D calculateDimension(StringBounder stringBounder) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextLink.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextLink.java index f1e367e8e..86aec787e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextLink.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TextLink.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TileImage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TileImage.java index f9e726d39..397a6640c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TileImage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TileImage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,6 +34,8 @@ import java.awt.image.BufferedImage; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.ugraphic.AffineTransformType; +import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -56,7 +58,8 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { } public void drawU(UGraphic ug) { - ug.apply(new UTranslate(0, vspace)).draw(new UImage(image)); + ug.apply(UTranslate.dy(vspace)) + .draw(new UImage(new PixelImage(image, AffineTransformType.TYPE_BILINEAR))); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TileImageSvg.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TileImageSvg.java index 20316ca9b..4c91ddc9a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TileImageSvg.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TileImageSvg.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,11 +31,8 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; -import java.io.File; -import java.io.IOException; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.FileUtils; import net.sourceforge.plantuml.SvgString; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImageSvg; @@ -44,12 +41,8 @@ public class TileImageSvg extends AbstractTextBlock implements TextBlock { private final UImageSvg svg; - public TileImageSvg(File svgFile) throws IOException { - this.svg = createSvg(svgFile); - } - - private UImageSvg createSvg(File svgFile) throws IOException { - return new UImageSvg(new SvgString(FileUtils.readSvg(svgFile), 1)); + public TileImageSvg(String svg) { + this.svg = new UImageSvg(new SvgString(svg, 1)); } public Dimension2D calculateDimension(StringBounder stringBounder) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TileText.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TileText.java index ce5a56217..200a3944b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TileText.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/TileText.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,7 +36,6 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UText; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -79,7 +78,7 @@ public void drawU(UGraphic ug) { if (url != null) { ug.startUrl(url); } - ug = ug.apply(new UChangeColor(fontConfiguration.getColor())); + ug = ug.apply(fontConfiguration.getColor()); final StringTokenizer tokenizer = new StringTokenizer(text, "\t", true); @@ -106,7 +105,7 @@ public void drawU(UGraphic ug) { } } if (url != null) { - ug.closeAction(); + ug.closeUrl(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UDrawable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UDrawable.java index 3989207ff..a11d75926 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UDrawable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UDrawable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UDrawableUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UDrawableUtils.java index e602d9b2e..f6d2ef268 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UDrawableUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UDrawableUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UGraphicDelegator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UGraphicDelegator.java index 9e9737e15..391152ce0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UGraphicDelegator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UGraphicDelegator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,21 +31,20 @@ package net.sourceforge.plantuml.graphic; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; public abstract class UGraphicDelegator implements UGraphic { final private UGraphic ug; - + @Override public String toString() { return super.toString() + " " + getUg().toString(); } - public final boolean matchesProperty(String propertyName) { return ug.matchesProperty(propertyName); } @@ -74,14 +73,22 @@ public void startUrl(Url url) { ug.startUrl(url); } - public void closeAction() { - ug.closeAction(); + public void closeUrl() { + ug.closeUrl(); + } + + public void startGroup(String groupId) { + ug.startGroup(groupId); + } + + public void closeGroup() { + ug.closeGroup(); } protected UGraphic getUg() { return ug; } - + public void flushUg() { ug.flushUg(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UGraphicInterceptorUDrawable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UGraphicInterceptorUDrawable.java index 838599d6d..b35a8d5ce 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UGraphicInterceptorUDrawable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UGraphicInterceptorUDrawable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbol.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbol.java index bd58f73ef..54face064 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbol.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbol.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,10 +35,14 @@ import java.util.Map; import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.ComponentStyle; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.creole.Stencil; +import net.sourceforge.plantuml.skin.ActorStyle; +import net.sourceforge.plantuml.svek.PackageStyle; public abstract class USymbol { @@ -51,24 +55,29 @@ public abstract class USymbol { public final static USymbol FRAME = record("FRAME", SkinParameter.FRAME, new USymbolFrame()); public final static USymbol NODE = record("NODE", SkinParameter.NODE, new USymbolNode()); public final static USymbol ARTIFACT = record("ARTIFACT", SkinParameter.ARTIFACT, new USymbolArtifact()); - public final static USymbol PACKAGE = record("PACKAGE", SkinParameter.PACKAGE, new USymbolFolder( - SkinParameter.PACKAGE, true)); - public final static USymbol FOLDER = record("FOLDER", SkinParameter.FOLDER, new USymbolFolder(SkinParameter.FOLDER, - false)); + public final static USymbol PACKAGE = record("PACKAGE", SkinParameter.PACKAGE, + new USymbolFolder(SkinParameter.PACKAGE, true)); + public final static USymbol FOLDER = record("FOLDER", SkinParameter.FOLDER, + new USymbolFolder(SkinParameter.FOLDER, false)); public final static USymbol FILE = record("FILE", SkinParameter.FILE, new USymbolFile()); - public final static USymbol RECTANGLE = record("RECTANGLE", SkinParameter.RECTANGLE, new USymbolRect( - SkinParameter.RECTANGLE)); - public final static USymbol ARCHIMATE = record("ARCHIMATE", SkinParameter.ARCHIMATE, new USymbolRect( - SkinParameter.ARCHIMATE)); - public final static USymbol COLLECTIONS = record("COLLECTIONS", SkinParameter.COLLECTIONS, new USymbolCollections( - SkinParameter.RECTANGLE)); + public final static USymbol RECTANGLE = record("RECTANGLE", SkinParameter.RECTANGLE, + new USymbolRect(SkinParameter.RECTANGLE)); + public final static USymbol LABEL = record("LABEL", SkinParameter.RECTANGLE, + new USymbolLabel(SkinParameter.RECTANGLE)); + public final static USymbol ARCHIMATE = record("ARCHIMATE", SkinParameter.ARCHIMATE, + new USymbolRect(SkinParameter.ARCHIMATE)); + public final static USymbol COLLECTIONS = record("COLLECTIONS", SkinParameter.COLLECTIONS, + new USymbolCollections(SkinParameter.RECTANGLE)); public final static USymbol AGENT = record("AGENT", SkinParameter.AGENT, new USymbolRect(SkinParameter.AGENT)); - public final static USymbol ACTOR = record("ACTOR", SkinParameter.ACTOR, new USymbolActor()); + public final static USymbol ACTOR_STICKMAN = record("ACTOR_STICKMAN", SkinParameter.ACTOR, + new USymbolActor(ActorStyle.STICKMAN)); + public final static USymbol ACTOR_AWESOME = record("ACTOR_AWESOME", SkinParameter.ACTOR, + new USymbolActor(ActorStyle.AWESOME)); public final static USymbol USECASE = null; public final static USymbol COMPONENT1 = record("COMPONENT1", SkinParameter.COMPONENT1, new USymbolComponent1()); public final static USymbol COMPONENT2 = record("COMPONENT2", SkinParameter.COMPONENT2, new USymbolComponent2()); public final static USymbol BOUNDARY = record("BOUNDARY", SkinParameter.BOUNDARY, new USymbolBoundary()); - public final static USymbol ENTITY_DOMAIN = record("ENTITY_DOMAIN", SkinParameter.ENTITY_DOMAIN, + public final static USymbol ENTITY_DOMAIN = record("ENTITY_DOMAIN", SkinParameter.ENTITY, new USymbolEntityDomain(2)); public final static USymbol CONTROL = record("CONTROL", SkinParameter.CONTROL, new USymbolControl(2)); public final static USymbol INTERFACE = record("INTERFACE", SkinParameter.INTERFACE, new USymbolInterface()); @@ -99,23 +108,6 @@ public ColorParam getColorParamBorder() { return getSkinParameter().getColorParamBorder(); } - public static USymbol getFromString(String s) { - if (s == null) { - return null; - } - final USymbol result = all.get(StringUtils.goUpperCase(s.replaceAll("\\W", ""))); - if (result == null) { - if (s.equalsIgnoreCase("component")) { - return COMPONENT2; - } - if (s.equalsIgnoreCase("entity")) { - return ENTITY_DOMAIN; - } - return null; - } - return result; - } - private static USymbol record(String code, SkinParameter skinParameter, USymbol symbol) { all.put(StringUtils.goUpperCase(code), symbol); return symbol; @@ -185,7 +177,28 @@ public double getEndingX(StringBounder stringBounder, double y) { }; } - public static USymbol getFromString(String symbol, boolean useUml2ForComponent) { + public static USymbol fromString(String s, ActorStyle actorStyle, ComponentStyle componentStyle, + PackageStyle packageStyle) { + if (s == null) { + return null; + } + if (s.equalsIgnoreCase("package")) { + return packageStyle.toUSymbol(); + } + if (s.equalsIgnoreCase("actor")) { + return actorStyle.toUSymbol(); + } + if (s.equalsIgnoreCase("component")) { + return componentStyle.toUSymbol(); + } + if (s.equalsIgnoreCase("entity")) { + return ENTITY_DOMAIN; + } + final USymbol result = all.get(StringUtils.goUpperCase(s.replaceAll("\\W", ""))); + return result; + } + + public static USymbol fromString(String symbol, ISkinParam skinParam) { USymbol usymbol = null; if (symbol.equalsIgnoreCase("artifact")) { usymbol = USymbol.ARTIFACT; @@ -197,6 +210,8 @@ public static USymbol getFromString(String symbol, boolean useUml2ForComponent) usymbol = USymbol.PACKAGE; } else if (symbol.equalsIgnoreCase("rectangle")) { usymbol = USymbol.RECTANGLE; + } else if (symbol.equalsIgnoreCase("label")) { + usymbol = USymbol.LABEL; } else if (symbol.equalsIgnoreCase("collections")) { usymbol = USymbol.COLLECTIONS; } else if (symbol.equalsIgnoreCase("node")) { @@ -216,9 +231,9 @@ public static USymbol getFromString(String symbol, boolean useUml2ForComponent) } else if (symbol.equalsIgnoreCase("agent")) { usymbol = USymbol.AGENT; } else if (symbol.equalsIgnoreCase("actor")) { - usymbol = USymbol.ACTOR; + usymbol = skinParam.actorStyle().toUSymbol(); } else if (symbol.equalsIgnoreCase("component")) { - usymbol = useUml2ForComponent ? USymbol.COMPONENT2 : USymbol.COMPONENT1; + usymbol = skinParam.componentStyle().toUSymbol(); } else if (symbol.equalsIgnoreCase("boundary")) { usymbol = USymbol.BOUNDARY; } else if (symbol.equalsIgnoreCase("control")) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolActor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolActor.java index f25111eaa..30f3bdf78 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolActor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolActor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,21 +30,28 @@ */ package net.sourceforge.plantuml.graphic; -import net.sourceforge.plantuml.skin.StickMan; +import net.sourceforge.plantuml.skin.ActorStyle; import net.sourceforge.plantuml.ugraphic.UStroke; class USymbolActor extends USymbolSimpleAbstract { + private final ActorStyle actorStyle; + + public USymbolActor(ActorStyle actorStyle) { + this.actorStyle = actorStyle; + + } + @Override public SkinParameter getSkinParameter() { return SkinParameter.ACTOR; } - @Override protected TextBlock getDrawing(SymbolContext symbolContext) { final double deltaShadow = symbolContext.isShadowing() ? 4.0 : 0.0; - return new StickMan(symbolContext.withDeltaShadow(deltaShadow).withStroke(new UStroke(2))); + final SymbolContext tmp = symbolContext.withDeltaShadow(deltaShadow).withStroke(new UStroke(2)); + return actorStyle.getTextBlock(symbolContext); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java index 1090f080b..6e3c34799 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -50,7 +50,7 @@ public SkinParameter getSkinParameter() { private void drawArtifact(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing, double roundCorner) { - final URectangle form = new URectangle(widthTotal, heightTotal, roundCorner, roundCorner); + final URectangle form = new URectangle(widthTotal, heightTotal).rounded(roundCorner); if (shadowing) { form.setDeltaShadow(4); } @@ -75,8 +75,8 @@ private void drawArtifact(UGraphic ug, double widthTotal, double heightTotal, bo final double ySymbol = 5; ug.apply(new UTranslate(xSymbol, ySymbol)).draw(polygon); - ug.apply(new UTranslate(xSymbol + widthSymbol - cornersize, ySymbol)).draw(new ULine(0, cornersize)); - ug.apply(new UTranslate(xSymbol + widthSymbol, ySymbol + cornersize)).draw(new ULine(-cornersize, 0)); + ug.apply(new UTranslate(xSymbol + widthSymbol - cornersize, ySymbol)).draw(ULine.vline(cornersize)); + ug.apply(new UTranslate(xSymbol + widthSymbol, ySymbol + cornersize)).draw(ULine.hline(-cornersize)); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolBoundary.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolBoundary.java index f01577a53..aa729b36d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolBoundary.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolBoundary.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolCard.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolCard.java index 85efe0c29..3f0e4a4e2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolCard.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolCard.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,8 +34,10 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; +import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; class USymbolCard extends USymbol { @@ -52,13 +54,13 @@ public SkinParameter getSkinParameter() { } private void drawCard(UGraphic ug, double width, double height, boolean shadowing, double top, double roundCorner) { - final URectangle shape = new URectangle(width, height, roundCorner, roundCorner); + final URectangle shape = new URectangle(width, height).rounded(roundCorner); if (shadowing) { shape.setDeltaShadow(3.0); } ug.draw(shape); if (top != 0) { - ug.apply(new UTranslate(0, top)).draw(new ULine(width, 0)); + ug.apply(UTranslate.dy(top)).draw(ULine.hline(width)); } } @@ -73,6 +75,7 @@ public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); + ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke()); ug = symbolContext.apply(ug); drawCard(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), 0, symbolContext.getRoundCorner()); @@ -91,7 +94,8 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { @Override public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype, - final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { + final double width, final double height, final SymbolContext symbolContext, + final HorizontalAlignment stereoAlignment) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { @@ -99,8 +103,8 @@ public void drawU(UGraphic ug) { ug = symbolContext.apply(ug); final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder()); final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder()); - drawCard(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), dimTitle.getHeight() - + dimStereo.getHeight() + 4, symbolContext.getRoundCorner()); + drawCard(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), + dimTitle.getHeight() + dimStereo.getHeight() + 4, symbolContext.getRoundCorner()); final double posStereo = (width - dimStereo.getWidth()) / 2; stereotype.drawU(ug.apply(new UTranslate(posStereo, 2))); final double posTitle = (width - dimTitle.getWidth()) / 2; @@ -113,4 +117,9 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { }; } + @Override + public boolean manageHorizontalLine() { + return true; + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolCloud.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolCloud.java index 9dff567e8..ba690bd4f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolCloud.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolCloud.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -60,9 +60,9 @@ public SkinParameter getSkinParameter() { private void drawCloud(UGraphic ug, double width, double height, boolean shadowing) { final UPath shape = getSpecificFrontierForCloud(width, height); if (shadowing) { - // shape.setDeltaShadow(3.0); + shape.setDeltaShadow(3.0); } - ug.apply(new UTranslate(0, 0)).draw(shape); + ug.apply(UTranslate.dy(0)).draw(shape); } private UPath getSpecificFrontierForCloudNew(double width, double height) { @@ -148,7 +148,11 @@ private void specialLine(double bubbleSize, Random rnd, List points, Po private void bubbleLine(Random rnd, List points, Point2D p1, Point2D p2, double bubbleSize) { final CoordinateChange change = new CoordinateChange(p1, p2); final double length = change.getLength(); - final int nb = (int) (length / bubbleSize); + int nb = (int) (length / bubbleSize); + if (nb == 0) { + bubbleSize = length / 2; + nb = (int) (length / bubbleSize); + } for (int i = 0; i < nb; i++) { points.add(rnd(rnd, change.getTrueCoordinate(i * length / nb, 0), bubbleSize * .2)); } @@ -234,7 +238,8 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { @Override public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype, - final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { + final double width, final double height, final SymbolContext symbolContext, + final HorizontalAlignment stereoAlignment) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolCollections.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolCollections.java index 6f9bcb7c2..876e736d6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolCollections.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolCollections.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -60,14 +60,14 @@ public SkinParameter getSkinParameter() { } private void drawCollections(UGraphic ug, double width, double height, boolean shadowing, double roundCorner) { - final URectangle small = new URectangle(width - getDeltaCollection(), height - getDeltaCollection(), - roundCorner, roundCorner); + final URectangle small = new URectangle(width - getDeltaCollection(), height - getDeltaCollection()) + .rounded(roundCorner); if (shadowing) { small.setDeltaShadow(3.0); } ug.apply(new UTranslate(getDeltaCollection(), getDeltaCollection())).draw(small); small.setDeltaShadow(0); - ug.apply(new UTranslate(0, 0)).draw(small); + ug.apply(UTranslate.dy(0)).draw(small); } private Margin getMargin() { @@ -91,8 +91,8 @@ public void drawU(UGraphic ug) { symbolContext.getRoundCorner()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment); - tb.drawU(ug.apply(new UTranslate(margin.getX1() - getDeltaCollection() / 2, margin.getY1() - - getDeltaCollection() / 2))); + tb.drawU(ug.apply(new UTranslate(margin.getX1() - getDeltaCollection() / 2, + margin.getY1() - getDeltaCollection() / 2))); } public Dimension2D calculateDimension(StringBounder stringBounder) { @@ -105,7 +105,8 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { @Override public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype, - final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { + final double width, final double height, final SymbolContext symbolContext, + final HorizontalAlignment stereoAlignment) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java index aad8f5029..5b66ea265 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -50,7 +50,7 @@ public SkinParameter getSkinParameter() { private void drawComponent1(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing, double roundCorner) { - final URectangle form = new URectangle(widthTotal, heightTotal, roundCorner, roundCorner); + final URectangle form = new URectangle(widthTotal, heightTotal).rounded(roundCorner); if (shadowing) { form.setDeltaShadow(4); } @@ -94,9 +94,10 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { } @Override - public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype, - final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { - throw new UnsupportedOperationException(); + public TextBlock asBig(TextBlock title, HorizontalAlignment labelAlignment, TextBlock stereotype, double width, + double height, SymbolContext symbolContext, HorizontalAlignment stereoAlignment) { + return USymbol.COMPONENT2.asBig(title, labelAlignment, stereotype, width, height, symbolContext, + stereoAlignment); } @Override diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java index 239d3af04..2c3108191 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -50,7 +50,7 @@ public SkinParameter getSkinParameter() { private void drawComponent2(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing, double roundCorner) { - final URectangle form = new URectangle(widthTotal, heightTotal, roundCorner, roundCorner); + final URectangle form = new URectangle(widthTotal, heightTotal).rounded(roundCorner); if (shadowing) { form.setDeltaShadow(4); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolControl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolControl.java index 58af96d86..c47b28922 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolControl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolControl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java index 151254d97..4c628a374 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,12 +33,14 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; +import net.sourceforge.plantuml.ugraphic.UEmpty; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UHorizontalLine; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; class USymbolDatabase extends USymbol { @@ -63,7 +65,12 @@ private void drawDatabase(UGraphic ug, double width, double height, boolean shad ug.draw(shape); final UPath closing = getClosingPath(width); - ug.apply(new UChangeBackColor(null)).draw(closing); + ug.apply(new HColorNone().bg()).draw(closing); + + if (SkinParam.USE_STYLES()) { + ug.apply(new UTranslate(width, height)).draw(new UEmpty(10, 10)); + // ug.apply(HColorUtils.BLACK).apply(new UTranslate(width, height)).draw(new URectangle(10, 10)); + } } @@ -93,10 +100,9 @@ public MyUGraphicDatabase(UGraphic ug, double endingX) { protected void drawHline(UGraphic ug, UHorizontalLine line, UTranslate translate) { final UPath closing = getClosingPath(endingX); ug = ug.apply(translate); - ug.apply(line.getStroke()).apply(new UChangeBackColor(null)).apply(new UTranslate(0, -15)).draw(closing); + ug.apply(line.getStroke()).apply(new HColorNone().bg()).apply(UTranslate.dy(-15)).draw(closing); if (line.isDouble()) { - ug.apply(line.getStroke()).apply(new UChangeBackColor(null)).apply(new UTranslate(0, -15 + 2)) - .draw(closing); + ug.apply(line.getStroke()).apply(new HColorNone().bg()).apply(UTranslate.dy(-15 + 2)).draw(closing); } line.drawTitleInternal(ug, 0, endingX, 0, true); } @@ -132,7 +138,8 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { @Override public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype, - final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { + final double width, final double height, final SymbolContext symbolContext, + final HorizontalAlignment stereoAlignment) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java index f32a42852..d700dc9e3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,7 +43,7 @@ public USymbolEntityDomain(double thickness) { @Override public SkinParameter getSkinParameter() { - return SkinParameter.ENTITY_DOMAIN; + return SkinParameter.ENTITY; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolFile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolFile.java index 5176bfc79..798bdb60b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolFile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolFile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolFolder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolFolder.java index 5945f7a88..7900a7288 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolFolder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolFolder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -60,6 +60,11 @@ public USymbolFolder(SkinParameter skinParameter, boolean showTitle) { this.showTitle = showTitle; } + @Override + public String toString() { + return super.toString() + " " + skinParameter + " " + showTitle; + } + @Override public SkinParameter getSkinParameter() { return skinParameter; @@ -110,7 +115,7 @@ private void drawFolder(UGraphic ug, double width, double height, Dimension2D di shape.setDeltaShadow(3.0); } ug.draw(shape); - ug.apply(new UTranslate(0, htitle)).draw(new ULine(wtitle + marginTitleX3, 0)); + ug.apply(UTranslate.dy(htitle)).draw(ULine.hline(wtitle + marginTitleX3)); } private double getHTitle(Dimension2D dimTitle) { @@ -162,7 +167,8 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { @Override public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype, - final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { + final double width, final double height, final SymbolContext symbolContext, + final HorizontalAlignment stereoAlignment) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolFrame.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolFrame.java index 95dac5d22..cef920f3f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolFrame.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolFrame.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,13 +33,14 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; +import net.sourceforge.plantuml.ugraphic.Shadowable; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; class USymbolFrame extends USymbol { @@ -50,8 +51,8 @@ public SkinParameter getSkinParameter() { private void drawFrame(UGraphic ug, double width, double height, Dimension2D dimTitle, boolean shadowing, double roundCorner) { - final URectangle shape = new URectangle(width, height, roundCorner, roundCorner); - shape.setIgnoreForCompression(true); + final Shadowable shape = new URectangle(width, height).rounded(roundCorner).ignoreForCompressionOnX() + .ignoreForCompressionOnY(); if (shadowing) { shape.setDeltaShadow(3.0); } @@ -70,13 +71,14 @@ private void drawFrame(UGraphic ug, double width, double height, Dimension2D dim final double textHeight = getYpos(dimTitle); final UPath polygon = new UPath(); + polygon.setIgnoreForCompressionOnX(); polygon.moveTo(textWidth, 1); polygon.lineTo(textWidth, textHeight - cornersize); polygon.lineTo(textWidth - cornersize, textHeight); polygon.lineTo(0, textHeight); - ug.apply(new UChangeBackColor(null)).draw(polygon); + ug.apply(new HColorNone().bg()).draw(polygon); } @@ -100,8 +102,8 @@ public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke()); ug = symbolContext.apply(ug); - drawFrame(ug, dim.getWidth(), dim.getHeight(), new Dimension2DDouble(0, 0), - symbolContext.isShadowing(), symbolContext.getRoundCorner()); + drawFrame(ug, dim.getWidth(), dim.getHeight(), new Dimension2DDouble(0, 0), symbolContext.isShadowing(), + symbolContext.getRoundCorner()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER); tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1()))); @@ -117,7 +119,8 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { @Override public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype, - final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { + final double width, final double height, final SymbolContext symbolContext, + final HorizontalAlignment stereoAlignment) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { @@ -125,9 +128,17 @@ public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(stringBounder); ug = symbolContext.apply(ug); final Dimension2D dimTitle = title.calculateDimension(stringBounder); - drawFrame(ug, dim.getWidth(), dim.getHeight(), dimTitle, symbolContext.isShadowing(), + final double widthFull = dim.getWidth(); + drawFrame(ug, widthFull, dim.getHeight(), dimTitle, symbolContext.isShadowing(), symbolContext.getRoundCorner()); - title.drawU(ug.apply(new UTranslate(3, 1))); + final double widthTitle = title.calculateDimension(stringBounder).getWidth(); + + // Temporary hack... + if (widthFull - widthTitle < 25) { + title.drawU(ug.apply(new UTranslate(3, 1))); + } else { + ug.apply(new UTranslate(3, 1)).draw(new SpecialText(title)); + } final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder); final double posStereo = (width - dimStereo.getWidth()) / 2; @@ -141,6 +152,29 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { }; } +// static class Interceptor extends UGraphicDelegator { +// +// public Interceptor(UGraphic ug) { +// super(ug); +// } +// +// @Override +// public void draw(UShape shape) { +// if (shape instanceof SpecialText) { +// final SpecialText specialText = (SpecialText) shape; +// specialText.title.drawU(getUg()); +// // System.err.println("getug=" + getUg()); +// return; +// } +// super.draw(shape); +// } +// +// public UGraphic apply(UChange change) { +// return new Interceptor(getUg().apply(change)); +// } +// +// } + @Override public boolean manageHorizontalLine() { return true; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolInterface.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolInterface.java index 784987f63..9d45d0822 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolInterface.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolInterface.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolLabel.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolLabel.java new file mode 100644 index 000000000..0016e7ad8 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolLabel.java @@ -0,0 +1,121 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.graphic; + +import java.awt.geom.Dimension2D; + +import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UGraphicStencil; +import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.UTranslate; + +class USymbolLabel extends USymbol { + + private final SkinParameter skinParameter; + + public USymbolLabel(SkinParameter skinParameter) { + this.skinParameter = skinParameter; + } + + @Override + public SkinParameter getSkinParameter() { + return skinParameter; + } + + private Margin getMargin() { + return new Margin(10, 10, 10, 10); + } + + @Override + public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype, + final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { + return new AbstractTextBlock() { + + public void drawU(UGraphic ug) { + final Dimension2D dim = calculateDimension(ug.getStringBounder()); + ug = UGraphicStencil.create(ug, getRectangleStencil(dim), new UStroke()); + ug = symbolContext.apply(ug); + final Margin margin = getMargin(); + final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment); + tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1()))); + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + final Dimension2D dimLabel = label.calculateDimension(stringBounder); + final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder); + return getMargin().addDimension(Dimension2DDouble.mergeTB(dimStereo, dimLabel)); + } + }; + } + + @Override + public TextBlock asBig(final TextBlock title, final HorizontalAlignment labelAlignment, final TextBlock stereotype, + final double width, final double height, final SymbolContext symbolContext, + final HorizontalAlignment stereoAlignment) { + return new AbstractTextBlock() { + public void drawU(UGraphic ug) { + ug = symbolContext.apply(ug); + final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder()); + final double posStereoX; + final double posStereoY; + if (stereoAlignment == HorizontalAlignment.RIGHT) { + posStereoX = width - dimStereo.getWidth() - getMargin().getX1() / 2; + posStereoY = getMargin().getY1() / 2; + } else { + posStereoX = (width - dimStereo.getWidth()) / 2; + posStereoY = 2; + } + stereotype.drawU(ug.apply(new UTranslate(posStereoX, posStereoY))); + final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder()); + final double posTitle; + if (labelAlignment == HorizontalAlignment.LEFT) { + posTitle = 3; + } else if (labelAlignment == HorizontalAlignment.RIGHT) { + posTitle = width - dimTitle.getWidth() - 3; + } else { + posTitle = (width - dimTitle.getWidth()) / 2; + } + title.drawU(ug.apply(new UTranslate(posTitle, 2 + dimStereo.getHeight()))); + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return new Dimension2DDouble(width, height); + } + }; + } + + @Override + public boolean manageHorizontalLine() { + return true; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolNode.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolNode.java index 3307ce79e..7491f9503 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolNode.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolNode.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,13 +33,15 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; +import net.sourceforge.plantuml.ugraphic.UEmpty; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UHorizontalLine; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; class USymbolNode extends USymbol { @@ -74,8 +76,11 @@ private void drawNode(UGraphic ug, double width, double height, boolean shadowin ug.draw(shape); ug.apply(new UTranslate(width - 10, 10)).draw(new ULine(9, -9)); - ug.apply(new UTranslate(0, 10)).draw(new ULine(width - 10, 0)); - ug.apply(new UTranslate(width - 10, 10)).draw(new ULine(0, height - 10)); + ug.apply(UTranslate.dy(10)).draw(ULine.hline(width - 10)); + ug.apply(new UTranslate(width - 10, 10)).draw(ULine.vline(height - 10)); + if (SkinParam.USE_STYLES()) { + ug.apply(new UTranslate(0, height)).draw(new UEmpty(10, 10)); + } } @@ -99,15 +104,15 @@ protected void drawHline(UGraphic ug, UHorizontalLine line, UTranslate translate drawHlineInternal(ug, line); if (line.isDouble()) { - drawHlineInternal(ug.apply(new UTranslate(0, 2)), line); + drawHlineInternal(ug.apply(UTranslate.dy(2)), line); } line.drawTitleInternal(ug, 0, endingX - 10, 0, true); } private void drawHlineInternal(UGraphic ug, UHorizontalLine line) { - ug = ug.apply(line.getStroke()).apply(new UChangeBackColor(null)); - ug.draw(new ULine(endingX - 10, 0)); - ug.apply(new UTranslate(endingX - 10, 0)).draw(new ULine(10, -10)); + ug = ug.apply(line.getStroke()).apply(new HColorNone().bg()); + ug.draw(ULine.hline(endingX - 10)); + ug.apply(UTranslate.dx(endingX - 10)).draw(new ULine(10, -10)); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolQueue.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolQueue.java index d69860af0..7b4034bb1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolQueue.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolQueue.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,11 +35,11 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UHorizontalLine; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; class USymbolQueue extends USymbol { @@ -67,7 +67,7 @@ private void drawQueue(UGraphic ug, double width, double height, boolean shadowi ug.draw(shape); final UPath closing = getClosingPath(width, height); - ug.apply(new UChangeBackColor(null)).draw(closing); + ug.apply(new HColorNone().bg()).draw(closing); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolRect.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolRect.java index 46deb402b..2f18e36a7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolRect.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolRect.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,7 +36,6 @@ import net.sourceforge.plantuml.ugraphic.Shadowable; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; -import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -44,18 +43,11 @@ class USymbolRect extends USymbol { private final SkinParameter skinParameter; - // private final HorizontalAlignment stereotypeAlignement; public USymbolRect(SkinParameter skinParameter) { this.skinParameter = skinParameter; -// this.stereotypeAlignement = stereotypeAlignement; } -// @Override -// public USymbol withStereoAlignment(HorizontalAlignment alignment) { -// return new USymbolRect(skinParameter, alignment); -// } - @Override public SkinParameter getSkinParameter() { return skinParameter; @@ -63,28 +55,15 @@ public SkinParameter getSkinParameter() { private void drawRect(UGraphic ug, double width, double height, boolean shadowing, double roundCorner, double diagonalCorner) { - final Shadowable shape = diagonalCorner > 0 ? getDiagonalShape(width, height, diagonalCorner) : new URectangle( - width, height, roundCorner, roundCorner); + final URectangle rect = new URectangle(width, height); + final Shadowable shape = diagonalCorner > 0 ? rect.diagonalCorner(diagonalCorner) + : rect.rounded(roundCorner); if (shadowing) { shape.setDeltaShadow(3.0); } ug.draw(shape); } - private Shadowable getDiagonalShape(double width, double height, double diagonalCorner) { - final UPath result = new UPath(); - result.moveTo(diagonalCorner, 0); - result.lineTo(width - diagonalCorner, 0); - result.lineTo(width, diagonalCorner); - result.lineTo(width, height - diagonalCorner); - result.lineTo(width - diagonalCorner, height); - result.lineTo(diagonalCorner, height); - result.lineTo(0, height - diagonalCorner); - result.lineTo(0, diagonalCorner); - result.lineTo(diagonalCorner, 0); - return result; - } - private Margin getMargin() { return new Margin(10, 10, 10, 10); } @@ -115,7 +94,8 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { @Override public TextBlock asBig(final TextBlock title, final HorizontalAlignment labelAlignment, final TextBlock stereotype, - final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { + final double width, final double height, final SymbolContext symbolContext, + final HorizontalAlignment stereoAlignment) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java index a39f49436..e27d1ab08 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -49,7 +49,7 @@ public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final Dimension2D dimName = label.calculateDimension(stringBounder); + final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder); final Dimension2D dimStickMan = stickman.calculateDimension(stringBounder); final Dimension2D dimTotal = calculateDimension(stringBounder); @@ -57,19 +57,23 @@ public void drawU(UGraphic ug) { final double stickmanY = dimStereo.getHeight(); ug = symbolContext.apply(ug); stickman.drawU(ug.apply(new UTranslate(stickmanX, stickmanY))); - final double labelX = (dimTotal.getWidth() - dimName.getWidth()) / 2; + final double labelX = (dimTotal.getWidth() - dimLabel.getWidth()) / 2; final double labelY = dimStickMan.getHeight() + dimStereo.getHeight(); + + // Actor bug? + // final UGraphic ug2 = UGraphicStencil.create(ug, getRectangleStencil(dimLabel), new UStroke()); + // label.drawU(ug2.apply(new UTranslate(labelX, labelY))); label.drawU(ug.apply(new UTranslate(labelX, labelY))); final double stereoX = (dimTotal.getWidth() - dimStereo.getWidth()) / 2; - stereotype.drawU(ug.apply(new UTranslate(stereoX, 0))); + stereotype.drawU(ug.apply(UTranslate.dx(stereoX))); } public Dimension2D calculateDimension(StringBounder stringBounder) { - final Dimension2D dimName = label.calculateDimension(stringBounder); + final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder); final Dimension2D dimActor = stickman.calculateDimension(stringBounder); - return Dimension2DDouble.mergeLayoutT12B3(dimStereo, dimActor, dimName); + return Dimension2DDouble.mergeLayoutT12B3(dimStereo, dimActor, dimLabel); } }; } @@ -78,7 +82,8 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { @Override public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, TextBlock stereotype, - final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { + final double width, final double height, final SymbolContext symbolContext, + final HorizontalAlignment stereoAlignment) { throw new UnsupportedOperationException(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolStack.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolStack.java index 301337076..67e1bd178 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolStack.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolStack.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,14 +34,13 @@ import java.awt.geom.Point2D; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; class USymbolStack extends USymbol { @@ -52,11 +51,10 @@ public SkinParameter getSkinParameter() { private void drawQueue(UGraphic ug, double width, double height, boolean shadowing, double roundCorner) { final double border = 15; - final URectangle rect = new URectangle(width - 2 * border, height, roundCorner, roundCorner); - if (shadowing) { - rect.setDeltaShadow(3.0); - } - ug.apply(new UChangeColor(null)).apply(new UTranslate(border, 0)).draw(rect); + + final URectangle rect = new URectangle(width - 2 * border, height).rounded(roundCorner); + ug.apply(new HColorNone()).apply(UTranslate.dx(border)).draw(rect); + final UPath path = new UPath(); if (roundCorner == 0) { path.moveTo(0, 0); @@ -77,7 +75,10 @@ private void drawQueue(UGraphic ug, double width, double height, boolean shadowi path.arcTo(new Point2D.Double(width - border + roundCorner / 2, 0), roundCorner / 2, 0, 1); path.lineTo(width, 0); } - ug.apply(new UChangeBackColor(null)).draw(path); + if (shadowing) { + path.setDeltaShadow(3.0); + } + ug.apply(new HColorNone().bg()).draw(path); } private Margin getMargin() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolStorage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolStorage.java index 2defcca2c..12ede4474 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolStorage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolStorage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -47,7 +47,7 @@ public SkinParameter getSkinParameter() { } private void drawStorage(UGraphic ug, double width, double height, boolean shadowing) { - final URectangle shape = new URectangle(width, height, 70, 70); + final URectangle shape = new URectangle(width, height).rounded(70); if (shadowing) { shape.setDeltaShadow(3.0); } @@ -83,7 +83,8 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { @Override public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype, - final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { + final double width, final double height, final SymbolContext symbolContext, + final HorizontalAlignment stereoAlignment) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolTogether.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolTogether.java index fb641f417..f9f791377 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolTogether.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/USymbolTogether.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UnusedSpace.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UnusedSpace.java index 7b27354a1..52e7296cc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UnusedSpace.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/UnusedSpace.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -131,7 +131,7 @@ private UnusedSpace(UFont font, char c) { // int cpt = 1; // try { - // ImageIO.write(im, "png", new File("c:/img" + cpt + ".png")); + // ImageIO.write(im, "png", SecurityUtils.File("c:/img" + cpt + ".png")); // cpt++; // } catch (IOException e) { // e.printStackTrace(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/VerticalAlignment.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/VerticalAlignment.java index 717410b15..22d737251 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/VerticalAlignment.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/VerticalAlignment.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/VerticalPosition.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/VerticalPosition.java index b77e92463..13ee85569 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/VerticalPosition.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/VerticalPosition.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/color/ColorParser.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/color/ColorParser.java index 43266ad02..4f7f9ac6f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/color/ColorParser.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/color/ColorParser.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,7 +32,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ColorParser { @@ -51,7 +51,7 @@ private ColorParser(String name, RegexLeaf regex, ColorType mainType) { this.mainType = mainType; } - public Colors getColor(RegexResult arg, IHtmlColorSet set) { + public Colors getColor(RegexResult arg, HColorSet set) { if (mainType == null) { throw new IllegalStateException(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/color/ColorType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/color/ColorType.java index ea4c0204e..39bb9f20f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/color/ColorType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/color/ColorType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/color/Colors.java b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/color/Colors.java index 3eb1e1e80..ec9340591 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/color/Colors.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/graphic/color/Colors.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,14 +41,14 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.cucadiagram.LinkStyle; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class Colors { - private final Map map = new EnumMap(ColorType.class); + private final Map map = new EnumMap(ColorType.class); private LinkStyle lineStyle = null; private Boolean shadowing = null; @@ -75,7 +75,7 @@ private Colors copy() { private Colors() { } - public Colors(String data, IHtmlColorSet set, ColorType mainType) { + public Colors(String data, HColorSet set, ColorType mainType) { data = StringUtils.goLowerCase(data); for (final StringTokenizer st = new StringTokenizer(data, "#;"); st.hasMoreTokens();) { @@ -92,7 +92,7 @@ public Colors(String data, IHtmlColorSet set, ColorType mainType) { this.shadowing = value.equalsIgnoreCase("true"); } else { final ColorType key = ColorType.getType(name); - final HtmlColor color = set.getColorIfValid(value); + final HColor color = set.getColorIfValid(value); map.put(key, color); } } @@ -106,15 +106,15 @@ public Colors(String data, IHtmlColorSet set, ColorType mainType) { } } - public HtmlColor getColor(ColorType key) { + public HColor getColor(ColorType key) { if (key == null) { throw new IllegalArgumentException(); } return map.get(key); } - public HtmlColor getColor(ColorType key1, ColorType key2) { - final HtmlColor result = getColor(key1); + public HColor getColor(ColorType key1, ColorType key2) { + final HColor result = getColor(key1); if (result != null) { return result; } @@ -134,7 +134,7 @@ public UStroke getSpecificLineStroke() { // return result; // } - public Colors add(ColorType type, HtmlColor color) { + public Colors add(ColorType type, HColor color) { if (color == null) { return this; } @@ -209,7 +209,7 @@ private Colors applyFontParamStereotype(Stereotype stereotype, ISkinParam skinPa if (getColor(colorType) != null) { return this; } - final HtmlColor col = skinParam.getFontHtmlColor(stereotype, param); + final HColor col = skinParam.getFontHtmlColor(stereotype, param); return add(colorType, col); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/Box2D.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/Box2D.java index 8b9d779ae..96f43b01c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/Box2D.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/Box2D.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java index feeacc12a..9940fb4ab 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -45,19 +45,17 @@ import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Link; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.svek.CucaDiagramFileMaker; import net.sourceforge.plantuml.svek.GeneralImageBuilder; import net.sourceforge.plantuml.svek.IEntityImage; import net.sourceforge.plantuml.ugraphic.MinMax; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic2; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class CucaDiagramFileMakerHectorB1 implements CucaDiagramFileMaker { @@ -139,7 +137,7 @@ private void drawPin(UGraphic ug, Pin pin) { final double x = getX(pin); final double y = getY(pin); final UEllipse circle = new UEllipse(6, 6); - ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(HtmlColorUtils.BLACK)) + ug.apply(HColorUtils.BLACK).apply(HColorUtils.BLACK.bg()) .apply(new UTranslate(x - 3, y - 3)).draw(circle); } @@ -150,7 +148,7 @@ private void drawPinLink(UGraphic ug, PinLink pinLink) { final double y2 = getY(pinLink.getPin2()); final Rose rose = new Rose(); - final HtmlColor color = rose.getHtmlColor(diagram.getSkinParam(), ColorParam.arrow); + final HColor color = rose.getHtmlColor(diagram.getSkinParam(), ColorParam.arrow); final List b = new ArrayList(); final SmartConnection connection = new SmartConnection(x1, y1, x2, y2, b); connection.draw(ug, color); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/GrowingTree.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/GrowingTree.java index 58c19be36..bb7409dc4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/GrowingTree.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/GrowingTree.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/HectorPath.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/HectorPath.java index ad4b6e172..8b3f690f4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/HectorPath.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/HectorPath.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,10 +35,9 @@ import java.util.List; import net.sourceforge.plantuml.geom.LineSegmentDouble; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class HectorPath { @@ -57,8 +56,8 @@ public String toString() { return segments.toString(); } - public void draw(UGraphic ug, HtmlColor color) { - ug = ug.apply(new UChangeColor(color)).apply(new UStroke(1.5)); + public void draw(UGraphic ug, HColor color) { + ug = ug.apply(color).apply(new UStroke(1.5)); for (LineSegmentDouble seg : segments) { seg.draw(ug); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/Pin.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/Pin.java index a0c961f43..c97c05c1f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/Pin.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/Pin.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/PinFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/PinFactory.java index 25c75982b..79a24ab96 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/PinFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/PinFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/PinLink.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/PinLink.java index ce7e18134..14a34fd64 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/PinLink.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/PinLink.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/PinLinksContinuousSet.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/PinLinksContinuousSet.java index c0d434adb..65c862c60 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/PinLinksContinuousSet.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/PinLinksContinuousSet.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/Skeleton.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/Skeleton.java index 7ca538ad8..0bbdc13d5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/Skeleton.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/Skeleton.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonBuilder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonBuilder.java index b1f416049..7f98cbcd3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonBuilder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonBuilder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfiguration.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfiguration.java index eba85ff18..5d661bbc8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfiguration.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfiguration.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationComparator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationComparator.java index 3b5dbfd8c..251d4c970 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationComparator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationComparator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationEvaluator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationEvaluator.java index 97cd94926..78c8f0407 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationEvaluator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationEvaluator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationEvaluatorLineLenght.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationEvaluatorLineLenght.java index 3ad9832fc..3b6cc99c0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationEvaluatorLineLenght.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationEvaluatorLineLenght.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationSet.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationSet.java index 3d7dae506..f610697af 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationSet.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationSet.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationUtils.java index 677ac20f0..9ed1721df 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurationUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurations.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurations.java index 8e0c9a036..dde269b86 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurations.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonConfigurations.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonMutation.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonMutation.java index 1d1efcdae..03e0858fb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonMutation.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SkeletonMutation.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SmartConnection.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SmartConnection.java index 6ec7e9dc2..adba56e1f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SmartConnection.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/SmartConnection.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,12 +34,11 @@ import java.util.List; import net.sourceforge.plantuml.geom.LineSegmentDouble; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; class SmartConnection { @@ -61,13 +60,13 @@ public SmartConnection(Point2D p1, Point2D p2, List b) { this(p1.getX(), p1.getY(), p2.getX(), p2.getY(), b); } - public void draw(UGraphic ug, HtmlColor color) { + public void draw(UGraphic ug, HColor color) { final LineSegmentDouble seg = new LineSegmentDouble(x1, y1, x2, y2); boolean clash = intersect(seg); if (clash) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UStroke(1.0)); + ug = ug.apply(HColorUtils.BLACK).apply(new UStroke(1.0)); } else { - ug = ug.apply(new UChangeColor(color)).apply(new UStroke(1.5)); + ug = ug.apply(color).apply(new UStroke(1.5)); } seg.draw(ug); } @@ -81,8 +80,8 @@ private boolean intersect(LineSegmentDouble seg) { return false; } - public void drawEx1(UGraphic ug, HtmlColor color) { - ug = ug.apply(new UChangeColor(color)).apply(new UStroke(1.5)); + public void drawEx1(UGraphic ug, HColor color) { + ug = ug.apply(color).apply(new UStroke(1.5)); final double orthoX = -(y2 - y1); final double orthoY = x2 - x1; for (int i = -10; i <= 10; i++) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/UnlinarCompressedPlan.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/UnlinarCompressedPlan.java index b2688cd50..9027acd49 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/UnlinarCompressedPlan.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/UnlinarCompressedPlan.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/UnlinearCompression.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/UnlinearCompression.java index 3f2c1d193..94bf81f63 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector/UnlinearCompression.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector/UnlinearCompression.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/MinMax.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/MinMax.java index b539e8273..f7222ee27 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/MinMax.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/MinMax.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/continuity/Skeleton.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/continuity/Skeleton.java index 94d6c8130..399e8a2dc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/continuity/Skeleton.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/continuity/Skeleton.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/continuity/SkeletonBuilder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/continuity/SkeletonBuilder.java index cb0c644b3..b15f4e40c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/continuity/SkeletonBuilder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/continuity/SkeletonBuilder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/graphic/Foo1.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/graphic/Foo1.java index e27899d31..af11b7610 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/graphic/Foo1.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/graphic/Foo1.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java index 7910a7ba1..e22f413f1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -79,7 +79,7 @@ public void drawU(UGraphic ug) { final Dimension2D cell = getMaxCellDimension(stringBounder); for (Layer layer : distribution.getLayers()) { drawLayer(ug, layer, cell.getWidth(), cell.getHeight()); - ug = ug.apply(new UTranslate(0, cell.getHeight())); + ug = ug.apply(UTranslate.dy(cell.getHeight())); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/layering/Layer.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/layering/Layer.java index e5c200b0c..7694cc973 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/layering/Layer.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/layering/Layer.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/layering/LayerFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/layering/LayerFactory.java index 6ecc7460b..010ed1e38 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/layering/LayerFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/layering/LayerFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/mpos/Distribution.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/mpos/Distribution.java index 4f60d0738..3aa5e2960 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/mpos/Distribution.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/mpos/Distribution.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/mpos/MutationLayer.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/mpos/MutationLayer.java index 0744256df..b585727dd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/mpos/MutationLayer.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/mpos/MutationLayer.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/mpos/MutationLayerMove.java b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/mpos/MutationLayerMove.java index 237bb8fd7..500d83863 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/mpos/MutationLayerMove.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/hector2/mpos/MutationLayerMove.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelp.java b/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelp.java index fe864be33..9ade19700 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelp.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelp.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpColor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpColor.java index 563843436..33b81b0e1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpColor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpColor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,7 +37,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class CommandHelpColor extends SingleLineCommand2 { @@ -60,7 +60,7 @@ protected CommandExecutionResult executeArg(Help diagram, LineLocation location, diagram.add("You may improve it on https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/help"); diagram.add(" "); diagram.add(" The possible colors are :"); - for (String type : new HtmlColorSetSimple().names()) { + for (String type : HColorSet.instance().names()) { diagram.add("* " + type); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpFont.java b/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpFont.java index ea8e1b9a8..4a16498fa 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpFont.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpFont.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpKeyword.java b/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpKeyword.java index ac3cf0dfa..0e30caabf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpKeyword.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpKeyword.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpSkinparam.java b/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpSkinparam.java index 539b1fbcd..22ebf8c81 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpSkinparam.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpSkinparam.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpType.java index a0d0c2d30..60c13ea7f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/help/CommandHelpType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/help/Help.java b/src/plantuml-asl/src/net/sourceforge/plantuml/help/Help.java index 123113c8c..61f5cdf37 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/help/Help.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/help/Help.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -42,15 +42,15 @@ import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.creole.CreoleMode; -import net.sourceforge.plantuml.creole.CreoleParser; +import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.creole.Sheet; import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class Help extends UmlDiagram { @@ -71,12 +71,11 @@ protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormat final Display display = Display.create(lines); final UFont font = UFont.serif(16); final FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(font); - final Sheet sheet = new CreoleParser(fontConfiguration, HorizontalAlignment.LEFT, getSkinParam(), - CreoleMode.FULL).createSheet(display); + final Sheet sheet = Parser.build(fontConfiguration, HorizontalAlignment.LEFT, getSkinParam(), CreoleMode.FULL) + .createSheet(display); final SheetBlock1 sheetBlock = new SheetBlock1(sheet, LineBreakStrategy.NONE, 0); - final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), 1.0, null, null, null, 0, 0, null, - false); + final ImageBuilder builder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, null, null, 1.0, null); builder.setUDrawable(sheetBlock); return builder.writeImageTOBEMOVED(fileFormat, 0, os); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/help/HelpFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/help/HelpFactory.java index 81569386a..629f08b8b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/help/HelpFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/help/HelpFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/html/CucaDiagramHtmlMaker.java b/src/plantuml-asl/src/net/sourceforge/plantuml/html/CucaDiagramHtmlMaker.java index b1253afa7..b5f96f585 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/html/CucaDiagramHtmlMaker.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/html/CucaDiagramHtmlMaker.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,7 +30,6 @@ */ package net.sourceforge.plantuml.html; -import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; @@ -47,13 +46,14 @@ import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.Member; import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.security.SFile; public final class CucaDiagramHtmlMaker { private final CucaDiagram diagram; - private final File dir; + private final SFile dir; - public CucaDiagramHtmlMaker(CucaDiagram diagram, File dir) { + public CucaDiagramHtmlMaker(CucaDiagram diagram, SFile dir) { this.diagram = diagram; this.dir = dir; } @@ -63,8 +63,8 @@ public List create() throws IOException { if (dir.exists() == false) { throw new IOException("Cannot create " + dir); } - final File f = new File(dir, "index.html"); - final PrintWriter pw = new PrintWriter(f); + final SFile f = dir.file("index.html"); + final PrintWriter pw = f.createPrintWriter(); pw.println(""); printAllType(pw, LeafType.ENUM); printAllType(pw, LeafType.INTERFACE); @@ -87,7 +87,8 @@ private void printAllType(final PrintWriter pw, LeafType type) throws IOExceptio pw.println(LinkHtmlPrinter.htmlLink(ent)); pw.println("
  • "); } - // for (Map.Entry ent : new TreeMap(diagram.getLeafs()).entrySet()) { + // for (Map.Entry ent : new TreeMap(diagram.getLeafs()).entrySet()) { // if (ent.getValue().getEntityType() != type) { // continue; // } @@ -109,10 +110,10 @@ private boolean hasSome(final LeafType type) { } private void export(IEntity entity) throws IOException { - final File f = new File(dir, LinkHtmlPrinter.urlOf(entity)); - final PrintWriter pw = new PrintWriter(f); + final SFile f = dir.file(LinkHtmlPrinter.urlOf(entity)); + final PrintWriter pw = f.createPrintWriter(); pw.println(""); - pw.println("" + StringUtils.unicodeForHtml(entity.getCode().getFullName()) + ""); + pw.println("" + StringUtils.unicodeForHtml(entity.getCodeGetName()) + ""); pw.println("

    " + entity.getLeafType().toHtml() + "

    "); for (CharSequence s : entity.getDisplay()) { pw.println(StringUtils.unicodeForHtml(s.toString())); @@ -204,8 +205,7 @@ private Collection getNotes(IEntity ent) { if (link.contains(ent) == false) { continue; } - if (link.getEntity1().getLeafType() == LeafType.NOTE - || link.getEntity2().getLeafType() == LeafType.NOTE) { + if (link.getEntity1().getLeafType() == LeafType.NOTE || link.getEntity2().getLeafType() == LeafType.NOTE) { result.add(link.getOther(ent)); } } @@ -218,8 +218,7 @@ private Collection getLinksButNotes(IEntity ent) { if (link.contains(ent) == false) { continue; } - if (link.getEntity1().getLeafType() == LeafType.NOTE - || link.getEntity2().getLeafType() == LeafType.NOTE) { + if (link.getEntity1().getLeafType() == LeafType.NOTE || link.getEntity2().getLeafType() == LeafType.NOTE) { continue; } result.add(link); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/html/LinkHtmlPrinter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/html/LinkHtmlPrinter.java index 1ab75a256..7d0e28ef2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/html/LinkHtmlPrinter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/html/LinkHtmlPrinter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -60,9 +60,9 @@ void printLink(PrintWriter pw) { final String ent2h; if (chiral) { ent1h = htmlLink(link.getEntity1()); - ent2h = "" + StringUtils.unicodeForHtml(link.getEntity2().getCode().getFullName()) + ""; + ent2h = "" + StringUtils.unicodeForHtml(link.getEntity2().getCodeGetName()) + ""; } else { - ent1h = "" + StringUtils.unicodeForHtml(link.getEntity1().getCode().getFullName()) + ""; + ent1h = "" + StringUtils.unicodeForHtml(link.getEntity1().getCodeGetName()) + ""; ent2h = htmlLink(link.getEntity2()); } String label = link.getLabel() == null ? null : StringUtils.unicodeForHtml(link.getLabel()); @@ -165,7 +165,7 @@ static String htmlLink(IEntity ent) { sb.append(""); - sb.append(StringUtils.unicodeForHtml(ent.getCode().getFullName())); + sb.append(StringUtils.unicodeForHtml(ent.getCodeGetName())); sb.append(""); return sb.toString(); } @@ -174,8 +174,8 @@ static String urlOf(IEntity ent) { if (ent.getLeafType() == LeafType.NOTE) { throw new IllegalArgumentException(); } - if (ent.getCode().getFullName().matches("[-\\w_ .]+")) { - return StringUtils.unicodeForHtml(ent.getCode().getFullName()) + ".html"; + if (ent.getCodeGetName().matches("[-\\w_ .]+")) { + return StringUtils.unicodeForHtml(ent.getCodeGetName()) + ".html"; } return StringUtils.unicodeForHtml(ent.getUid()) + ".html"; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java index 637f94508..bafc5255e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,13 +37,6 @@ import static gen.lib.cgraph.subg__c.agsubg; import static gen.lib.gvc.gvc__c.gvContext; import static gen.lib.gvc.gvlayout__c.gvLayoutJobs; -import h.ST_Agedge_s; -import h.ST_Agnode_s; -import h.ST_Agnodeinfo_t; -import h.ST_Agraph_s; -import h.ST_Agraphinfo_t; -import h.ST_GVC_s; -import h.ST_boxf; import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; @@ -51,17 +44,23 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -import net.sourceforge.plantuml.ColorParam; +import h.ST_Agedge_s; +import h.ST_Agnode_s; +import h.ST_Agnodeinfo_t; +import h.ST_Agraph_s; +import h.ST_Agraphinfo_t; +import h.ST_GVC_s; +import h.ST_boxf; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.api.ImageDataSimple; @@ -73,14 +72,13 @@ import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.ILeaf; -import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.Member; import net.sourceforge.plantuml.cucadiagram.MethodsOrFieldsArea; import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.QuoteUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -89,7 +87,8 @@ import net.sourceforge.plantuml.graphic.TextBlockWidth; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.USymbol; -import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.svek.Bibliotekon; import net.sourceforge.plantuml.svek.Cluster; import net.sourceforge.plantuml.svek.CucaDiagramFileMaker; @@ -97,7 +96,7 @@ import net.sourceforge.plantuml.svek.GeneralImageBuilder; import net.sourceforge.plantuml.svek.GraphvizCrash; import net.sourceforge.plantuml.svek.IEntityImage; -import net.sourceforge.plantuml.svek.Shape; +import net.sourceforge.plantuml.svek.Node; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; @@ -116,7 +115,6 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker { private final Map nodes = new LinkedHashMap(); private final Map edges = new LinkedHashMap(); private final Map clusters = new LinkedHashMap(); - private Map emptyGroups = new HashMap(); private final DotStringFactory dotStringFactory; @@ -136,11 +134,11 @@ public void drawU(UGraphic ug) { for (Map.Entry ent : nodes.entrySet()) { final ILeaf leaf = ent.getKey(); - final ST_Agnode_s node = ent.getValue(); - final Point2D corner = getCorner(node); + final ST_Agnode_s agnode = ent.getValue(); + final Point2D corner = getCorner(agnode); - final Shape shape = dotStringFactory.getBibliotekon().getShape(leaf); - final IEntityImage image = shape.getImage(); + final Node node = dotStringFactory.getBibliotekon().getNode(leaf); + final IEntityImage image = node.getImage(); image.drawU(ug.apply(new UTranslate(corner))); } @@ -194,7 +192,8 @@ public void drawGroup(UGraphic ug, YMirror ymirror, IGroup group, ST_Agraph_s gr final Cluster cluster = dotStringFactory.getBibliotekon().getCluster(group); cluster.setPosition(llx, lly, urx, ury); JUtils.LOG2("cluster=" + cluster); - // ug.apply(new UTranslate(llx, lly)).apply(new UChangeColor(HtmlColorUtils.BLUE)) + // ug.apply(new UTranslate(llx, lly)).apply(new + // UChangeColor(HtmlColorUtils.BLUE)) // .draw(new URectangle(urx - llx, ury - lly)); cluster.drawU(ug, new UStroke(1.5), diagram.getUmlDiagramType(), diagram.getSkinParam()); } @@ -205,21 +204,9 @@ private void printGroups(IGroup parent) { continue; } if (diagram.isEmpty(g) && g.getGroupType() == GroupType.PACKAGE) { - final ILeaf folder = diagram.getEntityFactory().createLeaf(g.getCode(), g.getDisplay(), - LeafType.EMPTY_PACKAGE, g.getParentContainer(), null, diagram.getNamespaceSeparator()); - emptyGroups.put(g, folder); - final USymbol symbol = g.getUSymbol(); - folder.setUSymbol(symbol); - folder.setStereotype(g.getStereotype()); - if (g.getColors(diagram.getSkinParam()).getColor(ColorType.BACK) == null) { - final ColorParam param = symbol == null ? ColorParam.packageBackground : symbol.getColorParamBack(); - final HtmlColor c1 = diagram.getSkinParam().getHtmlColor(param, g.getStereotype(), false); - folder.setSpecificColorTOBEREMOVED(ColorType.BACK, c1 == null ? diagram.getSkinParam() - .getBackgroundColor() : c1); - } else { - folder.setSpecificColorTOBEREMOVED(ColorType.BACK, - g.getColors(diagram.getSkinParam()).getColor(ColorType.BACK)); - } + final ISkinParam skinParam = diagram.getSkinParam(); + final EntityFactory entityFactory = diagram.getEntityFactory(); + final ILeaf folder = entityFactory.createLeafForEmptyGroup(g, skinParam); printEntityNew(folder); } else { printGroup(g); @@ -245,7 +232,7 @@ private void printGroup(IGroup g) { attribute = new TextBlockEmpty(); } else { attribute = new MethodsOrFieldsArea(members, FontParam.STATE_ATTRIBUTE, diagram.getSkinParam(), - g.getStereotype(), null); + g.getStereotype(), null, SName.stateDiagram); } final Dimension2D dimAttribute = attribute.calculateDimension(stringBounder); final double attributeHeight = dimAttribute.getHeight(); @@ -256,10 +243,11 @@ private void printGroup(IGroup g) { final int suppWidthBecauseOfShape = uSymbol == null ? 0 : uSymbol.suppWidthBecauseOfShape(); titleAndAttributeWidth = (int) Math.max(dimLabel.getWidth(), attributeWidth) + suppWidthBecauseOfShape; - titleAndAttributeHeight = (int) (dimLabel.getHeight() + attributeHeight + marginForFields + suppHeightBecauseOfShape); + titleAndAttributeHeight = (int) (dimLabel.getHeight() + attributeHeight + marginForFields + + suppHeightBecauseOfShape); } - dotStringFactory.openCluster(g, titleAndAttributeWidth, titleAndAttributeHeight, title, stereo); + dotStringFactory.openCluster(titleAndAttributeWidth, titleAndAttributeHeight, title, stereo, g); this.printEntities(g.getLeafsDirect()); printGroups(g); @@ -286,16 +274,16 @@ private void exportEntities(ST_Agraph_s g, Collection entities2) { } private void exportEntity(ST_Agraph_s g, ILeaf leaf) { - final Shape shape = dotStringFactory.getBibliotekon().getShape(leaf); + final Node node = dotStringFactory.getBibliotekon().getNode(leaf); // System.err.println("exportEntity " + leaf); - final ST_Agnode_s node = agnode(g, new CString(shape.getUid()), true); - agsafeset(node, new CString("shape"), new CString("box"), new CString("")); - final String width = "" + (shape.getWidth() / 72); - final String height = "" + (shape.getHeight() / 72); - agsafeset(node, new CString("width"), new CString(width), new CString("")); - agsafeset(node, new CString("height"), new CString(height), new CString("")); + final ST_Agnode_s agnode = agnode(g, new CString(node.getUid()), true); + agsafeset(agnode, new CString("shape"), new CString("box"), new CString("")); + final String width = "" + (node.getWidth() / 72); + final String height = "" + (node.getHeight() / 72); + agsafeset(agnode, new CString("width"), new CString(width), new CString("")); + agsafeset(agnode, new CString("height"), new CString(height), new CString("")); // System.err.println("NODE " + leaf.getUid() + " " + width + " " + height); - nodes.put(leaf, node); + nodes.put(leaf, agnode); } private void printEntity(ILeaf ent) { @@ -303,12 +291,8 @@ private void printEntity(ILeaf ent) { throw new IllegalStateException(); } final IEntityImage image = printEntityInternal(ent); - final Dimension2D dim = image.calculateDimension(stringBounder); - final Shape shape = new Shape(image, image.getShapeType(), dim.getWidth(), dim.getHeight(), - dotStringFactory.getColorSequence(), ent.isTop(), image.getShield(stringBounder), - ent.getEntityPosition()); - dotStringFactory.addShape(shape); - getBibliotekon().putShape(ent, shape); + final Node node = getBibliotekon().createNode(ent, image, dotStringFactory.getColorSequence(), stringBounder); + dotStringFactory.addNode(node); } private TextBlock getTitleBlock(IGroup g) { @@ -356,15 +340,15 @@ private Collection getUnpackagedEntities() { } private void printCluster(ST_Agraph_s g, Cluster cluster) { - for (Shape shape : cluster.getShapes()) { - final ST_Agnode_s node = agnode(g, new CString(shape.getUid()), true); - agsafeset(node, new CString("shape"), new CString("box"), new CString("")); - final String width = "" + (shape.getWidth() / 72); - final String height = "" + (shape.getHeight() / 72); - agsafeset(node, new CString("width"), new CString(width), new CString("")); - agsafeset(node, new CString("height"), new CString(height), new CString("")); - final ILeaf leaf = dotStringFactory.getBibliotekon().getLeaf(shape); - nodes.put(leaf, node); + for (Node node : cluster.getNodes()) { + final ST_Agnode_s agnode = agnode(g, new CString(node.getUid()), true); + agsafeset(agnode, new CString("shape"), new CString("box"), new CString("")); + final String width = "" + (node.getWidth() / 72); + final String height = "" + (node.getHeight() / 72); + agsafeset(agnode, new CString("width"), new CString(width), new CString("")); + agsafeset(agnode, new CString("height"), new CString(height), new CString("")); + final ILeaf leaf = dotStringFactory.getBibliotekon().getLeaf(node); + nodes.put(leaf, agnode); } } @@ -406,7 +390,8 @@ private ImageData createFileLocked(OutputStream os, List dotStrings, Fil // agsafeset(node, new CString("height"), new CString(height), new CString("")); // nodes.put(leaf, node); // // System.err - // // .println("NODE " + leaf.getUid() + " [shape=box, width=" + width + ", height=" + height + "]"); + // // .println("NODE " + leaf.getUid() + " [shape=box, width=" + width + ", + // height=" + height + "]"); // } // for (Link link : diagram.getLinks()) { @@ -429,9 +414,18 @@ private ImageData createFileLocked(OutputStream os, List dotStrings, Fil final double scale = 1; - final ImageBuilder imageBuilder = new ImageBuilder(diagram.getSkinParam(), scale, - fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null, null, 0, 10, - diagram.getAnimation()); + final int margin1; + final int margin2; + if (SkinParam.USE_STYLES()) { + margin1 = SkinParam.zeroMargin(0); + margin2 = SkinParam.zeroMargin(10); + } else { + margin1 = 0; + margin2 = 10; + } + final ImageBuilder imageBuilder = ImageBuilder.buildD(diagram.getSkinParam(), + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), diagram.getAnimation(), + fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null, null, scale); imageBuilder.setUDrawable(new Drawing(null)); final Dimension2D dim = imageBuilder.getFinalDimension(stringBounder); @@ -455,7 +449,8 @@ private void exportGroups(ST_Agraph_s graph, IGroup parent) { continue; } if (diagram.isEmpty(g) && g.getGroupType() == GroupType.PACKAGE) { - final ILeaf folder = emptyGroups.get(g); + final EntityFactory entityFactory = diagram.getEntityFactory(); + final ILeaf folder = entityFactory.getLeafForEmptyGroup(g); exportEntity(graph, folder); } else { exportGroup(graph, g); @@ -471,8 +466,8 @@ private void exportGroup(ST_Agraph_s graph, IGroup group) { if (cluster.isLabel()) { final double width = cluster.getTitleAndAttributeWidth(); final double height = cluster.getTitleAndAttributeHeight() - 5; - agsafeset(cluster1, new CString("label"), - Macro.createHackInitDimensionFromLabel((int) width, (int) height), new CString("")); + agsafeset(cluster1, new CString("label"), Macro.createHackInitDimensionFromLabel((int) width, (int) height), + new CString("")); } this.exportEntities(cluster1, group.getLeafsDirect()); this.clusters.put(group, cluster1); @@ -512,9 +507,9 @@ private ST_Agnode_s getAgnodeFromLeaf(IEntity entity) { if (n != null) { return n; } - final String id = getBibliotekon().getShapeUid((ILeaf) entity); + final String id = getBibliotekon().getNodeUid((ILeaf) entity); for (Map.Entry ent : nodes.entrySet()) { - if (id.equals(getBibliotekon().getShapeUid(ent.getKey()))) { + if (id.equals(getBibliotekon().getNodeUid(ent.getKey()))) { return ent.getValue(); } } @@ -538,10 +533,12 @@ private ST_Agedge_s createEdge(final ST_Agraph_s g, Link link) { int length = link.getLength(); // System.err.println("length=" + length); - // if (/* pragma.horizontalLineBetweenDifferentPackageAllowed() || */link.isInvis() || length != 1) { + // if (/* pragma.horizontalLineBetweenDifferentPackageAllowed() || + // */link.isInvis() || length != 1) { agsafeset(e, new CString("minlen"), new CString("" + (length - 1)), new CString("")); // } - // System.err.print("EDGE " + link.getEntity1().getUid() + "->" + link.getEntity2().getUid() + " minlen=" + // System.err.print("EDGE " + link.getEntity1().getUid() + "->" + + // link.getEntity2().getUid() + " minlen=" // + (length - 1) + " "); final TextBlock label = getLabel(link); @@ -595,12 +592,8 @@ private void printEntityNew(ILeaf ent) { throw new IllegalStateException(); } final IEntityImage image = printEntityInternal(ent); - final Dimension2D dim = image.calculateDimension(stringBounder); - final Shape shape = new Shape(image, image.getShapeType(), dim.getWidth(), dim.getHeight(), - dotStringFactory.getColorSequence(), ent.isTop(), image.getShield(stringBounder), - ent.getEntityPosition()); + final Node shape = getBibliotekon().createNode(ent, image, dotStringFactory.getColorSequence(), stringBounder); // dotStringFactory.addShape(shape); - getBibliotekon().putShape(ent, shape); } private Bibliotekon getBibliotekon() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jdot/DebugUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jdot/DebugUtils.java index ae45b96c7..beee86c65 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jdot/DebugUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jdot/DebugUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jdot/JDotPath.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jdot/JDotPath.java index fa63ea770..4e0b0f6c2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jdot/JDotPath.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jdot/JDotPath.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,32 +30,30 @@ */ package net.sourceforge.plantuml.jdot; +import java.awt.geom.Point2D; + import h.ST_Agedge_s; import h.ST_Agedgeinfo_t; import h.ST_bezier; import h.ST_pointf; import h.ST_splines; import h.ST_textlabel_t; - -import java.awt.geom.Point2D; - import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.Link; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.skin.rose.Rose; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import smetana.core.Macro; public class JDotPath implements UDrawable { @@ -97,10 +95,10 @@ private ColorParam getArrowColorParam() { public void drawU(UGraphic ug) { - HtmlColor color = rose.getHtmlColor(diagram.getSkinParam(), null, getArrowColorParam()); + HColor color = rose.getHtmlColor(diagram.getSkinParam(), null, getArrowColorParam()); if (this.link.getColors() != null) { - final HtmlColor newColor = this.link.getColors().getColor(ColorType.ARROW, ColorType.LINE); + final HColor newColor = this.link.getColors().getColor(ColorType.ARROW, ColorType.LINE); if (newColor != null) { color = newColor; } @@ -115,7 +113,7 @@ public void drawU(UGraphic ug) { } if (dotPath != null) { - ug.apply(new UChangeColor(color)).draw(dotPath); + ug.apply(color).draw(dotPath); } if (getLabelRectangleTranslate("label") != null) { label.drawU(ug.apply(getLabelRectangleTranslate("label"))); @@ -131,7 +129,7 @@ public void drawU(UGraphic ug) { } private void printDebug(UGraphic ug) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLUE)).apply(new UChangeBackColor(HtmlColorUtils.BLUE)); + ug = ug.apply(HColorUtils.BLUE).apply(HColorUtils.BLUE.bg()); final ST_splines splines = getSplines(edge); final ST_bezier beziers = splines.list.getPtr(); for (int i = 0; i < beziers.size; i++) { @@ -142,7 +140,7 @@ private void printDebug(UGraphic ug) { ug.apply(new UTranslate(pt).compose(new UTranslate(-1, -1))).draw(new UEllipse(3, 3)); } if (getLabelRectangleTranslate("label") != null && getLabelURectangle() != null) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLUE)).apply(new UChangeBackColor(null)); + ug = ug.apply(HColorUtils.BLUE).apply(new HColorNone().bg()); ug.apply(getLabelRectangleTranslate("label")).draw(getLabelURectangle()); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jdot/YMirror.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jdot/YMirror.java index 135fbab98..fb8d2b149 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jdot/YMirror.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jdot/YMirror.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/json/Json.java b/src/plantuml-asl/src/net/sourceforge/plantuml/json/Json.java index 93a2bc1c8..740dc6cf5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/json/Json.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/json/Json.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonArray.java b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonArray.java index e9c5a8faf..dac6d79cf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonArray.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonArray.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonHandler.java b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonHandler.java index 96f6d9427..495d1302c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonHandler.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonHandler.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonLiteral.java b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonLiteral.java index 41ab20ed2..9e1704336 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonLiteral.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonLiteral.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonNumber.java b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonNumber.java index af77f6267..f4c02e95b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonNumber.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonNumber.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonObject.java b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonObject.java index 1c996948d..877eb2d39 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonObject.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonObject.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonParser.java b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonParser.java index e6ffefe96..f56daf780 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonParser.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonParser.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonString.java b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonString.java index 94c424588..f5af6a7e4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonString.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonString.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonValue.java b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonValue.java index 5c457aa4c..40e71a997 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonValue.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonValue.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonWriter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonWriter.java index c27e072dc..2a499fdc2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonWriter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/json/JsonWriter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/json/Location.java b/src/plantuml-asl/src/net/sourceforge/plantuml/json/Location.java index bbdb460d3..dcb0b827f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/json/Location.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/json/Location.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/json/ParseException.java b/src/plantuml-asl/src/net/sourceforge/plantuml/json/ParseException.java index ca476cd48..95ff743a6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/json/ParseException.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/json/ParseException.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/json/PrettyPrint.java b/src/plantuml-asl/src/net/sourceforge/plantuml/json/PrettyPrint.java index 87ef44830..063aea8fa 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/json/PrettyPrint.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/json/PrettyPrint.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/json/WriterConfig.java b/src/plantuml-asl/src/net/sourceforge/plantuml/json/WriterConfig.java index 29c144c7d..ab8c153ec 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/json/WriterConfig.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/json/WriterConfig.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/json/WritingBuffer.java b/src/plantuml-asl/src/net/sourceforge/plantuml/json/WritingBuffer.java index 56803a8b0..e564587e1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/json/WritingBuffer.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/json/WritingBuffer.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/CommandAddLevel.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/CommandAddLevel.java index ab03a0055..567107de1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/CommandAddLevel.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/CommandAddLevel.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/CommandEmpty.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/CommandEmpty.java index 7580ab147..65d91eaa6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/CommandEmpty.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/CommandEmpty.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GNode.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GNode.java index 84ce79698..c891cc325 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GNode.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GNode.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GNodeUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GNodeUtils.java index 1f2185754..e5c07aa83 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GNodeUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GNodeUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTile.java index bb37a1dd1..5c9388d52 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileGeometry.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileGeometry.java index 29259f1fa..7fe856a79 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileGeometry.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileGeometry.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileLeftRight.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileLeftRight.java index 2a9752895..4920a0003 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileLeftRight.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileLeftRight.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,12 +35,11 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class GTileLeftRight extends AbstractTextBlock implements GTile { @@ -62,11 +61,11 @@ public void drawU(UGraphic ug) { final Dimension2D dimTotal = calculateDimension(stringBounder); final double deltaH1 = dimTotal.getHeight() - dimLeft.getHeight(); final double deltaH2 = dimTotal.getHeight() - dimRight.getHeight(); - left.drawU(ug.apply(new UTranslate(0, deltaH1 / 2))); + left.drawU(ug.apply(UTranslate.dy(deltaH1 / 2))); final double dx2 = dimLeft.getWidth() + space; right.drawU(ug.apply(new UTranslate(dx2, deltaH2 / 2))); - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); + ug = ug.apply(HColorUtils.BLACK); final double step = dimLeft.getHeight() / (dimRight.getWestPositions().size() + 1); double ystart = step + deltaH1 / 2; for (Double w2 : dimRight.getWestPositions()) { @@ -84,7 +83,7 @@ private void line(UGraphic ug, double x1, double y1, double x2, double y2) { path.lineTo(x1 + step, y1); path.lineTo(x2 - step, y2); path.lineTo(x2, y2); - ug.apply(new UTranslate(0, 0)).draw(path); + ug.apply(UTranslate.dy(0)).draw(path); } public GTileGeometry calculateDimension(StringBounder stringBounder) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileNode.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileNode.java index b7d506116..6fa027724 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileNode.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileNode.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,15 +37,13 @@ import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.creole.CreoleMode; -import net.sourceforge.plantuml.creole.CreoleParser; +import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.creole.Sheet; import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -54,6 +52,8 @@ import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class GTileNode extends AbstractTextBlock implements GTile { @@ -63,19 +63,20 @@ public GTileNode(GNode node) { final Display display = node.getDisplay(); final SheetBlock1 sheetBlock1 = getTextBlock(display); - final SymbolContext symbolContext = new SymbolContext(HtmlColorUtils.MY_YELLOW, HtmlColorUtils.BLACK); - tb = USymbol.RECTANGLE.asSmall(null, sheetBlock1, TextBlockUtils.empty(0, 0), symbolContext, HorizontalAlignment.CENTER); + final SymbolContext symbolContext = new SymbolContext(HColorUtils.MY_YELLOW, HColorUtils.BLACK); + tb = USymbol.RECTANGLE.asSmall(null, sheetBlock1, TextBlockUtils.empty(0, 0), symbolContext, + HorizontalAlignment.CENTER); } public static SheetBlock1 getTextBlock(final Display display) { final Rose rose = new Rose(); final SkinParam skinParam = SkinParam.create(null); - final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE); + final HColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE); final UFont fontNote = skinParam.getFont(null, false, FontParam.NOTE); final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); - final Sheet sheet9 = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL) + final Sheet sheet9 = Parser.build(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL) .createSheet(display); final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet9, LineBreakStrategy.NONE, 0); return sheetBlock1; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileOneLevelFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileOneLevelFactory.java index 9eb375867..9972c6919 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileOneLevelFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileOneLevelFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileStack.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileStack.java index 65ab33a7b..599074f3d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileStack.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/GTileStack.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -56,7 +56,7 @@ public void drawU(UGraphic ug) { for (GTile tile : tiles) { tile.drawU(ug); final Dimension2D dim = tile.calculateDimension(ug.getStringBounder()); - ug = ug.apply(new UTranslate(0, dim.getHeight() + space)); + ug = ug.apply(UTranslate.dy(dim.getHeight() + space)); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/Needle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/Needle.java index 3e698f146..9aa3d0384 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/Needle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/Needle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,12 +33,11 @@ import java.util.List; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class Needle implements UDrawable { @@ -101,7 +100,7 @@ public static UDrawable getNeedle(GNode root, double length, double degree, doub final UDrawable n1 = needle0.addChildren(root.getChildren()); return new UDrawable() { public void drawU(UGraphic ug) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); + ug = ug.apply(HColorUtils.BLACK); n1.drawU(ug); } }; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/PSystemTree.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/PSystemTree.java index 26dd7f682..e3b0bc5b8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/PSystemTree.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/PSystemTree.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,16 +37,18 @@ import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.FileFormatOption; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawableUtils; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.LimitFinder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemTree extends AbstractPSystem { @@ -61,8 +63,17 @@ public DiagramDescription getDescription() { @Override final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { - final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, null, null, - 5, 5, null, false); + final int margin1; + final int margin2; + if (SkinParam.USE_STYLES()) { + margin1 = SkinParam.zeroMargin(5); + margin2 = SkinParam.zeroMargin(5); + } else { + margin1 = 5; + margin2 = 5; + } + final ImageBuilder builder = ImageBuilder.buildB(new ColorMapperIdentity(), false, ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), + null, null, null, 1.0, HColorUtils.WHITE); if (rendering == Rendering.NEEDLE) { final UDrawable tmp = Needle.getNeedle(root, 200, 0, 60); final LimitFinder limitFinder = new LimitFinder(fileFormat.getDefaultStringBounder(), true); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/PSystemTreeFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/PSystemTreeFactory.java index 9531b5a65..475c9d0d2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/PSystemTreeFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/PSystemTreeFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/Rendering.java b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/Rendering.java index 4044b2f8d..669073797 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/Rendering.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/jungle/Rendering.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/math/ASCIIMathTeXImg.js b/src/plantuml-asl/src/net/sourceforge/plantuml/math/ASCIIMathTeXImg.js new file mode 100644 index 000000000..ff33e1ee7 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/math/ASCIIMathTeXImg.js @@ -0,0 +1,863 @@ +/* +ASCIIMathTeXImg.js +Based on ASCIIMathML, Version 1.4.7 Aug 30, 2005, (c) Peter Jipsen http://www.chapman.edu/~jipsen +Modified with TeX conversion for IMG rendering Sept 6, 2006 (c) David Lippman http://www.pierce.ctc.edu/dlippman + Updated to match ver 2.2 Mar 3, 2014 + Latest at https://github.com/mathjax/asciimathml + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +//var AMTcgiloc = ''; //set to the URL of your LaTex renderer +var noMathRender = false; + + +var config = { + translateOnLoad: true, //true to autotranslate + mathcolor: "", // defaults to back, or specify any other color + displaystyle: true, // puts limits above and below large operators + showasciiformulaonhover: true, // helps students learn ASCIIMath + decimalsign: ".", // change to "," if you like, beware of `(1,2)`! + AMdelimiter1: "`", AMescape1: "\\\\`", // can use other characters + AMusedelimiter2: false, //whether to use second delimiter below + AMdelimiter2: "$", AMescape2: "\\\\\\$", AMdelimiter2regexp: "\\$", + AMdocumentId: "wikitext", // PmWiki element containing math (default=body) + doubleblankmathdelimiter: false // if true, x+1 is equal to `x+1` +}; // for IE this works only in + +var CONST = 0, UNARY = 1, BINARY = 2, INFIX = 3, LEFTBRACKET = 4, + RIGHTBRACKET = 5, SPACE = 6, UNDEROVER = 7, DEFINITION = 8, + LEFTRIGHT = 9, TEXT = 10; // token types + +var AMsqrt = {input:"sqrt", tag:"msqrt", output:"sqrt", tex:null, ttype:UNARY}, + AMroot = {input:"root", tag:"mroot", output:"root", tex:null, ttype:BINARY}, + AMfrac = {input:"frac", tag:"mfrac", output:"/", tex:null, ttype:BINARY}, + AMdiv = {input:"/", tag:"mfrac", output:"/", tex:null, ttype:INFIX}, + AMover = {input:"stackrel", tag:"mover", output:"stackrel", tex:null, ttype:BINARY}, + AMsub = {input:"_", tag:"msub", output:"_", tex:null, ttype:INFIX}, + AMsup = {input:"^", tag:"msup", output:"^", tex:null, ttype:INFIX}, + AMtext = {input:"text", tag:"mtext", output:"text", tex:null, ttype:TEXT}, + AMmbox = {input:"mbox", tag:"mtext", output:"mbox", tex:null, ttype:TEXT}, + AMquote = {input:"\"", tag:"mtext", output:"mbox", tex:null, ttype:TEXT}; + +var AMsymbols = [ +//some greek symbols +{input:"alpha", tag:"mi", output:"\u03B1", tex:null, ttype:CONST}, +{input:"beta", tag:"mi", output:"\u03B2", tex:null, ttype:CONST}, +{input:"chi", tag:"mi", output:"\u03C7", tex:null, ttype:CONST}, +{input:"delta", tag:"mi", output:"\u03B4", tex:null, ttype:CONST}, +{input:"Delta", tag:"mo", output:"\u0394", tex:null, ttype:CONST}, +{input:"epsi", tag:"mi", output:"\u03B5", tex:"epsilon", ttype:CONST}, +{input:"varepsilon", tag:"mi", output:"\u025B", tex:null, ttype:CONST}, +{input:"eta", tag:"mi", output:"\u03B7", tex:null, ttype:CONST}, +{input:"gamma", tag:"mi", output:"\u03B3", tex:null, ttype:CONST}, +{input:"Gamma", tag:"mo", output:"\u0393", tex:null, ttype:CONST}, +{input:"iota", tag:"mi", output:"\u03B9", tex:null, ttype:CONST}, +{input:"kappa", tag:"mi", output:"\u03BA", tex:null, ttype:CONST}, +{input:"lambda", tag:"mi", output:"\u03BB", tex:null, ttype:CONST}, +{input:"Lambda", tag:"mo", output:"\u039B", tex:null, ttype:CONST}, +{input:"lamda", tag:"mi", output:"lambda", tex:null, ttype:DEFINITION}, +{input:"Lamda", tag:"mi", output:"Lambda", tex:null, ttype:DEFINITION}, +{input:"mu", tag:"mi", output:"\u03BC", tex:null, ttype:CONST}, +{input:"nu", tag:"mi", output:"\u03BD", tex:null, ttype:CONST}, +{input:"omega", tag:"mi", output:"\u03C9", tex:null, ttype:CONST}, +{input:"Omega", tag:"mo", output:"\u03A9", tex:null, ttype:CONST}, +{input:"phi", tag:"mi", output:"\u03C6", tex:null, ttype:CONST}, +{input:"varphi", tag:"mi", output:"\u03D5", tex:null, ttype:CONST}, +{input:"Phi", tag:"mo", output:"\u03A6", tex:null, ttype:CONST}, +{input:"pi", tag:"mi", output:"\u03C0", tex:null, ttype:CONST}, +{input:"Pi", tag:"mo", output:"\u03A0", tex:null, ttype:CONST}, +{input:"psi", tag:"mi", output:"\u03C8", tex:null, ttype:CONST}, +{input:"Psi", tag:"mi", output:"\u03A8", tex:null, ttype:CONST}, +{input:"rho", tag:"mi", output:"\u03C1", tex:null, ttype:CONST}, +{input:"sigma", tag:"mi", output:"\u03C3", tex:null, ttype:CONST}, +{input:"Sigma", tag:"mo", output:"\u03A3", tex:null, ttype:CONST}, +{input:"tau", tag:"mi", output:"\u03C4", tex:null, ttype:CONST}, +{input:"theta", tag:"mi", output:"\u03B8", tex:null, ttype:CONST}, +{input:"vartheta", tag:"mi", output:"\u03D1", tex:null, ttype:CONST}, +{input:"Theta", tag:"mo", output:"\u0398", tex:null, ttype:CONST}, +{input:"upsilon", tag:"mi", output:"\u03C5", tex:null, ttype:CONST}, +{input:"xi", tag:"mi", output:"\u03BE", tex:null, ttype:CONST}, +{input:"Xi", tag:"mo", output:"\u039E", tex:null, ttype:CONST}, +{input:"zeta", tag:"mi", output:"\u03B6", tex:null, ttype:CONST}, + +//binary operation symbols +{input:"*", tag:"mo", output:"\u22C5", tex:"cdot", ttype:CONST}, +{input:"**", tag:"mo", output:"\u2217", tex:"ast", ttype:CONST}, +{input:"***", tag:"mo", output:"\u22C6", tex:"star", ttype:CONST}, +{input:"//", tag:"mo", output:"/", tex:"/", ttype:CONST, val:true, notexcopy:true}, +{input:"\\\\", tag:"mo", output:"\\", tex:"backslash", ttype:CONST}, +{input:"setminus", tag:"mo", output:"\\", tex:null, ttype:CONST}, +{input:"xx", tag:"mo", output:"\u00D7", tex:"times", ttype:CONST}, +{input:"|><", tag:"mo", output:"\u22C9", tex:"ltimes", ttype:CONST}, +{input:"><|", tag:"mo", output:"\u22CA", tex:"rtimes", ttype:CONST}, +{input:"|><|", tag:"mo", output:"\u22C8", tex:"bowtie", ttype:CONST}, +{input:"-:", tag:"mo", output:"\u00F7", tex:"div", ttype:CONST}, +{input:"divide", tag:"mo", output:"-:", tex:null, ttype:DEFINITION}, +{input:"@", tag:"mo", output:"\u2218", tex:"circ", ttype:CONST}, +{input:"o+", tag:"mo", output:"\u2295", tex:"oplus", ttype:CONST}, +{input:"ox", tag:"mo", output:"\u2297", tex:"otimes", ttype:CONST}, +{input:"o.", tag:"mo", output:"\u2299", tex:"odot", ttype:CONST}, +{input:"sum", tag:"mo", output:"\u2211", tex:null, ttype:UNDEROVER}, +{input:"prod", tag:"mo", output:"\u220F", tex:null, ttype:UNDEROVER}, +{input:"^^", tag:"mo", output:"\u2227", tex:"wedge", ttype:CONST}, +{input:"^^^", tag:"mo", output:"\u22C0", tex:"bigwedge", ttype:UNDEROVER}, +{input:"vv", tag:"mo", output:"\u2228", tex:"vee", ttype:CONST}, +{input:"vvv", tag:"mo", output:"\u22C1", tex:"bigvee", ttype:UNDEROVER}, +{input:"nn", tag:"mo", output:"\u2229", tex:"cap", ttype:CONST}, +{input:"nnn", tag:"mo", output:"\u22C2", tex:"bigcap", ttype:UNDEROVER}, +{input:"uu", tag:"mo", output:"\u222A", tex:"cup", ttype:CONST}, +{input:"uuu", tag:"mo", output:"\u22C3", tex:"bigcup", ttype:UNDEROVER}, +{input:"overset", tag:"mover", output:"stackrel", tex:null, ttype:BINARY}, +{input:"underset", tag:"munder", output:"stackrel", tex:null, ttype:BINARY}, + +//binary relation symbols +{input:"!=", tag:"mo", output:"\u2260", tex:"ne", ttype:CONST}, +{input:":=", tag:"mo", output:":=", tex:null, ttype:CONST}, +{input:"lt", tag:"mo", output:"<", tex:null, ttype:CONST}, +{input:"gt", tag:"mo", output:">", tex:null, ttype:CONST}, +{input:"<=", tag:"mo", output:"\u2264", tex:"le", ttype:CONST}, +{input:"lt=", tag:"mo", output:"\u2264", tex:"leq", ttype:CONST}, +{input:"gt=", tag:"mo", output:"\u2265", tex:"geq", ttype:CONST}, +{input:">=", tag:"mo", output:"\u2265", tex:"ge", ttype:CONST}, +{input:"-<", tag:"mo", output:"\u227A", tex:"prec", ttype:CONST}, +{input:"-lt", tag:"mo", output:"\u227A", tex:null, ttype:CONST}, +{input:">-", tag:"mo", output:"\u227B", tex:"succ", ttype:CONST}, +{input:"-<=", tag:"mo", output:"\u2AAF", tex:"preceq", ttype:CONST}, +{input:">-=", tag:"mo", output:"\u2AB0", tex:"succeq", ttype:CONST}, +{input:"in", tag:"mo", output:"\u2208", tex:null, ttype:CONST}, +{input:"!in", tag:"mo", output:"\u2209", tex:"notin", ttype:CONST}, +{input:"sub", tag:"mo", output:"\u2282", tex:"subset", ttype:CONST}, +{input:"sup", tag:"mo", output:"\u2283", tex:"supset", ttype:CONST}, +{input:"sube", tag:"mo", output:"\u2286", tex:"subseteq", ttype:CONST}, +{input:"supe", tag:"mo", output:"\u2287", tex:"supseteq", ttype:CONST}, +{input:"-=", tag:"mo", output:"\u2261", tex:"equiv", ttype:CONST}, +{input:"~=", tag:"mo", output:"\u2245", tex:"stackrel{\\sim}{=}", ttype:CONST}, //back hack b/c mimetex doesn't support /cong +{input:"cong", tag:"mo", output:"~=", tex:null, ttype:DEFINITION}, +{input:"~~", tag:"mo", output:"\u2248", tex:"approx", ttype:CONST}, +{input:"prop", tag:"mo", output:"\u221D", tex:"propto", ttype:CONST}, + +//logical symbols +{input:"and", tag:"mtext", output:"and", tex:null, ttype:SPACE}, +{input:"or", tag:"mtext", output:"or", tex:null, ttype:SPACE}, +{input:"not", tag:"mo", output:"\u00AC", tex:"neg", ttype:CONST}, +{input:"=>", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:CONST}, +{input:"implies", tag:"mo", output:"=>", tex:null, ttype:DEFINITION}, +{input:"if", tag:"mo", output:"if", tex:null, ttype:SPACE}, +{input:"<=>", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:CONST}, +{input:"iff", tag:"mo", output:"<=>", tex:null, ttype:DEFINITION}, +{input:"AA", tag:"mo", output:"\u2200", tex:"forall", ttype:CONST}, +{input:"EE", tag:"mo", output:"\u2203", tex:"exists", ttype:CONST}, +{input:"_|_", tag:"mo", output:"\u22A5", tex:"bot", ttype:CONST}, +{input:"TT", tag:"mo", output:"\u22A4", tex:"top", ttype:CONST}, +{input:"|--", tag:"mo", output:"\u22A2", tex:"vdash", ttype:CONST}, +{input:"|==", tag:"mo", output:"\u22A8", tex:"models", ttype:CONST}, //mimetex doesn't support + +//grouping brackets +{input:"(", tag:"mo", output:"(", tex:null, ttype:LEFTBRACKET, val:true}, +{input:")", tag:"mo", output:")", tex:null, ttype:RIGHTBRACKET, val:true}, +{input:"[", tag:"mo", output:"[", tex:null, ttype:LEFTBRACKET, val:true}, +{input:"]", tag:"mo", output:"]", tex:null, ttype:RIGHTBRACKET, val:true}, +{input:"{", tag:"mo", output:"{", tex:"lbrace", ttype:LEFTBRACKET}, +{input:"}", tag:"mo", output:"}", tex:"rbrace", ttype:RIGHTBRACKET}, +{input:"|", tag:"mo", output:"|", tex:null, ttype:LEFTRIGHT, val:true}, +//{input:"||", tag:"mo", output:"||", tex:null, ttype:LEFTRIGHT}, +{input:"(:", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET}, +{input:":)", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET}, +{input:"<<", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET}, +{input:">>", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET}, +{input:"{:", tag:"mo", output:"{:", tex:null, ttype:LEFTBRACKET, invisible:true}, +{input:":}", tag:"mo", output:":}", tex:null, ttype:RIGHTBRACKET, invisible:true}, + +//miscellaneous symbols +{input:"int", tag:"mo", output:"\u222B", tex:null, ttype:CONST}, +{input:"dx", tag:"mi", output:"{:d x:}", tex:null, ttype:DEFINITION}, +{input:"dy", tag:"mi", output:"{:d y:}", tex:null, ttype:DEFINITION}, +{input:"dz", tag:"mi", output:"{:d z:}", tex:null, ttype:DEFINITION}, +{input:"dt", tag:"mi", output:"{:d t:}", tex:null, ttype:DEFINITION}, +{input:"oint", tag:"mo", output:"\u222E", tex:null, ttype:CONST}, +{input:"del", tag:"mo", output:"\u2202", tex:"partial", ttype:CONST}, +{input:"grad", tag:"mo", output:"\u2207", tex:"nabla", ttype:CONST}, +{input:"+-", tag:"mo", output:"\u00B1", tex:"pm", ttype:CONST}, +{input:"O/", tag:"mo", output:"\u2205", tex:"emptyset", ttype:CONST}, +{input:"oo", tag:"mo", output:"\u221E", tex:"infty", ttype:CONST}, +{input:"aleph", tag:"mo", output:"\u2135", tex:null, ttype:CONST}, +{input:"...", tag:"mo", output:"...", tex:"ldots", ttype:CONST}, +{input:":.", tag:"mo", output:"\u2234", tex:"therefore", ttype:CONST}, +{input:":'", tag:"mo", output:"\u2235", tex:"because", ttype:CONST}, +{input:"/_", tag:"mo", output:"\u2220", tex:"angle", ttype:CONST}, +{input:"/_\\", tag:"mo", output:"\u25B3", tex:"triangle", ttype:CONST}, +{input:"\\ ", tag:"mo", output:"\u00A0", tex:null, ttype:CONST, val:true}, +{input:"frown", tag:"mo", output:"\u2322", tex:null, ttype:CONST}, +{input:"%", tag:"mo", output:"%", tex:"%", ttype:CONST, notexcopy:true}, +{input:"quad", tag:"mo", output:"\u00A0\u00A0", tex:null, ttype:CONST}, +{input:"qquad", tag:"mo", output:"\u00A0\u00A0\u00A0\u00A0", tex:null, ttype:CONST}, +{input:"cdots", tag:"mo", output:"\u22EF", tex:null, ttype:CONST}, +{input:"vdots", tag:"mo", output:"\u22EE", tex:null, ttype:CONST}, +{input:"ddots", tag:"mo", output:"\u22F1", tex:null, ttype:CONST}, +{input:"diamond", tag:"mo", output:"\u22C4", tex:null, ttype:CONST}, +{input:"square", tag:"mo", output:"\u25A1", tex:"boxempty", ttype:CONST}, +{input:"|__", tag:"mo", output:"\u230A", tex:"lfloor", ttype:CONST}, +{input:"__|", tag:"mo", output:"\u230B", tex:"rfloor", ttype:CONST}, +{input:"|~", tag:"mo", output:"\u2308", tex:"lceil", ttype:CONST}, +{input:"lceiling", tag:"mo", output:"|~", tex:null, ttype:DEFINITION}, +{input:"~|", tag:"mo", output:"\u2309", tex:"rceil", ttype:CONST}, +{input:"rceiling", tag:"mo", output:"~|", tex:null, ttype:DEFINITION}, +{input:"CC", tag:"mo", output:"\u2102", tex:"mathbb{C}", ttype:CONST, notexcopy:true}, +{input:"NN", tag:"mo", output:"\u2115", tex:"mathbb{N}", ttype:CONST, notexcopy:true}, +{input:"QQ", tag:"mo", output:"\u211A", tex:"mathbb{Q}", ttype:CONST, notexcopy:true}, +{input:"RR", tag:"mo", output:"\u211D", tex:"mathbb{R}", ttype:CONST, notexcopy:true}, +{input:"ZZ", tag:"mo", output:"\u2124", tex:"mathbb{Z}", ttype:CONST, notexcopy:true}, +{input:"f", tag:"mi", output:"f", tex:null, ttype:UNARY, func:true, val:true}, +{input:"g", tag:"mi", output:"g", tex:null, ttype:UNARY, func:true, val:true}, +{input:"''", tag:"mo", output:"''", tex:null, val:true}, +{input:"'''", tag:"mo", output:"'''", tex:null, val:true}, +{input:"''''", tag:"mo", output:"''''", tex:null, val:true}, + + +//standard functions +{input:"lim", tag:"mo", output:"lim", tex:null, ttype:UNDEROVER}, +{input:"Lim", tag:"mo", output:"Lim", tex:null, ttype:UNDEROVER}, +{input:"sin", tag:"mo", output:"sin", tex:null, ttype:UNARY, func:true}, +{input:"cos", tag:"mo", output:"cos", tex:null, ttype:UNARY, func:true}, +{input:"tan", tag:"mo", output:"tan", tex:null, ttype:UNARY, func:true}, +{input:"arcsin", tag:"mo", output:"arcsin", tex:null, ttype:UNARY, func:true}, +{input:"arccos", tag:"mo", output:"arccos", tex:null, ttype:UNARY, func:true}, +{input:"arctan", tag:"mo", output:"arctan", tex:null, ttype:UNARY, func:true}, +{input:"sinh", tag:"mo", output:"sinh", tex:null, ttype:UNARY, func:true}, +{input:"cosh", tag:"mo", output:"cosh", tex:null, ttype:UNARY, func:true}, +{input:"tanh", tag:"mo", output:"tanh", tex:null, ttype:UNARY, func:true}, +{input:"cot", tag:"mo", output:"cot", tex:null, ttype:UNARY, func:true}, +{input:"coth", tag:"mo", output:"coth", tex:null, ttype:UNARY, func:true}, +{input:"sech", tag:"mo", output:"sech", tex:null, ttype:UNARY, func:true}, +{input:"csch", tag:"mo", output:"csch", tex:null, ttype:UNARY, func:true}, +{input:"sec", tag:"mo", output:"sec", tex:null, ttype:UNARY, func:true}, +{input:"csc", tag:"mo", output:"csc", tex:null, ttype:UNARY, func:true}, +{input:"log", tag:"mo", output:"log", tex:null, ttype:UNARY, func:true}, +{input:"ln", tag:"mo", output:"ln", tex:null, ttype:UNARY, func:true}, +{input:"abs", tag:"mo", output:"abs", tex:null, ttype:UNARY, notexcopy:true, rewriteleftright:["|","|"]}, +{input:"norm", tag:"mo", output:"norm", tex:null, ttype:UNARY, notexcopy:true, rewriteleftright:["\\|","\\|"]}, +{input:"floor", tag:"mo", output:"floor", tex:null, ttype:UNARY, notexcopy:true, rewriteleftright:["\\lfloor","\\rfloor"]}, +{input:"ceil", tag:"mo", output:"ceil", tex:null, ttype:UNARY, notexcopy:true, rewriteleftright:["\\lceil","\\rceil"]}, +{input:"Sin", tag:"mo", output:"sin", tex:null, ttype:UNARY, func:true}, +{input:"Cos", tag:"mo", output:"cos", tex:null, ttype:UNARY, func:true}, +{input:"Tan", tag:"mo", output:"tan", tex:null, ttype:UNARY, func:true}, +{input:"Arcsin", tag:"mo", output:"arcsin", tex:null, ttype:UNARY, func:true}, +{input:"Arccos", tag:"mo", output:"arccos", tex:null, ttype:UNARY, func:true}, +{input:"Arctan", tag:"mo", output:"arctan", tex:null, ttype:UNARY, func:true}, +{input:"Sinh", tag:"mo", output:"sinh", tex:null, ttype:UNARY, func:true}, +{input:"Sosh", tag:"mo", output:"cosh", tex:null, ttype:UNARY, func:true}, +{input:"Tanh", tag:"mo", output:"tanh", tex:null, ttype:UNARY, func:true}, +{input:"Cot", tag:"mo", output:"cot", tex:null, ttype:UNARY, func:true}, +{input:"Sec", tag:"mo", output:"sec", tex:null, ttype:UNARY, func:true}, +{input:"Csc", tag:"mo", output:"csc", tex:null, ttype:UNARY, func:true}, +{input:"Log", tag:"mo", output:"log", tex:null, ttype:UNARY, func:true}, +{input:"Ln", tag:"mo", output:"ln", tex:null, ttype:UNARY, func:true}, +{input:"Abs", tag:"mo", output:"abs", tex:null, ttype:UNARY, notexcopy:true, rewriteleftright:["|","|"]}, + +{input:"det", tag:"mo", output:"det", tex:null, ttype:UNARY, func:true}, +{input:"exp", tag:"mo", output:"exp", tex:null, ttype:UNARY, func:true}, +{input:"dim", tag:"mo", output:"dim", tex:null, ttype:CONST}, +{input:"mod", tag:"mo", output:"mod", tex:"text{mod}", ttype:CONST, notexcopy:true}, +{input:"gcd", tag:"mo", output:"gcd", tex:null, ttype:UNARY, func:true}, +{input:"lcm", tag:"mo", output:"lcm", tex:"text{lcm}", ttype:UNARY, func:true, notexcopy:true}, +{input:"lub", tag:"mo", output:"lub", tex:null, ttype:CONST}, +{input:"glb", tag:"mo", output:"glb", tex:null, ttype:CONST}, +{input:"min", tag:"mo", output:"min", tex:null, ttype:UNDEROVER}, +{input:"max", tag:"mo", output:"max", tex:null, ttype:UNDEROVER}, + +//arrows +{input:"uarr", tag:"mo", output:"\u2191", tex:"uparrow", ttype:CONST}, +{input:"darr", tag:"mo", output:"\u2193", tex:"downarrow", ttype:CONST}, +{input:"rarr", tag:"mo", output:"\u2192", tex:"rightarrow", ttype:CONST}, +{input:"->", tag:"mo", output:"\u2192", tex:"to", ttype:CONST}, +{input:">->", tag:"mo", output:"\u21A3", tex:"rightarrowtail", ttype:CONST}, +{input:"->>", tag:"mo", output:"\u21A0", tex:"twoheadrightarrow", ttype:CONST}, +{input:">->>", tag:"mo", output:"\u2916", tex:"twoheadrightarrowtail", ttype:CONST}, +{input:"|->", tag:"mo", output:"\u21A6", tex:"mapsto", ttype:CONST}, +{input:"larr", tag:"mo", output:"\u2190", tex:"leftarrow", ttype:CONST}, +{input:"harr", tag:"mo", output:"\u2194", tex:"leftrightarrow", ttype:CONST}, +{input:"rArr", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:CONST}, +{input:"lArr", tag:"mo", output:"\u21D0", tex:"Leftarrow", ttype:CONST}, +{input:"hArr", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:CONST}, + +//commands with argument +AMsqrt, AMroot, AMfrac, AMdiv, AMover, AMsub, AMsup, +{input:"cancel", tag:"menclose", output:"cancel", tex:null, ttype:UNARY}, +{input:"Sqrt", tag:"msqrt", output:"sqrt", tex:null, ttype:UNARY}, +{input:"hat", tag:"mover", output:"\u005E", tex:null, ttype:UNARY, acc:true}, +{input:"bar", tag:"mover", output:"\u00AF", tex:"overline", ttype:UNARY, acc:true}, +{input:"vec", tag:"mover", output:"\u2192", tex:null, ttype:UNARY, acc:true}, +{input:"tilde", tag:"mover", output:"~", tex:null, ttype:UNARY, acc:true}, +{input:"dot", tag:"mover", output:".", tex:null, ttype:UNARY, acc:true}, +{input:"ddot", tag:"mover", output:"..", tex:null, ttype:UNARY, acc:true}, +{input:"ul", tag:"munder", output:"\u0332", tex:"underline", ttype:UNARY, acc:true}, +{input:"ubrace", tag:"munder", output:"\u23DF", tex:"underbrace", ttype:UNARY, acc:true}, +{input:"obrace", tag:"mover", output:"\u23DE", tex:"overbrace", ttype:UNARY, acc:true}, +AMtext, AMmbox, AMquote, +//{input:"var", tag:"mstyle", atname:"fontstyle", atval:"italic", output:"var", tex:null, ttype:UNARY}, +{input:"color", tag:"mstyle", ttype:BINARY}, +{input:"bb", tag:"mstyle", atname:"mathvariant", atval:"bold", output:"bb", tex:"mathbf", ttype:UNARY, notexcopy:true}, +{input:"mathbf", tag:"mstyle", atname:"mathvariant", atval:"bold", output:"mathbf", tex:null, ttype:UNARY}, +{input:"sf", tag:"mstyle", atname:"mathvariant", atval:"sans-serif", output:"sf", tex:"mathsf", ttype:UNARY, notexcopy:true}, +{input:"mathsf", tag:"mstyle", atname:"mathvariant", atval:"sans-serif", output:"mathsf", tex:null, ttype:UNARY}, +{input:"bbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"bbb", tex:"mathbb", ttype:UNARY, notexcopy:true}, +{input:"mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"mathbb", tex:null, ttype:UNARY}, +{input:"cc", tag:"mstyle", atname:"mathvariant", atval:"script", output:"cc", tex:"mathcal", ttype:UNARY, notexcopy:true}, +{input:"mathcal", tag:"mstyle", atname:"mathvariant", atval:"script", output:"mathcal", tex:null, ttype:UNARY}, +{input:"tt", tag:"mstyle", atname:"mathvariant", atval:"monospace", output:"tt", tex:"mathtt", ttype:UNARY, notexcopy:true}, +{input:"mathtt", tag:"mstyle", atname:"mathvariant", atval:"monospace", output:"mathtt", tex:null, ttype:UNARY}, +{input:"fr", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"fr", tex:"mathfrak", ttype:UNARY, notexcopy:true}, +{input:"mathfrak", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"mathfrak", tex:null, ttype:UNARY} +]; + +function compareNames(s1,s2) { + if (s1.input > s2.input) return 1 + else return -1; +} + +var AMnames = []; //list of input symbols + +function AMinitSymbols() { + var i; + var symlen = AMsymbols.length; + for (i=0; i=n where str appears or would be inserted +// assumes arr is sorted + if (n==0) { + var h,m; + n = -1; + h = arr.length; + while (n+1> 1; + if (arr[m]=str +} + +function AMgetSymbol(str) { +//return maximal initial substring of str that appears in names +//return null if there is none + var k = 0; //new pos + var j = 0; //old pos + var mk; //match pos + var st; + var tagst; + var match = ""; + var more = true; + for (var i=1; i<=str.length && more; i++) { + st = str.slice(0,i); //initial substring of length i + j = k; + k = AMposition(AMnames, st, j); + if (k=AMnames[k]; + } + AMpreviousSymbol=AMcurrentSymbol; + if (match!=""){ + AMcurrentSymbol=AMsymbols[mk].ttype; + return AMsymbols[mk]; + } +// if str[0] is a digit or - return maxsubstring of digits.digits + AMcurrentSymbol=CONST; + k = 1; + st = str.slice(0,1); + var integ = true; + + while ("0"<=st && st<="9" && k<=str.length) { + st = str.slice(k,k+1); + k++; + } + if (st == config.decimalsign) { + st = str.slice(k,k+1); + if ("0"<=st && st<="9") { + integ = false; + k++; + while ("0"<=st && st<="9" && k<=str.length) { + st = str.slice(k,k+1); + k++; + } + } + } + if ((integ && k>1) || k>2) { + st = str.slice(0,k-1); + tagst = "mn"; + } else { + k = 2; + st = str.slice(0,1); //take 1 character + tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi"); + } + if (st=="-" && AMpreviousSymbol==INFIX) { + AMcurrentSymbol = INFIX; + return {input:st, tag:tagst, output:st, ttype:UNARY, func:true, val:true}; + } + return {input:st, tag:tagst, output:st, ttype:CONST, val:true}; //added val bit +} + +function AMTremoveBrackets(node) { + + var st; + if (node.charAt(0)=='{' && node.charAt(node.length-1)=='}') { + var leftchop = 0; + + st = node.substr(1,5); + if (st=='\\left') { + st = node.charAt(6); + if (st=="(" || st=="[" || st=="{") { + leftchop = 7; + } else { + st = node.substr(6,7); + if (st=='\\lbrace') { + leftchop = 13; + } + } + } else { + st = node.charAt(1); + if (st=="(" || st=="[") { + leftchop = 2; + } + } + if (leftchop>0) { + //st = node.charAt(node.length-7); + st = node.substr(node.length-8); + if (st=="\\right)}" || st=="\\right]}" || st=='\\right.}') { + node = '{'+node.substr(leftchop); + node = node.substr(0,node.length-8)+'}'; + } else if (st=='\\rbrace}') { + node = '{'+node.substr(leftchop); + node = node.substr(0,node.length-14)+'}'; + } + } + } + return node; +} + +/*Parsing ASCII math expressions with the following grammar +v ::= [A-Za-z] | greek letters | numbers | other constant symbols +u ::= sqrt | text | bb | other unary symbols for font commands +b ::= frac | root | stackrel binary symbols +l ::= ( | [ | { | (: | {: left brackets +r ::= ) | ] | } | :) | :} right brackets +S ::= v | lEr | uS | bSS Simple expression +I ::= S_S | S^S | S_S^S | S Intermediate expression +E ::= IE | I/I Expression +Each terminal symbol is translated into a corresponding mathml node.*/ + +var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol; + +function AMTgetTeXsymbol(symb) { + if (typeof symb.val == "boolean" && symb.val) { + pre = ''; + } else { + pre = '\\'; + } + if (symb.tex==null) { + //can't remember why this was here. Breaks /delta /Delta to removed + //return (pre+(pre==''?symb.input:symb.input.toLowerCase())); + return (pre+symb.input); + } else { + return (pre+symb.tex); + } +} + +function AMTparseSexpr(str) { //parses str and returns [node,tailstr] + var symbol, node, result, i, st,// rightvert = false, + newFrag = ''; + str = AMremoveCharsAndBlanks(str,0); + symbol = AMgetSymbol(str); //either a token or a bracket or empty + if (symbol == null || symbol.ttype == RIGHTBRACKET && AMnestingDepth > 0) { + return [null,str]; + } + if (symbol.ttype == DEFINITION) { + str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length); + symbol = AMgetSymbol(str); + } + switch (symbol.ttype) { + case UNDEROVER: + case CONST: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + var texsymbol = AMTgetTeXsymbol(symbol); + if (texsymbol.charAt(0)=="\\" || symbol.tag=="mo") return [texsymbol,str]; + else return ['{'+texsymbol+'}',str]; + + case LEFTBRACKET: //read (expr+) + AMnestingDepth++; + str = AMremoveCharsAndBlanks(str,symbol.input.length); + + result = AMTparseExpr(str,true); + AMnestingDepth--; + var leftchop = 0; + if (result[0].substr(0,6)=="\\right") { + st = result[0].charAt(6); + if (st==")" || st=="]" || st=="}") { + leftchop = 6; + } else if (st==".") { + leftchop = 7; + } else { + st = result[0].substr(6,7); + if (st=='\\rbrace') { + leftchop = 13; + } + } + } + if (leftchop>0) { + result[0] = result[0].substr(leftchop); + if (typeof symbol.invisible == "boolean" && symbol.invisible) + node = '{'+result[0]+'}'; + else { + node = '{'+AMTgetTeXsymbol(symbol) + result[0]+'}'; + } + } else { + if (typeof symbol.invisible == "boolean" && symbol.invisible) + node = '{\\left.'+result[0]+'}'; + else { + node = '{\\left'+AMTgetTeXsymbol(symbol) + result[0]+'}'; + } + } + return [node,result[1]]; + case TEXT: + if (symbol!=AMquote) str = AMremoveCharsAndBlanks(str,symbol.input.length); + if (str.charAt(0)=="{") i=str.indexOf("}"); + else if (str.charAt(0)=="(") i=str.indexOf(")"); + else if (str.charAt(0)=="[") i=str.indexOf("]"); + else if (symbol==AMquote) i=str.slice(1).indexOf("\"")+1; + else i = 0; + if (i==-1) i = str.length; + st = str.slice(1,i); + if (st.charAt(0) == " ") { + newFrag = '\\ '; + } + newFrag += '\\text{'+st+'}'; + if (st.charAt(st.length-1) == " ") { + newFrag += '\\ '; + } + str = AMremoveCharsAndBlanks(str,i+1); + return [newFrag,str]; + case UNARY: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMTparseSexpr(str); + if (result[0]==null) return ['{'+AMTgetTeXsymbol(symbol)+'}',str]; + if (typeof symbol.func == "boolean" && symbol.func) { // functions hack + st = str.charAt(0); + if (st=="^" || st=="_" || st=="/" || st=="|" || st=="," || (symbol.input.length==1 && symbol.input.match(/\w/) && st!="(")) { + return ['{'+AMTgetTeXsymbol(symbol)+'}',str]; + } else { + node = '{'+AMTgetTeXsymbol(symbol)+'{'+result[0]+'}}'; + return [node,result[1]]; + } + } + result[0] = AMTremoveBrackets(result[0]); + if (symbol.input == "sqrt") { // sqrt + return ['\\sqrt{'+result[0]+'}',result[1]]; + } else if (symbol.input == "cancel") { // cancel + return ['\\cancel{'+result[0]+'}',result[1]]; + } else if (typeof symbol.rewriteleftright != "undefined") { // abs, floor, ceil + return ['{\\left'+symbol.rewriteleftright[0]+result[0]+'\\right'+symbol.rewriteleftright[1]+'}',result[1]]; + } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent + //return ['{'+AMTgetTeXsymbol(symbol)+'{'+result[0]+'}}',result[1]]; + return [AMTgetTeXsymbol(symbol)+'{'+result[0]+'}',result[1]]; + } else { // font change command + return ['{'+AMTgetTeXsymbol(symbol)+'{'+result[0]+'}}',result[1]]; + } + case BINARY: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMTparseSexpr(str); + if (result[0]==null) return ['{'+AMTgetTeXsymbol(symbol)+'}',str]; + result[0] = AMTremoveBrackets(result[0]); + var result2 = AMTparseSexpr(result[1]); + if (result2[0]==null) return ['{'+AMTgetTeXsymbol(symbol)+'}',str]; + result2[0] = AMTremoveBrackets(result2[0]); + if (symbol.input=="color") { + newFrag = '{\\color{'+result[0].replace(/[\{\}]/g,'')+'}'+result2[0]+'}'; + } else if (symbol.input=="root") { + newFrag = '{\\sqrt['+result[0]+']{'+result2[0]+'}}'; + } else { + newFrag = '{'+AMTgetTeXsymbol(symbol)+'{'+result[0]+'}{'+result2[0]+'}}'; + } + return [newFrag,result2[1]]; + case INFIX: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + return [symbol.output,str]; + case SPACE: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + return ['{\\quad\\text{'+symbol.input+'}\\quad}',str]; + case LEFTRIGHT: +// if (rightvert) return [null,str]; else rightvert = true; + AMnestingDepth++; + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMTparseExpr(str,false); + AMnestingDepth--; + var st = ""; + st = result[0].charAt(result[0].length -1); +//alert(result[0].lastChild+"***"+st); + if (st == "|") { // its an absolute value subterm + node = '{\\left|'+result[0]+'}'; + return [node,result[1]]; + } else { // the "|" is a \mid + node = '{\\mid}'; + return [node,str]; + } + + default: +//alert("default"); + str = AMremoveCharsAndBlanks(str,symbol.input.length); + return ['{'+AMTgetTeXsymbol(symbol)+'}',str]; + } +} + +function AMTparseIexpr(str) { + var symbol, sym1, sym2, node, result; + str = AMremoveCharsAndBlanks(str,0); + sym1 = AMgetSymbol(str); + result = AMTparseSexpr(str); + node = result[0]; + str = result[1]; + symbol = AMgetSymbol(str); + if (symbol.ttype == INFIX && symbol.input != "/") { + str = AMremoveCharsAndBlanks(str,symbol.input.length); + // if (symbol.input == "/") result = AMTparseIexpr(str); else + result = AMTparseSexpr(str); + if (result[0] == null) // show box in place of missing argument + result[0] = '{}'; + else result[0] = AMTremoveBrackets(result[0]); + str = result[1]; +// if (symbol.input == "/") AMTremoveBrackets(node); + if (symbol.input == "_") { + sym2 = AMgetSymbol(str); + if (sym2.input == "^") { + str = AMremoveCharsAndBlanks(str,sym2.input.length); + var res2 = AMTparseSexpr(str); + res2[0] = AMTremoveBrackets(res2[0]); + str = res2[1]; + node = '{' + node; + node += '_{'+result[0]+'}'; + node += '^{'+res2[0]+'}'; + node += '}'; + } else { + node += '_{'+result[0]+'}'; + } + } else { //must be ^ + //node = '{'+node+'}^{'+result[0]+'}'; + node = node+'^{'+result[0]+'}'; + } + if (typeof sym1.func != 'undefined' && sym1.func) { + sym2 = AMgetSymbol(str); + if (sym2.ttype != INFIX && sym2.ttype != RIGHTBRACKET) { + result = AMTparseIexpr(str); + node = '{'+node+result[0]+'}'; + str = result[1]; + } + } + } + + return [node,str]; +} + +function AMTparseExpr(str,rightbracket) { + var symbol, node, result, i, nodeList = [], + newFrag = ''; + var addedright = false; + do { + str = AMremoveCharsAndBlanks(str,0); + result = AMTparseIexpr(str); + node = result[0]; + str = result[1]; + symbol = AMgetSymbol(str); + if (symbol.ttype == INFIX && symbol.input == "/") { + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMTparseIexpr(str); + + if (result[0] == null) // show box in place of missing argument + result[0] = '{}'; + else result[0] = AMTremoveBrackets(result[0]); + str = result[1]; + node = AMTremoveBrackets(node); + node = '\\frac' + '{'+ node + '}'; + node += '{'+result[0]+'}'; + newFrag += node; + symbol = AMgetSymbol(str); + } else if (node!=undefined) newFrag += node; + } while ((symbol.ttype != RIGHTBRACKET && + (symbol.ttype != LEFTRIGHT || rightbracket) + || AMnestingDepth == 0) && symbol!=null && symbol.output!=""); + if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) { +// if (AMnestingDepth > 0) AMnestingDepth--; + var len = newFrag.length; + if (len>2 && newFrag.charAt(0)=='{' && newFrag.indexOf(',')>0) { //could be matrix (total rewrite from .js) + var right = newFrag.charAt(len - 2); + if (right==')' || right==']') { + var left = newFrag.charAt(6); + if ((left=='(' && right==')' && symbol.output != '}') || (left=='[' && right==']')) { + // Modified by Arnaud Roques + //var mxout = '\\matrix{'; + var mxout = '\\begin{matrix}'; + var pos = new Array(); //position of commas + pos.push(0); + var matrix = true; + var mxnestingd = 0; + var subpos = []; + subpos[0] = [0]; + var lastsubposstart = 0; + var mxanynestingd = 0; + for (i=1; i0 && matrix) { + for (i=0;i0) mxout += '\\\\'; + if (i==0) { + //var subarr = newFrag.substr(pos[i]+7,pos[i+1]-pos[i]-15).split(','); + if (subpos[pos[i]].length==1) { + var subarr = [newFrag.substr(pos[i]+7,pos[i+1]-pos[i]-15)]; + } else { + var subarr = [newFrag.substring(pos[i]+7,subpos[pos[i]][1])]; + for (var j=2;j0 && subarr.length!=lastmxsubcnt) { + matrix = false; + } else if (lastmxsubcnt==-1) { + lastmxsubcnt=subarr.length; + } + mxout += subarr.join('&'); + } + } + // Modified by Arnaud Roques + // mxout += '}'; + mxout += '\\end{matrix}'; + + if (matrix) { newFrag = mxout;} + } + } + } + + str = AMremoveCharsAndBlanks(str,symbol.input.length); + if (typeof symbol.invisible != "boolean" || !symbol.invisible) { + node = '\\right'+AMTgetTeXsymbol(symbol); //AMcreateMmlNode("mo",document.createTextNode(symbol.output)); + newFrag += node; + addedright = true; + } else { + newFrag += '\\right.'; + addedright = true; + } + + } + if(AMnestingDepth>0 && !addedright) { + newFrag += '\\right.'; //adjust for non-matching left brackets + //todo: adjust for non-matching right brackets + } + + return [newFrag,str]; +} + +function AMTparseAMtoTeX(str) { + AMnestingDepth = 0; + str = str.replace(/( |\u00a0| )/g,""); + str = str.replace(/>/g,">"); + str = str.replace(/</g,"<"); + if (str.match(/\S/)==null) { + return ""; + } + return AMTparseExpr(str.replace(/^\s+/g,""),false)[0]; +} + +AMinitSymbols(); + +function plantuml(asciiMathInput) { + return AMTparseAMtoTeX(asciiMathInput); +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/math/AsciiMath.java b/src/plantuml-asl/src/net/sourceforge/plantuml/math/AsciiMath.java index 576a374de..5036547f7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/math/AsciiMath.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/math/AsciiMath.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,7 +32,6 @@ import java.awt.Color; import java.awt.geom.Dimension2D; -import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -45,6 +44,7 @@ import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.SvgString; +import net.sourceforge.plantuml.ugraphic.MutableImage; public class AsciiMath implements ScientificEquation { @@ -89,16 +89,16 @@ public Dimension2D getDimension() { return builder.getDimension(); } - public SvgString getSvg(double scale, Color foregroundColor, Color backgroundColor) throws ClassNotFoundException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, - SecurityException, InstantiationException, IOException { + public SvgString getSvg(double scale, Color foregroundColor, Color backgroundColor) + throws ClassNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, + NoSuchMethodException, SecurityException, InstantiationException, IOException { return builder.getSvg(scale, foregroundColor, backgroundColor); } - public BufferedImage getImage(double scale, Color foregroundColor, Color backgroundColor) + public MutableImage getImage(Color foregroundColor, Color backgroundColor) throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { - return builder.getImage(scale, foregroundColor, backgroundColor); + return builder.getImage(foregroundColor, backgroundColor); } public String getSource() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/math/AsciiMathOld.java b/src/plantuml-asl/src/net/sourceforge/plantuml/math/AsciiMathOld.java index a9afd6e47..f4bacbd0b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/math/AsciiMathOld.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/math/AsciiMathOld.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -48,12 +48,12 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import net.sourceforge.plantuml.BackSlash; -import net.sourceforge.plantuml.Dimension2DDouble; - import org.w3c.dom.Document; import org.w3c.dom.Node; +import net.sourceforge.plantuml.BackSlash; +import net.sourceforge.plantuml.Dimension2DDouble; + public class AsciiMathOld { private static final String ASCIIMATH_PARSER_JS_LOCATION = "/net/sourceforge/plantuml/math/"; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/math/AsciiMathParser.js b/src/plantuml-asl/src/net/sourceforge/plantuml/math/AsciiMathParser.js new file mode 100644 index 000000000..b44b116e6 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/math/AsciiMathParser.js @@ -0,0 +1,846 @@ +/* + +Copyright (c) 2011-2012, The University of Edinburgh +All Rights Reserved + +This file is part of AsciiMathParser.js + +AsciiMathParser.js is free software; you can redistribute it and/or modify it +under the terms of the GNU Lesser General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +AsciiMathParser.js is 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 Lesser General Public License (at +http://www.gnu.org/licences/lgpl.html) for more details. + +You should have received a copy of the GNU Lesser General Public License +along with AsciiMathParser.js. If not, see . + +AsciiMathParser.js +================== + +This is a modified and cut-down version of ASCIIMathML.js v2.1 +that allows ASCIIMath to be used solely as a parser for ASCIIMath +input, generating an XML Element Node as a result. + +This may allow you to integrate the ASCIIMath input format with +other software and does not need to be run in a browser. + +The only requirement is that you can provide a DOM Document Object +when creating a parser. (Microsoft's implementation of Document is fine +too.) + +*/ + +/************************************************************************/ + +/* This creates a new Object that you can use to parse ASCIIMath input. + * + * You must pass a DOM Document Object here that will be used to create + * new DOM Nodes. The Doucument itself will not be modified. + * A Microsoft DOM is acceptable. + */ +function AsciiMathParser(document) { + +/* ASCIIMathML.js BEGINS BELOW. + * + * NOTE: I did a global search and replace to make NodeList traversal + * work with the Java DOM, so that childNodes[i] -> childNodes.item(i). + * This was done with the regexp s/(childNodes)\[(.+?)\]/$1.item($2)/g + * + * All other modifications made are shown below on + * lines starting with + * '//MOD: ' + */ + +//------------------------------------------------------------- + +/* +ASCIIMathML.js +============== +This file contains JavaScript functions to convert ASCII math notation +and LaTeX to Presentation MathML. Simple graphics commands are also +translated to SVG images. The conversion is done while the (X)HTML +page loads, and should work with Firefox/Mozilla/Netscape 7+ and Internet +Explorer 6/7 + MathPlayer (http://www.dessci.com/en/products/mathplayer/) + +Adobe SVGview 3.03 (http://www.adobe.com/svg/viewer/install/). + +Just add the next line to your (X)HTML page with this file in the same folder: + + + +(using the graphics in IE also requires the file "d.svg" in the same folder). +This is a convenient and inexpensive solution for authoring MathML and SVG. + +Version 2.1 Oct 8, 2008, (c) Peter Jipsen http://www.chapman.edu/~jipsen +This version extends ASCIIMathML.js with LaTeXMathML.js and ASCIIsvg.js. +Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js +If you use it on a webpage, please send the URL to jipsen@chapman.edu + +The LaTeXMathML modifications were made by Douglas Woodall, June 2006. +(for details see header on the LaTeXMathML part in middle of file) +Extensive clean-up and improvements by Paulo Soares, Oct 2007. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at +your option) any later version. + +This program is 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 Lesser General Public License +(at http://www.gnu.org/licences/lgpl.html) for more details. +*/ + +//MOD: Most of the global variables defined next are not required, +//MOD: with the exception of the following: +var decimalsign = "."; // change to "," if you like, beware of `(1,2)`! + +/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ + +//MOD: Everything from this point until the character list definitions starting +//MOD: with 'var AMcal' has been removed and replaced with the following: + +// This should be false here, since we're generating an XML DOM, rather than +// something that will be aimed at a specific browser. +var isIE = false; + +// New version of this method to overcome the lack of createElementNS() in MSXML +function createMmlNode(t,frag) { + var node; + if (document.createElementNS) { + node = document.createElementNS("http://www.w3.org/1998/Math/MathML", t); + } + else { + try { + /* MSXML */ + node = document.createNode(1, t, "http://www.w3.org/1998/Math/MathML"); + } + catch (e) { + throw "This DOM Document does not support either createElementNS() or createNS()"; + } + } + if (frag) node.appendChild(frag); + return node; +} + +// character lists for Mozilla/Netscape fonts +var AMcal = [0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46]; +var AMfrk = [0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128]; +var AMbbb = [0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124]; + +var CONST = 0, UNARY = 1, BINARY = 2, INFIX = 3, LEFTBRACKET = 4, + RIGHTBRACKET = 5, SPACE = 6, UNDEROVER = 7, DEFINITION = 8, + LEFTRIGHT = 9, TEXT = 10, BIG = 11, LONG = 12, STRETCHY = 13, + MATRIX = 14;; // token types + +var AMquote = {input:"\"", tag:"mtext", output:"mbox", tex:null, ttype:TEXT}; + +var AMsymbols = [ +//some greek symbols +{input:"alpha", tag:"mi", output:"\u03B1", tex:null, ttype:CONST}, +{input:"beta", tag:"mi", output:"\u03B2", tex:null, ttype:CONST}, +{input:"chi", tag:"mi", output:"\u03C7", tex:null, ttype:CONST}, +{input:"delta", tag:"mi", output:"\u03B4", tex:null, ttype:CONST}, +{input:"Delta", tag:"mo", output:"\u0394", tex:null, ttype:CONST}, +{input:"epsi", tag:"mi", output:"\u03B5", tex:"epsilon", ttype:CONST}, +{input:"varepsilon", tag:"mi", output:"\u025B", tex:null, ttype:CONST}, +{input:"eta", tag:"mi", output:"\u03B7", tex:null, ttype:CONST}, +{input:"gamma", tag:"mi", output:"\u03B3", tex:null, ttype:CONST}, +{input:"Gamma", tag:"mo", output:"\u0393", tex:null, ttype:CONST}, +{input:"iota", tag:"mi", output:"\u03B9", tex:null, ttype:CONST}, +{input:"kappa", tag:"mi", output:"\u03BA", tex:null, ttype:CONST}, +{input:"lambda", tag:"mi", output:"\u03BB", tex:null, ttype:CONST}, +{input:"Lambda", tag:"mo", output:"\u039B", tex:null, ttype:CONST}, +{input:"mu", tag:"mi", output:"\u03BC", tex:null, ttype:CONST}, +{input:"nu", tag:"mi", output:"\u03BD", tex:null, ttype:CONST}, +{input:"omega", tag:"mi", output:"\u03C9", tex:null, ttype:CONST}, +{input:"Omega", tag:"mo", output:"\u03A9", tex:null, ttype:CONST}, +{input:"phi", tag:"mi", output:"\u03C6", tex:null, ttype:CONST}, +{input:"varphi", tag:"mi", output:"\u03D5", tex:null, ttype:CONST}, +{input:"Phi", tag:"mo", output:"\u03A6", tex:null, ttype:CONST}, +{input:"pi", tag:"mi", output:"\u03C0", tex:null, ttype:CONST}, +{input:"Pi", tag:"mo", output:"\u03A0", tex:null, ttype:CONST}, +{input:"psi", tag:"mi", output:"\u03C8", tex:null, ttype:CONST}, +{input:"Psi", tag:"mi", output:"\u03A8", tex:null, ttype:CONST}, +{input:"rho", tag:"mi", output:"\u03C1", tex:null, ttype:CONST}, +{input:"sigma", tag:"mi", output:"\u03C3", tex:null, ttype:CONST}, +{input:"Sigma", tag:"mo", output:"\u03A3", tex:null, ttype:CONST}, +{input:"tau", tag:"mi", output:"\u03C4", tex:null, ttype:CONST}, +{input:"theta", tag:"mi", output:"\u03B8", tex:null, ttype:CONST}, +{input:"vartheta", tag:"mi", output:"\u03D1", tex:null, ttype:CONST}, +{input:"Theta", tag:"mo", output:"\u0398", tex:null, ttype:CONST}, +{input:"upsilon", tag:"mi", output:"\u03C5", tex:null, ttype:CONST}, +{input:"xi", tag:"mi", output:"\u03BE", tex:null, ttype:CONST}, +{input:"Xi", tag:"mo", output:"\u039E", tex:null, ttype:CONST}, +{input:"zeta", tag:"mi", output:"\u03B6", tex:null, ttype:CONST}, + +//binary operation symbols +//{input:"-", tag:"mo", output:"\u0096", tex:null, ttype:CONST}, +{input:"*", tag:"mo", output:"\u22C5", tex:"cdot", ttype:CONST}, +{input:"**", tag:"mo", output:"\u22C6", tex:"star", ttype:CONST}, +{input:"//", tag:"mo", output:"/", tex:null, ttype:CONST}, +{input:"\\\\", tag:"mo", output:"\\", tex:"backslash", ttype:CONST}, +{input:"setminus", tag:"mo", output:"\\", tex:null, ttype:CONST}, +{input:"xx", tag:"mo", output:"\u00D7", tex:"times", ttype:CONST}, +{input:"-:", tag:"mo", output:"\u00F7", tex:"divide", ttype:CONST}, +{input:"@", tag:"mo", output:"\u26AC", tex:"circ", ttype:CONST}, +{input:"o+", tag:"mo", output:"\u2295", tex:"oplus", ttype:CONST}, +{input:"ox", tag:"mo", output:"\u2297", tex:"otimes", ttype:CONST}, +{input:"o.", tag:"mo", output:"\u2299", tex:"odot", ttype:CONST}, +{input:"sum", tag:"mo", output:"\u2211", tex:null, ttype:UNDEROVER}, +{input:"prod", tag:"mo", output:"\u220F", tex:null, ttype:UNDEROVER}, +{input:"^^", tag:"mo", output:"\u2227", tex:"wedge", ttype:CONST}, +{input:"^^^", tag:"mo", output:"\u22C0", tex:"bigwedge", ttype:UNDEROVER}, +{input:"vv", tag:"mo", output:"\u2228", tex:"vee", ttype:CONST}, +{input:"vvv", tag:"mo", output:"\u22C1", tex:"bigvee", ttype:UNDEROVER}, +{input:"nn", tag:"mo", output:"\u2229", tex:"cap", ttype:CONST}, +{input:"nnn", tag:"mo", output:"\u22C2", tex:"bigcap", ttype:UNDEROVER}, +{input:"uu", tag:"mo", output:"\u222A", tex:"cup", ttype:CONST}, +{input:"uuu", tag:"mo", output:"\u22C3", tex:"bigcup", ttype:UNDEROVER}, + +//binary relation symbols +{input:"!=", tag:"mo", output:"\u2260", tex:"ne", ttype:CONST}, +{input:":=", tag:"mo", output:":=", tex:null, ttype:CONST}, +{input:"lt", tag:"mo", output:"<", tex:null, ttype:CONST}, +{input:"<=", tag:"mo", output:"\u2264", tex:"le", ttype:CONST}, +{input:"lt=", tag:"mo", output:"\u2264", tex:"leq", ttype:CONST}, +{input:">=", tag:"mo", output:"\u2265", tex:"ge", ttype:CONST}, +{input:"geq", tag:"mo", output:"\u2265", tex:null, ttype:CONST}, +{input:"-<", tag:"mo", output:"\u227A", tex:"prec", ttype:CONST}, +{input:"-lt", tag:"mo", output:"\u227A", tex:null, ttype:CONST}, +{input:">-", tag:"mo", output:"\u227B", tex:"succ", ttype:CONST}, +{input:"-<=", tag:"mo", output:"\u2AAF", tex:"preceq", ttype:CONST}, +{input:">-=", tag:"mo", output:"\u2AB0", tex:"succeq", ttype:CONST}, +{input:"in", tag:"mo", output:"\u2208", tex:null, ttype:CONST}, +{input:"!in", tag:"mo", output:"\u2209", tex:"notin", ttype:CONST}, +{input:"sub", tag:"mo", output:"\u2282", tex:"subset", ttype:CONST}, +{input:"sup", tag:"mo", output:"\u2283", tex:"supset", ttype:CONST}, +{input:"sube", tag:"mo", output:"\u2286", tex:"subseteq", ttype:CONST}, +{input:"supe", tag:"mo", output:"\u2287", tex:"supseteq", ttype:CONST}, +{input:"-=", tag:"mo", output:"\u2261", tex:"equiv", ttype:CONST}, +{input:"~=", tag:"mo", output:"\u2245", tex:"cong", ttype:CONST}, +{input:"~~", tag:"mo", output:"\u2248", tex:"approx", ttype:CONST}, +{input:"prop", tag:"mo", output:"\u221D", tex:"propto", ttype:CONST}, + +//logical symbols +{input:"and", tag:"mtext", output:"and", tex:null, ttype:SPACE}, +{input:"or", tag:"mtext", output:"or", tex:null, ttype:SPACE}, +{input:"not", tag:"mo", output:"\u00AC", tex:"neg", ttype:CONST}, +{input:"=>", tag:"mo", output:"\u21D2", tex:"implies", ttype:CONST}, +{input:"if", tag:"mo", output:"if", tex:null, ttype:SPACE}, +{input:"<=>", tag:"mo", output:"\u21D4", tex:"iff", ttype:CONST}, +{input:"AA", tag:"mo", output:"\u2200", tex:"forall", ttype:CONST}, +{input:"EE", tag:"mo", output:"\u2203", tex:"exists", ttype:CONST}, +{input:"_|_", tag:"mo", output:"\u22A5", tex:"bot", ttype:CONST}, +{input:"TT", tag:"mo", output:"\u22A4", tex:"top", ttype:CONST}, +{input:"|--", tag:"mo", output:"\u22A2", tex:"vdash", ttype:CONST}, +{input:"|==", tag:"mo", output:"\u22A8", tex:"models", ttype:CONST}, + +//grouping brackets +{input:"(", tag:"mo", output:"(", tex:null, ttype:LEFTBRACKET}, +{input:")", tag:"mo", output:")", tex:null, ttype:RIGHTBRACKET}, +{input:"[", tag:"mo", output:"[", tex:null, ttype:LEFTBRACKET}, +{input:"]", tag:"mo", output:"]", tex:null, ttype:RIGHTBRACKET}, +{input:"{", tag:"mo", output:"{", tex:null, ttype:LEFTBRACKET}, +{input:"}", tag:"mo", output:"}", tex:null, ttype:RIGHTBRACKET}, +{input:"|", tag:"mo", output:"|", tex:null, ttype:LEFTRIGHT}, +//{input:"||", tag:"mo", output:"||", tex:null, ttype:LEFTRIGHT}, +{input:"(:", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET}, +{input:":)", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET}, +{input:"<<", tag:"mo", output:"\u2329", tex:null, ttype:LEFTBRACKET}, +{input:">>", tag:"mo", output:"\u232A", tex:null, ttype:RIGHTBRACKET}, +{input:"{:", tag:"mo", output:"{:", tex:null, ttype:LEFTBRACKET, invisible:true}, +{input:":}", tag:"mo", output:":}", tex:null, ttype:RIGHTBRACKET, invisible:true}, + +//miscellaneous symbols +{input:"int", tag:"mo", output:"\u222B", tex:null, ttype:CONST}, +{input:"dx", tag:"mi", output:"{:d x:}", tex:null, ttype:DEFINITION}, +{input:"dy", tag:"mi", output:"{:d y:}", tex:null, ttype:DEFINITION}, +{input:"dz", tag:"mi", output:"{:d z:}", tex:null, ttype:DEFINITION}, +{input:"dt", tag:"mi", output:"{:d t:}", tex:null, ttype:DEFINITION}, +{input:"oint", tag:"mo", output:"\u222E", tex:null, ttype:CONST}, +{input:"del", tag:"mo", output:"\u2202", tex:"partial", ttype:CONST}, +{input:"grad", tag:"mo", output:"\u2207", tex:"nabla", ttype:CONST}, +{input:"+-", tag:"mo", output:"\u00B1", tex:"pm", ttype:CONST}, +{input:"O/", tag:"mo", output:"\u2205", tex:"emptyset", ttype:CONST}, +{input:"oo", tag:"mo", output:"\u221E", tex:"infty", ttype:CONST}, +{input:"aleph", tag:"mo", output:"\u2135", tex:null, ttype:CONST}, +{input:"...", tag:"mo", output:"...", tex:"ldots", ttype:CONST}, +{input:":.", tag:"mo", output:"\u2234", tex:"therefore", ttype:CONST}, +{input:"/_", tag:"mo", output:"\u2220", tex:"angle", ttype:CONST}, +{input:"\\ ", tag:"mo", output:"\u00A0", tex:null, ttype:CONST}, +{input:"quad", tag:"mo", output:"\u00A0\u00A0", tex:null, ttype:CONST}, +{input:"qquad", tag:"mo", output:"\u00A0\u00A0\u00A0\u00A0", tex:null, ttype:CONST}, +{input:"cdots", tag:"mo", output:"\u22EF", tex:null, ttype:CONST}, +{input:"vdots", tag:"mo", output:"\u22EE", tex:null, ttype:CONST}, +{input:"ddots", tag:"mo", output:"\u22F1", tex:null, ttype:CONST}, +{input:"diamond", tag:"mo", output:"\u22C4", tex:null, ttype:CONST}, +{input:"square", tag:"mo", output:"\u25A1", tex:null, ttype:CONST}, +{input:"|__", tag:"mo", output:"\u230A", tex:"lfloor", ttype:CONST}, +{input:"__|", tag:"mo", output:"\u230B", tex:"rfloor", ttype:CONST}, +{input:"|~", tag:"mo", output:"\u2308", tex:"lceiling", ttype:CONST}, +{input:"~|", tag:"mo", output:"\u2309", tex:"rceiling", ttype:CONST}, +{input:"CC", tag:"mo", output:"\u2102", tex:null, ttype:CONST}, +{input:"NN", tag:"mo", output:"\u2115", tex:null, ttype:CONST}, +{input:"QQ", tag:"mo", output:"\u211A", tex:null, ttype:CONST}, +{input:"RR", tag:"mo", output:"\u211D", tex:null, ttype:CONST}, +{input:"ZZ", tag:"mo", output:"\u2124", tex:null, ttype:CONST}, +{input:"f", tag:"mi", output:"f", tex:null, ttype:UNARY, func:true}, +{input:"g", tag:"mi", output:"g", tex:null, ttype:UNARY, func:true}, + +//standard functions +{input:"lim", tag:"mo", output:"lim", tex:null, ttype:UNDEROVER}, +{input:"Lim", tag:"mo", output:"Lim", tex:null, ttype:UNDEROVER}, +{input:"sin", tag:"mo", output:"sin", tex:null, ttype:UNARY, func:true}, +{input:"cos", tag:"mo", output:"cos", tex:null, ttype:UNARY, func:true}, +{input:"tan", tag:"mo", output:"tan", tex:null, ttype:UNARY, func:true}, +{input:"sinh", tag:"mo", output:"sinh", tex:null, ttype:UNARY, func:true}, +{input:"cosh", tag:"mo", output:"cosh", tex:null, ttype:UNARY, func:true}, +{input:"tanh", tag:"mo", output:"tanh", tex:null, ttype:UNARY, func:true}, +{input:"cot", tag:"mo", output:"cot", tex:null, ttype:UNARY, func:true}, +{input:"sec", tag:"mo", output:"sec", tex:null, ttype:UNARY, func:true}, +{input:"csc", tag:"mo", output:"csc", tex:null, ttype:UNARY, func:true}, +{input:"log", tag:"mo", output:"log", tex:null, ttype:UNARY, func:true}, +{input:"ln", tag:"mo", output:"ln", tex:null, ttype:UNARY, func:true}, +{input:"det", tag:"mo", output:"det", tex:null, ttype:UNARY, func:true}, +{input:"dim", tag:"mo", output:"dim", tex:null, ttype:CONST}, +{input:"mod", tag:"mo", output:"mod", tex:null, ttype:CONST}, +{input:"gcd", tag:"mo", output:"gcd", tex:null, ttype:UNARY, func:true}, +{input:"lcm", tag:"mo", output:"lcm", tex:null, ttype:UNARY, func:true}, +{input:"lub", tag:"mo", output:"lub", tex:null, ttype:CONST}, +{input:"glb", tag:"mo", output:"glb", tex:null, ttype:CONST}, +{input:"min", tag:"mo", output:"min", tex:null, ttype:UNDEROVER}, +{input:"max", tag:"mo", output:"max", tex:null, ttype:UNDEROVER}, + +//arrows +{input:"uarr", tag:"mo", output:"\u2191", tex:"uparrow", ttype:CONST}, +{input:"darr", tag:"mo", output:"\u2193", tex:"downarrow", ttype:CONST}, +{input:"rarr", tag:"mo", output:"\u2192", tex:"rightarrow", ttype:CONST}, +{input:"->", tag:"mo", output:"\u2192", tex:"to", ttype:CONST}, +{input:">->", tag:"mo", output:"\u21A3", tex:"rightarrowtail", ttype:CONST}, +{input:"->>", tag:"mo", output:"\u21A0", tex:"twoheadrightarrow", ttype:CONST}, +{input:">->>", tag:"mo", output:"\u2916", tex:"twoheadrightarrowtail", ttype:CONST}, +{input:"|->", tag:"mo", output:"\u21A6", tex:"mapsto", ttype:CONST}, +{input:"larr", tag:"mo", output:"\u2190", tex:"leftarrow", ttype:CONST}, +{input:"harr", tag:"mo", output:"\u2194", tex:"leftrightarrow", ttype:CONST}, +{input:"rArr", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:CONST}, +{input:"lArr", tag:"mo", output:"\u21D0", tex:"Leftarrow", ttype:CONST}, +{input:"hArr", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:CONST}, +//commands with argument +{input:"sqrt", tag:"msqrt", output:"sqrt", tex:null, ttype:UNARY}, +{input:"root", tag:"mroot", output:"root", tex:null, ttype:BINARY}, +{input:"frac", tag:"mfrac", output:"/", tex:null, ttype:BINARY}, +{input:"/", tag:"mfrac", output:"/", tex:null, ttype:INFIX}, +{input:"stackrel", tag:"mover", output:"stackrel", tex:null, ttype:BINARY}, +{input:"_", tag:"msub", output:"_", tex:null, ttype:INFIX}, +{input:"^", tag:"msup", output:"^", tex:null, ttype:INFIX}, +{input:"hat", tag:"mover", output:"\u005E", tex:null, ttype:UNARY, acc:true}, +{input:"bar", tag:"mover", output:"\u00AF", tex:"overline", ttype:UNARY, acc:true}, +{input:"vec", tag:"mover", output:"\u2192", tex:null, ttype:UNARY, acc:true}, +{input:"dot", tag:"mover", output:".", tex:null, ttype:UNARY, acc:true}, +{input:"ddot", tag:"mover", output:"..", tex:null, ttype:UNARY, acc:true}, +{input:"ul", tag:"munder", output:"\u0332", tex:"underline", ttype:UNARY, acc:true}, +{input:"text", tag:"mtext", output:"text", tex:null, ttype:TEXT}, +{input:"mbox", tag:"mtext", output:"mbox", tex:null, ttype:TEXT}, +AMquote, +{input:"bb", tag:"mstyle", atname:"fontweight", atval:"bold", output:"bb", tex:null, ttype:UNARY}, +{input:"mathbf", tag:"mstyle", atname:"fontweight", atval:"bold", output:"mathbf", tex:null, ttype:UNARY}, +{input:"sf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"sf", tex:null, ttype:UNARY}, +{input:"mathsf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"mathsf", tex:null, ttype:UNARY}, +{input:"bbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"bbb", tex:null, ttype:UNARY, codes:AMbbb}, +{input:"mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"mathbb", tex:null, ttype:UNARY, codes:AMbbb}, +{input:"cc", tag:"mstyle", atname:"mathvariant", atval:"script", output:"cc", tex:null, ttype:UNARY, codes:AMcal}, +{input:"mathcal", tag:"mstyle", atname:"mathvariant", atval:"script", output:"mathcal", tex:null, ttype:UNARY, codes:AMcal}, +{input:"tt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"tt", tex:null, ttype:UNARY}, +{input:"mathtt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"mathtt", tex:null, ttype:UNARY}, +{input:"fr", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"fr", tex:null, ttype:UNARY, codes:AMfrk}, +{input:"mathfrak", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"mathfrak", tex:null, ttype:UNARY, codes:AMfrk} +]; + +function compareNames(s1,s2) { + if (s1.input > s2.input) return 1 + else return -1; +} + +var AMnames = []; //list of input symbols + +function initSymbols() { + var texsymbols = [], i; + for (i=0; i=n where str appears or would be inserted +// assumes arr is sorted + if (n==0) { + var h,m; + n = -1; + h = arr.length; + while (n+1> 1; + if (arr[m]=str +} + +function AMgetSymbol(str) { +//return maximal initial substring of str that appears in names +//return null if there is none + var k = 0; //new pos + var j = 0; //old pos + var mk; //match pos + var st; + var tagst; + var match = ""; + var more = true; + for (var i=1; i<=str.length && more; i++) { + st = str.slice(0,i); //initial substring of length i + j = k; + k = position(AMnames, st, j); + if (k=AMnames[k]; + } + AMpreviousSymbol=AMcurrentSymbol; + if (match!=""){ + AMcurrentSymbol=AMsymbols[mk].ttype; + return AMsymbols[mk]; + } +// if str[0] is a digit or - return maxsubstring of digits.digits + AMcurrentSymbol=CONST; + k = 1; + st = str.slice(0,1); + var integ = true; + while ("0"<=st && st<="9" && k<=str.length) { + st = str.slice(k,k+1); + k++; + } + if (st == decimalsign) { + st = str.slice(k,k+1); + if ("0"<=st && st<="9") { + integ = false; + k++; + while ("0"<=st && st<="9" && k<=str.length) { + st = str.slice(k,k+1); + k++; + } + } + } + if ((integ && k>1) || k>2) { + st = str.slice(0,k-1); + tagst = "mn"; + } else { + k = 2; + st = str.slice(0,1); //take 1 character + tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi"); + } + if (st=="-" && AMpreviousSymbol==INFIX) { + AMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse + return {input:st, tag:tagst, output:st, ttype:UNARY, func:true}; + } + return {input:st, tag:tagst, output:st, ttype:CONST}; +} + +function AMremoveBrackets(node) { + var st; + if (node.nodeName=="mrow") { + st = node.firstChild.firstChild.nodeValue; + if (st=="(" || st=="[" || st=="{") node.removeChild(node.firstChild); + } + if (node.nodeName=="mrow") { + st = node.lastChild.firstChild.nodeValue; + if (st==")" || st=="]" || st=="}") node.removeChild(node.lastChild); + } +} + +/*Parsing ASCII math expressions with the following grammar +v ::= [A-Za-z] | greek letters | numbers | other constant symbols +u ::= sqrt | text | bb | other unary symbols for font commands +b ::= frac | root | stackrel binary symbols +l ::= ( | [ | { | (: | {: left brackets +r ::= ) | ] | } | :) | :} right brackets +S ::= v | lEr | uS | bSS Simple expression +I ::= S_S | S^S | S_S^S | S Intermediate expression +E ::= IE | I/I Expression +Each terminal symbol is translated into a corresponding mathml node.*/ + +var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol; + +function AMparseSexpr(str) { //parses str and returns [node,tailstr] + var symbol, node, result, i, st,// rightvert = false, + newFrag = document.createDocumentFragment(); + str = AMremoveCharsAndBlanks(str,0); + symbol = AMgetSymbol(str); //either a token or a bracket or empty + if (symbol == null || symbol.ttype == RIGHTBRACKET && AMnestingDepth > 0) { + return [null,str]; + } + if (symbol.ttype == DEFINITION) { + str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length); + symbol = AMgetSymbol(str); + } + switch (symbol.ttype) { case UNDEROVER: + case CONST: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + return [createMmlNode(symbol.tag, //its a constant + document.createTextNode(symbol.output)),str]; + case LEFTBRACKET: //read (expr+) + AMnestingDepth++; + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseExpr(str,true); + AMnestingDepth--; + if (typeof symbol.invisible == "boolean" && symbol.invisible) + node = createMmlNode("mrow",result[0]); + else { + node = createMmlNode("mo",document.createTextNode(symbol.output)); + node = createMmlNode("mrow",node); + node.appendChild(result[0]); + } + return [node,result[1]]; + case TEXT: + if (symbol!=AMquote) str = AMremoveCharsAndBlanks(str,symbol.input.length); + if (str.charAt(0)=="{") i=str.indexOf("}"); + else if (str.charAt(0)=="(") i=str.indexOf(")"); + else if (str.charAt(0)=="[") i=str.indexOf("]"); + else if (symbol==AMquote) i=str.slice(1).indexOf("\"")+1; + else i = 0; + if (i==-1) i = str.length; + st = str.slice(1,i); + if (st.charAt(0) == " ") { + node = createMmlNode("mspace"); + node.setAttribute("width","1ex"); + newFrag.appendChild(node); + } + newFrag.appendChild( + createMmlNode(symbol.tag,document.createTextNode(st))); + if (st.charAt(st.length-1) == " ") { + node = createMmlNode("mspace"); + node.setAttribute("width","1ex"); + newFrag.appendChild(node); + } + str = AMremoveCharsAndBlanks(str,i+1); + return [createMmlNode("mrow",newFrag),str]; + case UNARY: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseSexpr(str); + if (result[0]==null) return [createMmlNode(symbol.tag, + document.createTextNode(symbol.output)),str]; + if (typeof symbol.func == "boolean" && symbol.func) { // functions hack + st = str.charAt(0); + if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") { + return [createMmlNode(symbol.tag, + document.createTextNode(symbol.output)),str]; + } else { + node = createMmlNode("mrow", + createMmlNode(symbol.tag,document.createTextNode(symbol.output))); + node.appendChild(result[0]); + return [node,result[1]]; + } + } + AMremoveBrackets(result[0]); + if (symbol.input == "sqrt") { // sqrt + return [createMmlNode(symbol.tag,result[0]),result[1]]; + } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent + node = createMmlNode(symbol.tag,result[0]); + node.appendChild(createMmlNode("mo",document.createTextNode(symbol.output))); + return [node,result[1]]; + } else { // font change command +// MOD: The following code generates invalid MathML, so is commented out for the time being. +// if (!isIE && typeof symbol.codes != "undefined") { +// for (i=0; i64 && st.charCodeAt(j)<91) newst = newst + +// String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]); +// else newst = newst + st.charAt(j); +// if (result[0].nodeName=="mi") { +// result[0]=createMmlNode("mo"). +// appendChild(document.createTextNode(newst)); +// } +// else result[0].replaceChild(createMmlNode("mo"). +// appendChild(document.createTextNode(newst)), +// result[0].childNodes.item(i)); +// } +// } + node = createMmlNode(symbol.tag,result[0]); + node.setAttribute(symbol.atname,symbol.atval); + return [node,result[1]]; + } + case BINARY: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseSexpr(str); + if (result[0]==null) return [createMmlNode("mo", + document.createTextNode(symbol.input)),str]; + AMremoveBrackets(result[0]); + var result2 = AMparseSexpr(result[1]); + if (result2[0]==null) return [createMmlNode("mo", + document.createTextNode(symbol.input)),str]; + AMremoveBrackets(result2[0]); + if (symbol.input=="root" || symbol.input=="stackrel") + newFrag.appendChild(result2[0]); + newFrag.appendChild(result[0]); + if (symbol.input=="frac") newFrag.appendChild(result2[0]); + return [createMmlNode(symbol.tag,newFrag),result2[1]]; + case INFIX: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + return [createMmlNode("mo",document.createTextNode(symbol.output)),str]; + case SPACE: + str = AMremoveCharsAndBlanks(str,symbol.input.length); + node = createMmlNode("mspace"); + node.setAttribute("width","1ex"); + newFrag.appendChild(node); + newFrag.appendChild( + createMmlNode(symbol.tag,document.createTextNode(symbol.output))); + node = createMmlNode("mspace"); + node.setAttribute("width","1ex"); + newFrag.appendChild(node); + return [createMmlNode("mrow",newFrag),str]; + case LEFTRIGHT: +// if (rightvert) return [null,str]; else rightvert = true; + AMnestingDepth++; + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseExpr(str,false); + AMnestingDepth--; + var st = ""; + if (result[0].lastChild!=null) + st = result[0].lastChild.firstChild.nodeValue; + if (st == "|") { // its an absolute value subterm + node = createMmlNode("mo",document.createTextNode(symbol.output)); + node = createMmlNode("mrow",node); + node.appendChild(result[0]); + return [node,result[1]]; + } else { // the "|" is a \mid so use unicode 2223 (divides) for spacing + node = createMmlNode("mo",document.createTextNode("\u2223")); + node = createMmlNode("mrow",node); + return [node,str]; + } + default: +//alert("default"); + str = AMremoveCharsAndBlanks(str,symbol.input.length); + return [createMmlNode(symbol.tag, //its a constant + document.createTextNode(symbol.output)),str]; + } +} + +function AMparseIexpr(str) { + var symbol, sym1, sym2, node, result, underover; + str = AMremoveCharsAndBlanks(str,0); + sym1 = AMgetSymbol(str); + result = AMparseSexpr(str); + node = result[0]; + str = result[1]; + symbol = AMgetSymbol(str); + if (symbol.ttype == INFIX && symbol.input != "/") { + str = AMremoveCharsAndBlanks(str,symbol.input.length); +// if (symbol.input == "/") result = AMparseIexpr(str); else ... + result = AMparseSexpr(str); + if (result[0] == null) // show box in place of missing argument + result[0] = createMmlNode("mo",document.createTextNode("\u25A1")); + else AMremoveBrackets(result[0]); + str = result[1]; +// if (symbol.input == "/") AMremoveBrackets(node); + if (symbol.input == "_") { + sym2 = AMgetSymbol(str); + underover = (sym1.ttype == UNDEROVER); + if (sym2.input == "^") { + str = AMremoveCharsAndBlanks(str,sym2.input.length); + var res2 = AMparseSexpr(str); + AMremoveBrackets(res2[0]); + str = res2[1]; + node = createMmlNode((underover?"munderover":"msubsup"),node); + node.appendChild(result[0]); + node.appendChild(res2[0]); + node = createMmlNode("mrow",node); // so sum does not stretch + } else { + node = createMmlNode((underover?"munder":"msub"),node); + node.appendChild(result[0]); + } + } else { + node = createMmlNode(symbol.tag,node); + node.appendChild(result[0]); + } + } + return [node,str]; +} + +function AMparseExpr(str,rightbracket) { + var symbol, node, result, i, nodeList = [], + newFrag = document.createDocumentFragment(); + do { + str = AMremoveCharsAndBlanks(str,0); + result = AMparseIexpr(str); + node = result[0]; + str = result[1]; + symbol = AMgetSymbol(str); + if (symbol.ttype == INFIX && symbol.input == "/") { + str = AMremoveCharsAndBlanks(str,symbol.input.length); + result = AMparseIexpr(str); + if (result[0] == null) // show box in place of missing argument + result[0] = createMmlNode("mo",document.createTextNode("\u25A1")); + else AMremoveBrackets(result[0]); + str = result[1]; + AMremoveBrackets(node); + node = createMmlNode(symbol.tag,node); + node.appendChild(result[0]); + newFrag.appendChild(node); + symbol = AMgetSymbol(str); + } + else if (node!=undefined) newFrag.appendChild(node); + } while ((symbol.ttype != RIGHTBRACKET && + (symbol.ttype != LEFTRIGHT || rightbracket) + || AMnestingDepth == 0) && symbol!=null && symbol.output!=""); + if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) { +// if (AMnestingDepth > 0) AMnestingDepth--; + var len = newFrag.childNodes.length; + if (len>0 && newFrag.childNodes.item(len-1).nodeName == "mrow" && len>1 && + newFrag.childNodes.item(len-2).nodeName == "mo" && + newFrag.childNodes.item(len-2).firstChild.nodeValue == ",") { //matrix + var right = newFrag.childNodes.item(len-1).lastChild.firstChild.nodeValue; + if (right==")" || right=="]") { + var left = newFrag.childNodes.item(len-1).firstChild.firstChild.nodeValue; + if (left=="(" && right==")" && symbol.output != "}" || + left=="[" && right=="]") { + var pos = []; // positions of commas + var matrix = true; + var m = newFrag.childNodes.length; + for (i=0; matrix && i1) matrix = pos[i].length == pos[i-2].length; + } + if (matrix) { + var row, frag, n, k, table = document.createDocumentFragment(); + for (i=0; i(-,-,...,-,-) + n = node.childNodes.length; + k = 0; + node.removeChild(node.firstChild); //remove ( + for (j=1; j2) { + newFrag.removeChild(newFrag.firstChild); //remove ) + newFrag.removeChild(newFrag.firstChild); //remove , + } + table.appendChild(createMmlNode("mtr",row)); + } + node = createMmlNode("mtable",table); + if (typeof symbol.invisible == "boolean" && symbol.invisible) node.setAttribute("columnalign","left"); + newFrag.replaceChild(node,newFrag.firstChild); + } + } + } + } + str = AMremoveCharsAndBlanks(str,symbol.input.length); + if (typeof symbol.invisible != "boolean" || !symbol.invisible) { + node = createMmlNode("mo",document.createTextNode(symbol.output)); + newFrag.appendChild(node); + } + } + return [newFrag,str]; +} + +//MOD: The rest of the code is not required! + +//------------------------------------------------------------- + +/* ASCIIMathML.js has ended! */ + +initSymbols(); + +/* Parses the given ASCIIMathInput, returning a DOM Element */ +this.parseAsciiMathInput = function(asciiMathInput) { + var options = arguments[1] || {}; + + /* Call up ASCIIMath to do the actual parsing, generating a document fragment */ + var content = AMparseExpr(asciiMathInput.replace(/^\s+/g,""), false)[0]; + + /* If adding source annotation, then we need to wrap things up appropriately */ + if (options.addSourceAnnotation) { + var semantics = createMmlNode("semantics", content.length==1 ? content : createMmlNode("mrow", content)); + + var annotation = createMmlNode("annotation", document.createTextNode(asciiMathInput)); + annotation.setAttribute("encoding", "ASCIIMathInput"); + semantics.appendChild(annotation); + + content = semantics; + } + + /* Create the containing element */ + var math = createMmlNode("math", content); + if (options.displayMode) { + math.setAttribute("display", "block"); + } + return math; +}; + +// (end of unindented constructor defined at top of file) +}; +function plantuml(dom, asciiMathInput) { + var asciiMathParser = new AsciiMathParser(dom); + var mathElement = asciiMathParser.parseAsciiMathInput(asciiMathInput); + return mathElement; +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/math/ConverterSvg.java b/src/plantuml-asl/src/net/sourceforge/plantuml/math/ConverterSvg.java index e72293db5..269759850 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/math/ConverterSvg.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/math/ConverterSvg.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/math/LatexBuilder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/math/LatexBuilder.java index 30fb6a099..aa6b9d640 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/math/LatexBuilder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/math/LatexBuilder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,6 +40,7 @@ import javax.swing.Icon; import net.sourceforge.plantuml.SvgString; +import net.sourceforge.plantuml.ugraphic.MutableImage; public class LatexBuilder implements ScientificEquation { @@ -55,15 +56,15 @@ public Dimension2D getDimension() { return dimension; } - private Icon buildIcon(Color foregroundColor) throws ClassNotFoundException, NoSuchMethodException, - SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, - InvocationTargetException { + private Icon buildIcon(Color foregroundColor) + throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException, + IllegalAccessException, IllegalArgumentException, InvocationTargetException { return new TeXIconBuilder(tex, foregroundColor).getIcon(); } - public SvgString getSvg(double scale, Color foregroundColor, Color backgroundColor) throws ClassNotFoundException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, - SecurityException, InstantiationException, IOException { + public SvgString getSvg(double scale, Color foregroundColor, Color backgroundColor) + throws ClassNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, + NoSuchMethodException, SecurityException, InstantiationException, IOException { final Icon icon = buildIcon(foregroundColor); final ConverterSvg converterSvg = new ConverterSvg(icon); final String svg = converterSvg.getSvg(scale, true, backgroundColor); @@ -71,20 +72,55 @@ public SvgString getSvg(double scale, Color foregroundColor, Color backgroundCol return new SvgString(svg, scale); } - public BufferedImage getImage(double scale, Color foregroundColor, Color backgroundColor) + public MutableImage getImage(Color foregroundColor, Color backgroundColor) throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { final Icon icon = buildIcon(foregroundColor); - final BufferedImage image = new BufferedImage((int) (icon.getIconWidth() * scale), - (int) (icon.getIconHeight() * scale), BufferedImage.TYPE_INT_ARGB); - final Graphics2D g2 = image.createGraphics(); - g2.scale(scale, scale); - if (backgroundColor != null) { - g2.setColor(backgroundColor); - g2.fillRect(0, 0, icon.getIconWidth(), icon.getIconHeight()); + return new LatexImage(icon, 1, foregroundColor, backgroundColor); + } + + class LatexImage implements MutableImage { + + private final double scale; + private final Icon icon; + private final Color foregroundColor; + private final Color backgroundColor; + private BufferedImage cache = null; + + public LatexImage(Icon icon, double scale, Color foregroundColor, Color backgroundColor) { + this.scale = scale; + this.foregroundColor = foregroundColor; + this.backgroundColor = backgroundColor; + this.icon = icon; + } + + public BufferedImage getImage() { + if (cache == null) { + cache = new BufferedImage((int) (icon.getIconWidth() * scale), (int) (icon.getIconHeight() * scale), + BufferedImage.TYPE_INT_ARGB); + final Graphics2D g2 = cache.createGraphics(); + g2.scale(scale, scale); + if (backgroundColor != null) { + g2.setColor(backgroundColor); + g2.fillRect(0, 0, icon.getIconWidth(), icon.getIconHeight()); + } + icon.paintIcon(null, g2, 0, 0); + } + return cache; } - icon.paintIcon(null, g2, 0, 0); - return image; + + public MutableImage withScale(double scale) { + return new LatexImage(icon, this.scale * scale, foregroundColor, backgroundColor); + } + + public MutableImage muteColor(Color newColor) { + return this; + } + + public MutableImage muteTransparentColor(Color newColor) { + return this; + } + } public String getSource() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/math/PSystemLatex.java b/src/plantuml-asl/src/net/sourceforge/plantuml/math/PSystemLatex.java index 86a88617a..64763a827 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/math/PSystemLatex.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/math/PSystemLatex.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,12 +36,19 @@ import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.FileFormatOption; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class PSystemLatex extends AbstractPSystem { private String latex = ""; + private float scale = 1; + private Color color = Color.BLACK; + private Color backColor = Color.WHITE; public PSystemLatex() { } @@ -54,11 +61,52 @@ public DiagramDescription getDescription() { final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { final ScientificEquationSafe asciiMath = ScientificEquationSafe.fromLatex(latex); - return asciiMath.export(os, fileFormat, 1, Color.BLACK, Color.WHITE); + return asciiMath.export(os, fileFormat, scale, color, backColor); } public void doCommandLine(String line) { - this.latex = line; + final String lineLower = StringUtils.trin(StringUtils.goLowerCase(line)); + final String colorParam = "color "; + final String backParam = "backgroundcolor "; + if (lineLower.startsWith(colorParam)) { + final Color col3 = getColor(line.substring(colorParam.length())); + if (col3 != null) { + color = col3; + } + } else if (lineLower.startsWith(backParam)) { + final Color col3 = getColor(line.substring(backParam.length())); + if (col3 != null) { + backColor = col3; + } + } else if (lineLower.startsWith("scale ")) { + final String value = line.substring("scale ".length()); + try { + final float scale1 = Float.parseFloat(value); + if (scale1 > 0) { + scale = scale1; + } + } catch (Exception e) { + e.printStackTrace(); + } + } else if (lineLower.startsWith("dpi ")) { + final String value = line.substring("dpi ".length()); + try { + final float dpi1 = Float.parseFloat(value); + if (dpi1 > 0) { + scale = dpi1 / 96; + } + } catch (Exception e) { + e.printStackTrace(); + } + } else { + this.latex = line; + } + } + + private Color getColor(final String col) { + final HColor col2 = HColorSet.instance().getColorIfValid(col); + final Color col3 = new ColorMapperIdentity().toColor(col2); + return col3; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/math/PSystemLatexFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/math/PSystemLatexFactory.java index c0725f192..7dfad28ab 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/math/PSystemLatexFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/math/PSystemLatexFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/math/PSystemMath.java b/src/plantuml-asl/src/net/sourceforge/plantuml/math/PSystemMath.java index dd59c1b1d..f08505078 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/math/PSystemMath.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/math/PSystemMath.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,9 +39,9 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class PSystemMath extends AbstractPSystem { @@ -105,8 +105,8 @@ public void doCommandLine(String line) { } private Color getColor(final String col) { - final HtmlColor col2 = new HtmlColorSetSimple().getColorIfValid(col); - final Color col3 = new ColorMapperIdentity().getMappedColor(col2); + final HColor col2 = HColorSet.instance().getColorIfValid(col); + final Color col3 = new ColorMapperIdentity().toColor(col2); return col3; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/math/PSystemMathFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/math/PSystemMathFactory.java index 470226ee4..82c5e9e3b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/math/PSystemMathFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/math/PSystemMathFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/math/ScientificEquation.java b/src/plantuml-asl/src/net/sourceforge/plantuml/math/ScientificEquation.java index 1ed981857..d7c3964f5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/math/ScientificEquation.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/math/ScientificEquation.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,21 +32,21 @@ import java.awt.Color; import java.awt.geom.Dimension2D; -import java.awt.image.BufferedImage; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import net.sourceforge.plantuml.SvgString; +import net.sourceforge.plantuml.ugraphic.MutableImage; public interface ScientificEquation { public Dimension2D getDimension(); - public SvgString getSvg(double scale, Color foregroundColor, Color backgroundColor) throws ClassNotFoundException, - IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, - SecurityException, InstantiationException, IOException; + public SvgString getSvg(double scale, Color foregroundColor, Color backgroundColor) + throws ClassNotFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, + NoSuchMethodException, SecurityException, InstantiationException, IOException; - public BufferedImage getImage(double scale, Color foregroundColor, Color backgroundColor) + public MutableImage getImage(Color foregroundColor, Color backgroundColor) throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/math/ScientificEquationSafe.java b/src/plantuml-asl/src/net/sourceforge/plantuml/math/ScientificEquationSafe.java index 986e88080..00fddf3d5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/math/ScientificEquationSafe.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/math/ScientificEquationSafe.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,8 +38,6 @@ import java.io.OutputStream; import java.util.Arrays; -import javax.imageio.ImageIO; - import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.Log; @@ -49,8 +47,12 @@ import net.sourceforge.plantuml.eps.EpsGraphics; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.security.ImageIO; +import net.sourceforge.plantuml.ugraphic.AffineTransformType; +import net.sourceforge.plantuml.ugraphic.MutableImage; +import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class ScientificEquationSafe { @@ -85,7 +87,6 @@ public static ScientificEquationSafe fromLatex(String formula) { private ImageData dimSvg; public SvgString getSvg(double scale, Color foregroundColor, Color backgroundColor) { - try { final SvgString svg = equation.getSvg(scale, foregroundColor, backgroundColor); dimSvg = new ImageDataSimple(equation.getDimension()); @@ -103,16 +104,17 @@ public SvgString getSvg(double scale, Color foregroundColor, Color backgroundCol } } - public BufferedImage getImage(double scale, Color foregroundColor, Color backgroundColor) { + public MutableImage getImage(Color foregroundColor, Color backgroundColor) { try { - return equation.getImage(scale, foregroundColor, backgroundColor); + return equation.getImage(foregroundColor, backgroundColor); } catch (Exception e) { printTrace(e); final ImageBuilder imageBuilder = getRollback(); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { imageBuilder.writeImageTOBEMOVED(new FileFormatOption(FileFormat.PNG), 42, baos); - return ImageIO.read(new ByteArrayInputStream(baos.toByteArray())); + return new PixelImage(ImageIO.read(new ByteArrayInputStream(baos.toByteArray())), + AffineTransformType.TYPE_BILINEAR); } catch (IOException e1) { return null; } @@ -121,7 +123,7 @@ public BufferedImage getImage(double scale, Color foregroundColor, Color backgro private void printTrace(Exception e) { System.err.println("formula=" + formula); - if (formula != null) { + if (equation != null) { System.err.println("Latex=" + equation.getSource()); } e.printStackTrace(); @@ -129,8 +131,8 @@ private void printTrace(Exception e) { private ImageBuilder getRollback() { final TextBlock block = GraphicStrings.createBlackOnWhiteMonospaced(Arrays.asList(formula)); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, null, null, null, 0, 0, - null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), false, null, null, null, 1.0, + null); imageBuilder.setUDrawable(block); return imageBuilder; } @@ -138,7 +140,7 @@ private ImageBuilder getRollback() { public ImageData export(OutputStream os, FileFormatOption fileFormat, float scale, Color foregroundColor, Color backgroundColor) throws IOException { if (fileFormat.getFileFormat() == FileFormat.PNG) { - final BufferedImage image = getImage(scale, foregroundColor, backgroundColor); + final BufferedImage image = getImage(foregroundColor, backgroundColor).withScale(scale).getImage(); ImageIO.write(image, "png", os); return new ImageDataSimple(image.getWidth(), image.getHeight()); } @@ -147,7 +149,7 @@ public ImageData export(OutputStream os, FileFormatOption fileFormat, float scal return dimSvg; } if (fileFormat.getFileFormat() == FileFormat.EPS) { - final BufferedImage image = getImage(scale, foregroundColor, backgroundColor); + final BufferedImage image = getImage(foregroundColor, backgroundColor).withScale(scale).getImage(); final EpsGraphics out = new EpsGraphics(); out.drawImage(image, 0, 0); out.close(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/math/TeXIconBuilder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/math/TeXIconBuilder.java index 1804f64c6..b7acea519 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/math/TeXIconBuilder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/math/TeXIconBuilder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mda/MDADiagramImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mda/MDADiagramImpl.java index d15bb7dcc..13379409b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mda/MDADiagramImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mda/MDADiagramImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -68,7 +68,7 @@ public static MDADiagram create(String uml) { private MDADiagramImpl(ClassDiagram classDiagram) { final EntityFactory entityFactory = classDiagram.getEntityFactory(); packages.add(new MDAPackageImpl(entityFactory.getRootGroup())); - for (IGroup group : entityFactory.getGroupsvalues()) { + for (IGroup group : entityFactory.groups()) { packages.add(new MDAPackageImpl(group)); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mda/MDAEntityImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mda/MDAEntityImpl.java index 6e9da513c..f2f571e5c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mda/MDAEntityImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mda/MDAEntityImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -42,7 +42,7 @@ public MDAEntityImpl(ILeaf leaf) { } public String getName() { - return leaf.getCode().getFullName(); + return leaf.getCodeGetName(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mda/MDAPackageImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mda/MDAPackageImpl.java index 14a2546a5..64dc79040 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mda/MDAPackageImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mda/MDAPackageImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -60,7 +60,7 @@ public String getName() { if (group instanceof GroupRoot) { return ""; } - return group.getCode().getFullName(); + return group.getCodeGetName(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapDirection.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapDirection.java index bcc1c683e..28eb57774 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapDirection.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapDirection.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapLeft.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapLeft.java index e15344c0f..ec1af0229 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapLeft.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapLeft.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,6 +38,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; public class CommandMindMapLeft extends SingleLineCommand2 { @@ -57,7 +58,7 @@ static IRegex getRegexConcat() { protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation location, RegexResult arg) { final String type = arg.get("TYPE", 0); final String label = arg.get("LABEL", 0); - return diagram.addIdea(null, type.length() - 1, label, IdeaShape.fromDesc(arg.get("SHAPE", 0)), Direction.LEFT); + return diagram.addIdea(null, type.length() - 1, Display.getWithNewlines(label), IdeaShape.fromDesc(arg.get("SHAPE", 0)), Direction.LEFT); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapLeftNumber.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapLeftNumber.java index 29b1f0413..4c6a423fc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapLeftNumber.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapLeftNumber.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,6 +38,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; public class CommandMindMapLeftNumber extends SingleLineCommand2 { @@ -56,7 +57,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation location, RegexResult arg) { final String label = arg.get("LABEL", 0); - return diagram.addIdea(null, Integer.parseInt(arg.get("TYPE", 0)), label, + return diagram.addIdea(null, Integer.parseInt(arg.get("TYPE", 0)), Display.getWithNewlines(label), IdeaShape.fromDesc(arg.get("SHAPE", 0)), Direction.LEFT); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java index e6a720b8b..1c0a22c5f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,7 +38,8 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandMindMapOrgmode extends SingleLineCommand2 { @@ -60,11 +61,12 @@ protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation final String type = arg.get("TYPE", 0); final String label = arg.get("LABEL", 0); final String stringColor = arg.get("BACKCOLOR", 0); - HtmlColor backColor = null; + HColor backColor = null; if (stringColor != null) { backColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(stringColor); } - return diagram.addIdea(backColor, type.length() - 1, label, IdeaShape.fromDesc(arg.get("SHAPE", 0))); + return diagram.addIdea(backColor, type.length() - 1, Display.getWithNewlines(label), + IdeaShape.fromDesc(arg.get("SHAPE", 0))); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmodeMultiline.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmodeMultiline.java new file mode 100644 index 000000000..ffc1e4768 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmodeMultiline.java @@ -0,0 +1,97 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.mindmap; + +import java.util.List; + +import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.BlocLines; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.CommandMultilines2; +import net.sourceforge.plantuml.command.MultilinesStrategy; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexOptional; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.ugraphic.color.HColor; + +public class CommandMindMapOrgmodeMultiline extends CommandMultilines2 { + + public CommandMindMapOrgmodeMultiline() { + super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE); + } + + static IRegex getRegexConcat() { + return RegexConcat.build(CommandMindMapOrgmodeMultiline.class.getName(), RegexLeaf.start(), // + new RegexLeaf("TYPE", "([*]+)"), // + new RegexOptional(new RegexLeaf("BACKCOLOR", "\\[(#\\w+)\\]")), // + new RegexLeaf("SHAPE", "(_)?"), // + new RegexLeaf(":"), // + new RegexLeaf("DATA", "(.*)"), // + RegexLeaf.end()); + } + + @Override + public String getPatternEnd() { + return "^(.*);(?:\\s*\\<\\<(.+)\\>\\>)?$"; + } + + @Override + protected CommandExecutionResult executeNow(MindMapDiagram diagram, BlocLines lines) { + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); + + final List lineLast = StringUtils.getSplit(MyPattern.cmpile(getPatternEnd()), + lines.getLast().getString()); + lines = lines.removeStartingAndEnding(line0.get("DATA", 0), 1); + + final String stereotype = lineLast.get(1); + if (stereotype != null) { + lines = lines.overrideLastLine(lineLast.get(0)); + } + + final String type = line0.get("TYPE", 0); + final String stringColor = line0.get("BACKCOLOR", 0); + HColor backColor = null; + if (stringColor != null) { + backColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(stringColor); + } + + if (stereotype == null) { + return diagram.addIdea(backColor, type.length() - 1, lines.toDisplay(), + IdeaShape.fromDesc(line0.get("SHAPE", 0))); + } + return diagram.addIdea(stereotype, backColor, type.length() - 1, lines.toDisplay(), + IdeaShape.fromDesc(line0.get("SHAPE", 0))); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapPlus.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapPlus.java index e4d4dfbca..dc330c7e4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapPlus.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapPlus.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,6 +38,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; public class CommandMindMapPlus extends SingleLineCommand2 { @@ -58,7 +59,8 @@ protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation final String type = arg.get("TYPE", 0); final String label = arg.get("LABEL", 0); final Direction direction = type.contains("-") ? Direction.LEFT : Direction.RIGHT; - return diagram.addIdea(null, type.length() - 1, label, IdeaShape.fromDesc(arg.get("SHAPE", 0)), direction); + return diagram.addIdea(null, type.length() - 1, Display.getWithNewlines(label), + IdeaShape.fromDesc(arg.get("SHAPE", 0)), direction); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapRight.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapRight.java index 69d7ccb0b..2ac4a38f2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapRight.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapRight.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,6 +38,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; public class CommandMindMapRight extends SingleLineCommand2 { @@ -57,8 +58,8 @@ static IRegex getRegexConcat() { protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation location, RegexResult arg) { final String type = arg.get("TYPE", 0); final String label = arg.get("LABEL", 0); - return diagram - .addIdea(null, type.length() - 1, label, IdeaShape.fromDesc(arg.get("SHAPE", 0)), Direction.RIGHT); + return diagram.addIdea(null, type.length() - 1, Display.getWithNewlines(label), + IdeaShape.fromDesc(arg.get("SHAPE", 0)), Direction.RIGHT); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapRightNumber.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapRightNumber.java index ba00ae7c8..e31dd8749 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapRightNumber.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapRightNumber.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,6 +38,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; public class CommandMindMapRightNumber extends SingleLineCommand2 { @@ -56,7 +57,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation location, RegexResult arg) { final String label = arg.get("LABEL", 0); - return diagram.addIdea(null, Integer.parseInt(arg.get("TYPE", 0)), label, + return diagram.addIdea(null, Integer.parseInt(arg.get("TYPE", 0)), Display.getWithNewlines(label), IdeaShape.fromDesc(arg.get("SHAPE", 0)), Direction.RIGHT); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapRoot.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapRoot.java index a867337d1..bf27a7ae0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapRoot.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapRoot.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,6 +37,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; public class CommandMindMapRoot extends SingleLineCommand2 { @@ -54,7 +55,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation location, RegexResult arg) { final String label = arg.get("LABEL", 0); - return diagram.addIdea(null, 0, label, IdeaShape.BOX, null); + return diagram.addIdea(null, 0, Display.getWithNewlines(label), IdeaShape.BOX, null); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapTabulation.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapTabulation.java index 441616a42..dcf74d01c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapTabulation.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/CommandMindMapTabulation.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,7 +36,10 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandMindMapTabulation extends SingleLineCommand2 { @@ -47,6 +50,7 @@ public CommandMindMapTabulation() { static IRegex getRegexConcat() { return RegexConcat.build(CommandMindMapTabulation.class.getName(), RegexLeaf.start(), // new RegexLeaf("TYPE", "([ \t]*[*])"), // + new RegexOptional(new RegexLeaf("BACKCOLOR", "\\[(#\\w+)\\]")), // new RegexLeaf("SHAPE", "(_)?"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("LABEL", "([^%s].*)"), RegexLeaf.end()); @@ -56,7 +60,13 @@ static IRegex getRegexConcat() { protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation location, RegexResult arg) { final String type = arg.get("TYPE", 0); final String label = arg.get("LABEL", 0); - return diagram.addIdea(null, type.length() - 1, label, IdeaShape.fromDesc(arg.get("SHAPE", 0))); + final String stringColor = arg.get("BACKCOLOR", 0); + HColor backColor = null; + if (stringColor != null) { + backColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(stringColor); + } + return diagram.addIdea(backColor, type.length() - 1, Display.getWithNewlines(label), + IdeaShape.fromDesc(arg.get("SHAPE", 0))); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/Finger.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/Finger.java index a6c2e9d66..da1f4d6a1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/Finger.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/Finger.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/FingerImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/FingerImpl.java index 98e62f9c6..c4abbeeb6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/FingerImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/FingerImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,38 +39,76 @@ import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; +import net.sourceforge.plantuml.SkinParam; +import net.sourceforge.plantuml.SkinParamColors; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; 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.ugraphic.UChangeColor; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleBuilder; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPath; +import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class FingerImpl implements Finger, UDrawable { private final Display label; + private final HColor backColor; + private final String stereotype; private final ISkinParam skinParam; + private final StyleBuilder styleBuilder; private final IdeaShape shape; private final Direction direction; + private final int level; private boolean drawPhalanx = true; + private double marginLeft = 10; + private double marginRight = 10; + private double marginTop = 10; + private double marginBottom = 10; private final List nail = new ArrayList(); + private Tetris tetris = null; + + private StyleSignature getDefaultStyleDefinitionNode() { + final String depth = SName.depth(level); + if (level == 0) { + return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.rootNode) + .add(stereotype).add(depth); + } + if (nail.size() == 0) { + return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.leafNode) + .add(stereotype).add(depth); + } + return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.node).add(stereotype) + .add(depth); + } + + public StyleSignature getDefaultStyleDefinitionArrow() { + final String depth = SName.depth(level); + return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.arrow).add(stereotype) + .add(depth); + } public static FingerImpl build(Idea idea, ISkinParam skinParam, Direction direction) { - final FingerImpl result = new FingerImpl(idea.getLabel(), skinParam, idea.getShape(), direction); + final FingerImpl result = new FingerImpl(idea.getStyleBuilder(), idea.getBackColor(), idea.getLabel(), + skinParam, idea.getShape(), direction, idea.getLevel(), idea.getStereotype()); for (Idea child : idea.getChildren()) { result.addInNail(build(child, skinParam, direction)); } + // System.err.println("End of build for " + idea); return result; } @@ -78,47 +116,21 @@ public void addInNail(FingerImpl child) { nail.add(child); } - private FingerImpl(Display label, ISkinParam skinParam, IdeaShape shape, Direction direction) { + private FingerImpl(StyleBuilder styleBuilder, HColor backColor, Display label, ISkinParam skinParam, + IdeaShape shape, Direction direction, int level, String stereotype) { + this.backColor = backColor; + this.stereotype = stereotype; + this.level = level; this.label = label; this.skinParam = skinParam; this.shape = shape; + this.styleBuilder = styleBuilder; this.direction = direction; - } - - public double getPhalanxThickness(StringBounder stringBounder) { - return getPhalanx().calculateDimension(stringBounder).getHeight(); - } - - public double getPhalanxElongation(StringBounder stringBounder) { - return getPhalanx().calculateDimension(stringBounder).getWidth(); - } - - public double getNailThickness(StringBounder stringBounder) { - double result = 0; - for (FingerImpl child : nail) { - result += child.getFullThickness(stringBounder); - } - return result; - } - - public double getNailElongation(StringBounder stringBounder) { - double result = 0; - for (FingerImpl child : nail) { - result = Math.max(result, child.getFullElongation(stringBounder)); - } - return result; - } - - public double getFullElongation(StringBounder stringBounder) { - return getPhalanxElongation(stringBounder) + marginX1 + getNailElongation(stringBounder); - } - - public double getFullThickness(StringBounder stringBounder) { - return Math.max(getPhalanxThickness(stringBounder), getNailThickness(stringBounder)); - } - - public void doNotDrawFirstPhalanx() { - this.drawPhalanx = false; + final Style styleNode = getDefaultStyleDefinitionNode().getMergedStyle(styleBuilder); + this.marginLeft = styleNode.getMargin().getLeft(); + this.marginRight = styleNode.getMargin().getRight(); + this.marginTop = styleNode.getMargin().getTop(); + this.marginBottom = styleNode.getMargin().getBottom(); } public void drawU(final UGraphic ug) { @@ -130,28 +142,38 @@ public void drawU(final UGraphic ug) { final double posX = direction == Direction.RIGHT ? 0 : -dimPhalanx.getWidth(); phalanx.drawU(ug.apply(new UTranslate(posX, posY))); } - final Point2D p1 = new Point2D.Double(direction == Direction.RIGHT ? dimPhalanx.getWidth() - : -dimPhalanx.getWidth(), 0); - - double y = -getFullThickness(stringBounder) / 2; - for (FingerImpl child : nail) { - final double childThickness = child.getFullThickness(stringBounder); - final double x = direction == Direction.RIGHT ? dimPhalanx.getWidth() + marginX1 : -dimPhalanx.getWidth() - - marginX1; - child.drawU(ug.apply(new UTranslate(x, y + childThickness / 2))); - final Point2D p2 = new Point2D.Double(x, y + childThickness / 2); - drawLine(ug.apply(new UChangeColor(getLinkColor())), p1, p2); - y += childThickness; + final Point2D p1 = new Point2D.Double( + direction == Direction.RIGHT ? dimPhalanx.getWidth() : -dimPhalanx.getWidth(), 0); + + for (int i = 0; i < nail.size(); i++) { + final FingerImpl child = nail.get(i); + final SymetricalTeePositioned stp = tetris(stringBounder).getElements().get(i); + final double x = direction == Direction.RIGHT ? dimPhalanx.getWidth() + getX12() + : -dimPhalanx.getWidth() - getX12(); + final Point2D p2 = new Point2D.Double(x, stp.getY()); + child.drawU(ug.apply(new UTranslate(p2))); + drawLine(ug.apply(getLinkColor()).apply(getUStroke()), p1, p2); } + } - private HtmlColor getLinkColor() { - // return skinParam.getColors(ColorParam.activityBorder, null).getColor(ColorType.ARROW); + private HColor getLinkColor() { + if (SkinParam.USE_STYLES()) { + final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(styleBuilder); + return styleArrow.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); + + } return ColorParam.activityBorder.getDefaultValue(); - // return HtmlColorUtils.BLACK; } - final private double marginX1 = 50; + private UStroke getUStroke() { + if (SkinParam.USE_STYLES()) { + final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(styleBuilder); + return styleArrow.getStroke(); + + } + return new UStroke(); + } private void drawLine(UGraphic ug, Point2D p1, Point2D p2) { // final ULine line = new ULine(p1, p2); @@ -166,17 +188,95 @@ private void drawLine(UGraphic ug, Point2D p1, Point2D p2) { ug.draw(path); } + private Tetris tetris(StringBounder stringBounder) { + if (tetris == null) { + tetris = new Tetris(label.toString()); + for (FingerImpl child : nail) { + tetris.add(child.asSymetricalTee(stringBounder)); + } + tetris.balance(); + } + return tetris; + } + + private SymetricalTee asSymetricalTee(StringBounder stringBounder) { + final double thickness1 = getPhalanxThickness(stringBounder); + final double elongation1 = getPhalanxElongation(stringBounder); + if (nail.size() == 0) { + return new SymetricalTee(thickness1, elongation1, 0, 0); + } + final double thickness2 = getNailThickness(stringBounder); + final double elongation2 = getNailElongation(stringBounder); + return new SymetricalTee(thickness1, elongation1 + getX1(), thickness2, getX2() + elongation2); + } + + private double getX1() { + return marginLeft; + } + + private double getX2() { + return marginRight + 30; + } + + public double getX12() { + return getX1() + getX2(); + } + + public double getPhalanxThickness(StringBounder stringBounder) { + return getPhalanx().calculateDimension(stringBounder).getHeight(); + } + + public double getPhalanxElongation(StringBounder stringBounder) { + return getPhalanx().calculateDimension(stringBounder).getWidth(); + } + private TextBlock getPhalanx() { if (drawPhalanx == false) { return TextBlockUtils.empty(0, 0); } - final UFont font = skinParam.getFont(null, false, FontParam.ACTIVITY); + final UFont font; + if (SkinParam.USE_STYLES()) { + final Style styleNode = getDefaultStyleDefinitionNode().getMergedStyle(styleBuilder); + font = styleNode.getUFont(); + } else { + font = skinParam.getFont(null, false, FontParam.ACTIVITY); + } if (shape == IdeaShape.BOX) { - final FtileBox box = new FtileBox(Colors.empty().mute(skinParam), label, font, null, BoxStyle.PLAIN); - return TextBlockUtils.withMargin(box, 0, 10); + // final ISkinParam foo = new + // SkinParamBackcolored(Colors.empty().mute(skinParam), backColor); + final ISkinParam foo = new SkinParamColors(skinParam, Colors.empty().add(ColorType.BACK, backColor)); + final FtileBox box = FtileBox.createMindMap(styleBuilder, foo, label, getDefaultStyleDefinitionNode()); + return TextBlockUtils.withMargin(box, 0, 0, marginTop, marginBottom); } - return TextBlockUtils.withMargin( - label.create(FontConfiguration.blackBlueTrue(font), HorizontalAlignment.LEFT, skinParam), 5, 5); + + final TextBlock text = label.create(FontConfiguration.blackBlueTrue(font), HorizontalAlignment.LEFT, skinParam); + if (direction == Direction.RIGHT) { + return TextBlockUtils.withMargin(text, 3, 0, 1, 1); + } + return TextBlockUtils.withMargin(text, 0, 3, 1, 1); + } + + public double getNailThickness(StringBounder stringBounder) { + return tetris(stringBounder).getHeight(); + } + + public double getNailElongation(StringBounder stringBounder) { + return tetris(stringBounder).getWidth(); + } + + public double getFullThickness(StringBounder stringBounder) { + final double thickness1 = getPhalanxThickness(stringBounder); + final double thickness2 = getNailThickness(stringBounder); + // System.err.println("thickness1=" + thickness1 + " thickness2=" + thickness2); + return Math.max(thickness1, thickness2); + } + + public double getFullElongation(StringBounder stringBounder) { + return getPhalanxElongation(stringBounder) + getNailElongation(stringBounder); + } + + public void doNotDrawFirstPhalanx() { + this.drawPhalanx = false; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/FingerImpl2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/FingerImpl2.java deleted file mode 100644 index 94d8103c6..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/FingerImpl2.java +++ /dev/null @@ -1,218 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.mindmap; - -import java.awt.geom.Dimension2D; -import java.awt.geom.Point2D; -import java.util.ArrayList; -import java.util.List; - -import net.sourceforge.plantuml.ColorParam; -import net.sourceforge.plantuml.Direction; -import net.sourceforge.plantuml.FontParam; -import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.SkinParamBackcolored; -import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; -import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox; -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; -import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.graphic.color.Colors; -import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UPath; -import net.sourceforge.plantuml.ugraphic.UTranslate; - -public class FingerImpl2 implements Finger, UDrawable { - - private final Display label; - private final HtmlColor backColor; - private final ISkinParam skinParam; - private final IdeaShape shape; - private final Direction direction; - private boolean drawPhalanx = true; - - private final List nail = new ArrayList(); - private Tetris tetris = null; - - public static FingerImpl2 build(Idea idea, ISkinParam skinParam, Direction direction) { - final FingerImpl2 result = new FingerImpl2(idea.getBackColor(), idea.getLabel(), skinParam, idea.getShape(), - direction); - for (Idea child : idea.getChildren()) { - result.addInNail(build(child, skinParam, direction)); - } - // System.err.println("End of build for " + idea); - return result; - } - - public void addInNail(FingerImpl2 child) { - nail.add(child); - } - - private FingerImpl2(HtmlColor backColor, Display label, ISkinParam skinParam, IdeaShape shape, Direction direction) { - this.backColor = backColor; - this.label = label; - this.skinParam = skinParam; - this.shape = shape; - this.direction = direction; - } - - public void drawU(final UGraphic ug) { - final StringBounder stringBounder = ug.getStringBounder(); - final TextBlock phalanx = getPhalanx(); - final Dimension2D dimPhalanx = phalanx.calculateDimension(stringBounder); - if (drawPhalanx) { - final double posY = -getPhalanxThickness(stringBounder) / 2; - final double posX = direction == Direction.RIGHT ? 0 : -dimPhalanx.getWidth(); - phalanx.drawU(ug.apply(new UTranslate(posX, posY))); - } - final Point2D p1 = new Point2D.Double(direction == Direction.RIGHT ? dimPhalanx.getWidth() - : -dimPhalanx.getWidth(), 0); - - for (int i = 0; i < nail.size(); i++) { - final FingerImpl2 child = nail.get(i); - final SymetricalTeePositioned stp = tetris(stringBounder).getElements().get(i); - final double x = direction == Direction.RIGHT ? dimPhalanx.getWidth() + getX12() : -dimPhalanx.getWidth() - - getX12(); - final Point2D p2 = new Point2D.Double(x, stp.getY()); - child.drawU(ug.apply(new UTranslate(p2))); - drawLine(ug.apply(new UChangeColor(getLinkColor())), p1, p2); - } - - } - - private HtmlColor getLinkColor() { - return ColorParam.activityBorder.getDefaultValue(); - } - - private void drawLine(UGraphic ug, Point2D p1, Point2D p2) { - // final ULine line = new ULine(p1, p2); - // ug.apply(new UTranslate(p1)).draw(line); - final UPath path = new UPath(); - final double delta1 = direction == Direction.RIGHT ? 10 : -10; - final double delta2 = direction == Direction.RIGHT ? 25 : -25; - path.moveTo(p1); - path.lineTo(p1.getX() + delta1, p1.getY()); - path.cubicTo(p1.getX() + delta2, p1.getY(), p2.getX() - delta2, p2.getY(), p2.getX() - delta1, p2.getY()); - path.lineTo(p2); - ug.draw(path); - } - - private Tetris tetris(StringBounder stringBounder) { - if (tetris == null) { - tetris = new Tetris(label.toString()); - for (FingerImpl2 child : nail) { - tetris.add(child.asSymetricalTee(stringBounder)); - } - tetris.balance(); - } - return tetris; - } - - private SymetricalTee asSymetricalTee(StringBounder stringBounder) { - final double thickness1 = getPhalanxThickness(stringBounder); - final double elongation1 = getPhalanxElongation(stringBounder); - if (nail.size() == 0) { - return new SymetricalTee(thickness1, elongation1, 0, 0); - } - final double thickness2 = getNailThickness(stringBounder); - final double elongation2 = getNailElongation(stringBounder); - return new SymetricalTee(thickness1, elongation1 + getX1(), thickness2, getX2() + elongation2); - } - - private double getX1() { - return 10; - } - - private double getX2() { - return 40; - } - - public double getX12() { - return getX1() + getX2(); - } - - public double getPhalanxThickness(StringBounder stringBounder) { - return getPhalanx().calculateDimension(stringBounder).getHeight(); - } - - public double getPhalanxElongation(StringBounder stringBounder) { - return getPhalanx().calculateDimension(stringBounder).getWidth(); - } - - private TextBlock getPhalanx() { - if (drawPhalanx == false) { - return TextBlockUtils.empty(0, 0); - } - final UFont font = skinParam.getFont(null, false, FontParam.ACTIVITY); - if (shape == IdeaShape.BOX) { - final ISkinParam foo = new SkinParamBackcolored(Colors.empty().mute(skinParam), backColor); - final FtileBox box = new FtileBox(foo, label, font, null, BoxStyle.PLAIN); - return TextBlockUtils.withMargin(box, 0, 0, 10, 10); - } - - final TextBlock text = label.create(FontConfiguration.blackBlueTrue(font), HorizontalAlignment.LEFT, skinParam); - if (direction == Direction.RIGHT) { - return TextBlockUtils.withMargin(text, 3, 0, 1, 1); - } - return TextBlockUtils.withMargin(text, 0, 3, 1, 1); - } - - public double getNailThickness(StringBounder stringBounder) { - return tetris(stringBounder).getHeight(); - } - - public double getNailElongation(StringBounder stringBounder) { - return tetris(stringBounder).getWidth(); - } - - public double getFullThickness(StringBounder stringBounder) { - final double thickness1 = getPhalanxThickness(stringBounder); - final double thickness2 = getNailThickness(stringBounder); - // System.err.println("thickness1=" + thickness1 + " thickness2=" + thickness2); - return Math.max(thickness1, thickness2); - } - - public double getFullElongation(StringBounder stringBounder) { - return getPhalanxElongation(stringBounder) + getNailElongation(stringBounder); - } - - public void doNotDrawFirstPhalanx() { - this.drawPhalanx = false; - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/Idea.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/Idea.java index 2095e4430..391b628e9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/Idea.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/Idea.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,7 +36,8 @@ import java.util.List; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.style.StyleBuilder; +import net.sourceforge.plantuml.ugraphic.color.HColor; class Idea { @@ -45,24 +46,30 @@ class Idea { private final Idea parent; private final List children = new ArrayList(); private final IdeaShape shape; - private final HtmlColor backColor; + private final HColor backColor; + private final StyleBuilder styleBuilder; + private final String stereotype; - public Idea(Display label, IdeaShape shape) { - this(null, 0, null, label, shape); + public Idea(StyleBuilder styleBuilder, HColor backColor, Display label, IdeaShape shape, String stereotype) { + this(styleBuilder, backColor, 0, null, label, shape, stereotype); } - public Idea createIdea(HtmlColor backColor, int newLevel, Display newDisplay, IdeaShape newShape) { - final Idea result = new Idea(backColor, newLevel, this, newDisplay, newShape); + public Idea createIdea(StyleBuilder styleBuilder, HColor backColor, int newLevel, Display newDisplay, + IdeaShape newShape, String stereotype) { + final Idea result = new Idea(styleBuilder, backColor, newLevel, this, newDisplay, newShape, stereotype); this.children.add(result); return result; } - private Idea(HtmlColor backColor, int level, Idea parent, Display label, IdeaShape shape) { + private Idea(StyleBuilder styleBuilder, HColor backColor, int level, Idea parent, Display label, IdeaShape shape, + String stereotype) { this.backColor = backColor; + this.styleBuilder = styleBuilder; this.label = label; this.level = level; this.parent = parent; this.shape = shape; + this.stereotype = stereotype; } @Override @@ -94,8 +101,16 @@ public final IdeaShape getShape() { return shape; } - public final HtmlColor getBackColor() { + public final HColor getBackColor() { return backColor; } + public final StyleBuilder getStyleBuilder() { + return styleBuilder; + } + + public final String getStereotype() { + return stereotype; + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/IdeaShape.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/IdeaShape.java index ad553709e..0994069bb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/IdeaShape.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/IdeaShape.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java index 6d1bc97bd..174e7de02 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,21 +41,28 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.Scale; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleBuilder; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class MindMapDiagram extends UmlDiagram { @@ -84,9 +91,23 @@ protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormat final double dpiFactor = scale == null ? getScaleCoef(fileFormatOption) : scale.getScale(100, 100); final ISkinParam skinParam = getSkinParam(); - final ImageBuilder imageBuilder = new ImageBuilder(skinParam.getColorMapper(), dpiFactor, - skinParam.getBackgroundColor(), fileFormatOption.isWithMetadata() ? getMetadata() : null, "", 10, 10, - null, skinParam.handwritten()); + final int margin1; + final int margin2; + final HColor backgroundColor; + if (SkinParam.USE_STYLES()) { + margin1 = SkinParam.zeroMargin(10); + margin2 = SkinParam.zeroMargin(10); + final Style style = StyleSignature.of(SName.root, SName.document, SName.mindmapDiagram) + .getMergedStyle(skinParam.getCurrentStyleBuilder()); + backgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); + } else { + margin1 = 10; + margin2 = 10; + backgroundColor = skinParam.getBackgroundColor(false); + } + final ImageBuilder imageBuilder = ImageBuilder.buildBB(skinParam.getColorMapper(), skinParam.handwritten(), + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, + fileFormatOption.isWithMetadata() ? getMetadata() : null, "", dpiFactor, backgroundColor); TextBlock result = getTextBlock(); result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder()).addAdd(result); @@ -126,13 +147,16 @@ public MinMax getMinMax(StringBounder stringBounder) { throw new UnsupportedOperationException(); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return null; } }; } private void drawMe(UGraphic ug) { + if (left.root == null && right.root == null) { + return; + } computeFinger(); final StringBounder stringBounder = ug.getStringBounder(); @@ -140,8 +164,8 @@ private void drawMe(UGraphic ug) { final double y2 = left.finger == null ? 0 : left.finger.getFullThickness(stringBounder) / 2; final double y = Math.max(y1, y2); - final double x = left.finger == null ? 0 : left.finger.getFullElongation(stringBounder) - + ((FingerImpl2) left.finger).getX12(); + final double x = left.finger == null ? 0 + : left.finger.getFullElongation(stringBounder) + ((FingerImpl) left.finger).getX12(); if (right.finger != null) { right.finger.drawU(ug.apply(new UTranslate(x, y))); } @@ -153,10 +177,10 @@ private void drawMe(UGraphic ug) { private void computeFinger() { if (left.finger == null && right.finger == null) { if (left.root.hasChildren()) { - left.finger = FingerImpl2.build(left.root, getSkinParam(), Direction.LEFT); + left.finger = FingerImpl.build(left.root, getSkinParam(), Direction.LEFT); } if (left.finger == null || right.root.hasChildren()) { - right.finger = FingerImpl2.build(right.root, getSkinParam(), Direction.RIGHT); + right.finger = FingerImpl.build(right.root, getSkinParam(), Direction.RIGHT); } if (left.finger != null && right.finger != null) { left.finger.doNotDrawFirstPhalanx(); @@ -164,25 +188,39 @@ private void computeFinger() { } } - public CommandExecutionResult addIdea(HtmlColor backColor, int level, String label, IdeaShape shape) { + public CommandExecutionResult addIdea(HColor backColor, int level, Display label, IdeaShape shape) { return addIdea(backColor, level, label, shape, defaultDirection); } - public CommandExecutionResult addIdea(HtmlColor backColor, int level, String label, IdeaShape shape, + public CommandExecutionResult addIdea(HColor backColor, int level, Display label, IdeaShape shape, Direction direction) { + String stereotype = label.getEndingStereotype(); + if (stereotype != null) { + label = label.removeEndingStereotype(); + } + return addIdeaInternal(stereotype, backColor, level, label, shape, direction); + } + + public CommandExecutionResult addIdea(String stereotype, HColor backColor, int level, Display label, + IdeaShape shape) { + return addIdeaInternal(stereotype, backColor, level, label, shape, defaultDirection); + } + + private CommandExecutionResult addIdeaInternal(String stereotype, HColor backColor, int level, Display label, + IdeaShape shape, Direction direction) { if (level == 0) { if (this.right.root != null) { - return CommandExecutionResult - .error("I don't know how to draw multi-root diagram. You should suggest an image so that the PlantUML team implements it :-)"); + return CommandExecutionResult.error( + "I don't know how to draw multi-root diagram. You should suggest an image so that the PlantUML team implements it :-)"); } - right.initRoot(label, shape); - left.initRoot(label, shape); + right.initRoot(getSkinParam().getCurrentStyleBuilder(), backColor, label, shape, stereotype); + left.initRoot(getSkinParam().getCurrentStyleBuilder(), backColor, label, shape, stereotype); return CommandExecutionResult.ok(); } if (direction == Direction.LEFT) { - return left.add(backColor, level, label, shape); + return left.add(getSkinParam().getCurrentStyleBuilder(), backColor, level, label, shape, stereotype); } - return right.add(backColor, level, label, shape); + return right.add(getSkinParam().getCurrentStyleBuilder(), backColor, level, label, shape, stereotype); } static class Branch { @@ -190,8 +228,9 @@ static class Branch { private Idea last; private Finger finger; - private void initRoot(String label, IdeaShape shape) { - root = new Idea(Display.getWithNewlines(label), shape); + private void initRoot(StyleBuilder styleBuilder, HColor backColor, Display label, IdeaShape shape, + String stereotype) { + root = new Idea(styleBuilder, backColor, label, shape, stereotype); last = root; } @@ -203,15 +242,20 @@ private Idea getParentOfLast(int nb) { return result; } - private CommandExecutionResult add(HtmlColor backColor, int level, String label, IdeaShape shape) { + private CommandExecutionResult add(StyleBuilder styleBuilder, HColor backColor, int level, Display label, + IdeaShape shape, String stereotype) { + if (last == null) { + return CommandExecutionResult.error("Check your indentation ?"); + } if (level == last.getLevel() + 1) { - final Idea newIdea = last.createIdea(backColor, level, Display.getWithNewlines(label), shape); + final Idea newIdea = last.createIdea(styleBuilder, backColor, level, label, shape, stereotype); last = newIdea; return CommandExecutionResult.ok(); } if (level <= last.getLevel()) { final int diff = last.getLevel() - level + 1; - final Idea newIdea = getParentOfLast(diff).createIdea(backColor, level, Display.getWithNewlines(label), shape); + final Idea newIdea = getParentOfLast(diff).createIdea(styleBuilder, backColor, level, label, shape, + stereotype); last = newIdea; return CommandExecutionResult.ok(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/MindMapDiagramFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/MindMapDiagramFactory.java index 0f1e5d156..baaa27b02 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/MindMapDiagramFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/MindMapDiagramFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -50,6 +50,7 @@ protected List createCommands() { addCommonCommands1(cmds); cmds.add(new CommandMindMapTabulation()); cmds.add(new CommandMindMapOrgmode()); + cmds.add(new CommandMindMapOrgmodeMultiline()); cmds.add(new CommandMindMapRoot()); cmds.add(new CommandMindMapPlus()); cmds.add(new CommandMindMapDirection()); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/Stripe.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/Stripe.java index cb4584a80..811e81730 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/Stripe.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/Stripe.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/StripeFrontier.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/StripeFrontier.java index fd114d0b2..fc6d256bc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/StripeFrontier.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/StripeFrontier.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/SymetricalTee.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/SymetricalTee.java index 0ff3c6c01..6f7d76bac 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/SymetricalTee.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/SymetricalTee.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/SymetricalTeePositioned.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/SymetricalTeePositioned.java index 4950fe7b0..a9ddbf400 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/SymetricalTeePositioned.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/SymetricalTeePositioned.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/Tetris.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/Tetris.java index 837add8be..65c17e591 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/Tetris.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mindmap/Tetris.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/mjpeg/MJPEGGenerator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/mjpeg/MJPEGGenerator.java index 3151d68b8..4c5258b2f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/mjpeg/MJPEGGenerator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/mjpeg/MJPEGGenerator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -44,109 +44,100 @@ import java.awt.Image; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; -import java.io.File; import java.io.FileOutputStream; -import java.io.FilenameFilter; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.channels.FileChannel; import java.util.ArrayList; import java.util.Arrays; -import javax.imageio.ImageIO; -import javax.swing.ImageIcon; - -import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.security.ImageIO; +import net.sourceforge.plantuml.security.SFile; /** * * @author monceaux */ -public class MJPEGGenerator -{ - /* - * Info needed for MJPEG AVI - * - * - size of file minus "RIFF & 4 byte file size" - * - */ - - int width = 0; - int height = 0; - double framerate = 0; - int numFrames = 0; - File aviFile = null; - FileOutputStream aviOutput = null; - FileChannel aviChannel = null; - - long riffOffset = 0; - long aviMovieOffset = 0; - - AVIIndexList indexlist = null; - - /** Creates a new instance of MJPEGGenerator */ - public MJPEGGenerator(File aviFile, int width, int height, double framerate, int numFrames) throws IOException - { - this.aviFile = aviFile; - this.width = width; - this.height = height; - this.framerate = framerate; - this.numFrames = numFrames; - aviOutput = new FileOutputStream(aviFile); - aviChannel = aviOutput.getChannel(); - - RIFFHeader rh = new RIFFHeader(); - aviOutput.write(rh.toBytes()); - aviOutput.write(new AVIMainHeader().toBytes()); - aviOutput.write(new AVIStreamList().toBytes()); - aviOutput.write(new AVIStreamHeader().toBytes()); - aviOutput.write(new AVIStreamFormat().toBytes()); - aviOutput.write(new AVIJunk().toBytes()); - aviMovieOffset = aviChannel.position(); - aviOutput.write(new AVIMovieList().toBytes()); - indexlist = new AVIIndexList(); - } - - public void addImage(Image image) throws IOException - { - byte[] fcc = new byte[]{'0','0','d','b'}; - byte[] imagedata = writeImageToBytes(image); - int useLength = imagedata.length; - long position = aviChannel.position(); - int extra = (useLength+(int)position) % 4; - if(extra > 0) - useLength = useLength + extra; - - indexlist.addAVIIndex((int)position,useLength); - - aviOutput.write(fcc); - aviOutput.write(intBytes(swapInt(useLength))); - aviOutput.write(imagedata); - if(extra > 0) - { - for(int i = 0; i < extra; i++) - aviOutput.write(0); - } - imagedata = null; - } - - public void finishAVI() throws IOException - { - byte[] indexlistBytes = indexlist.toBytes(); - aviOutput.write(indexlistBytes); - aviOutput.close(); - long size = aviFile.length(); - RandomAccessFile raf = new RandomAccessFile(aviFile, "rw"); - raf.seek(4); - raf.write(intBytes(swapInt((int)size - 8))); - raf.seek(aviMovieOffset+4); - raf.write(intBytes(swapInt((int)(size - 8 - aviMovieOffset - indexlistBytes.length)))); - raf.close(); - } - +public class MJPEGGenerator { + /* + * Info needed for MJPEG AVI + * + * - size of file minus "RIFF & 4 byte file size" + * + */ + + int width = 0; + int height = 0; + double framerate = 0; + int numFrames = 0; + SFile aviFile = null; + FileOutputStream aviOutput = null; + FileChannel aviChannel = null; + + long riffOffset = 0; + long aviMovieOffset = 0; + + AVIIndexList indexlist = null; + + /** Creates a new instance of MJPEGGenerator */ + public MJPEGGenerator(SFile aviFile, int width, int height, double framerate, int numFrames) throws IOException { + this.aviFile = aviFile; + this.width = width; + this.height = height; + this.framerate = framerate; + this.numFrames = numFrames; + aviOutput = aviFile.createFileOutputStream(); + aviChannel = aviOutput.getChannel(); + + RIFFHeader rh = new RIFFHeader(); + aviOutput.write(rh.toBytes()); + aviOutput.write(new AVIMainHeader().toBytes()); + aviOutput.write(new AVIStreamList().toBytes()); + aviOutput.write(new AVIStreamHeader().toBytes()); + aviOutput.write(new AVIStreamFormat().toBytes()); + aviOutput.write(new AVIJunk().toBytes()); + aviMovieOffset = aviChannel.position(); + aviOutput.write(new AVIMovieList().toBytes()); + indexlist = new AVIIndexList(); + } + + public void addImage(Image image) throws IOException { + byte[] fcc = new byte[] { '0', '0', 'd', 'b' }; + byte[] imagedata = writeImageToBytes(image); + int useLength = imagedata.length; + long position = aviChannel.position(); + int extra = (useLength + (int) position) % 4; + if (extra > 0) + useLength = useLength + extra; + + indexlist.addAVIIndex((int) position, useLength); + + aviOutput.write(fcc); + aviOutput.write(intBytes(swapInt(useLength))); + aviOutput.write(imagedata); + if (extra > 0) { + for (int i = 0; i < extra; i++) + aviOutput.write(0); + } + imagedata = null; + } + + public void finishAVI() throws IOException { + byte[] indexlistBytes = indexlist.toBytes(); + aviOutput.write(indexlistBytes); + aviOutput.close(); + long size = aviFile.length(); + RandomAccessFile raf = new RandomAccessFile(aviFile.conv(), "rw"); + raf.seek(4); + raf.write(intBytes(swapInt((int) size - 8))); + raf.seek(aviMovieOffset + 4); + raf.write(intBytes(swapInt((int) (size - 8 - aviMovieOffset - indexlistBytes.length)))); + raf.close(); + } + // public void writeAVI(File file) throws Exception // { -// OutputStream os = new FileOutputStream(file); +// OutputStream os = SecurityUtils.FileOutputStream(file); // // // RIFFHeader // // AVIMainHeader @@ -155,451 +146,376 @@ public void finishAVI() throws IOException // // AVIStreamFormat // // write 00db and image bytes... // } - - public static int swapInt(int v) - { - return (v >>> 24) | (v << 24) | - ((v << 8) & 0x00FF0000) | ((v >> 8) & 0x0000FF00); - } - - public static short swapShort(short v) - { - return (short)((v >>> 8) | (v << 8)); - } - - public static byte[] intBytes(int i) - { - byte[] b = new byte[4]; - b[0] = (byte)(i >>> 24); - b[1] = (byte)((i >>> 16) & 0x000000FF); - b[2] = (byte)((i >>> 8) & 0x000000FF); - b[3] = (byte)(i & 0x000000FF); - - return b; - } - - public static byte[] shortBytes(short i) - { - byte[] b = new byte[2]; - b[0] = (byte)(i >>> 8); - b[1] = (byte)(i & 0x000000FF); - - return b; - } - - private class RIFFHeader - { - public byte[] fcc = new byte[]{'R','I','F','F'}; - public int fileSize = 0; - public byte[] fcc2 = new byte[]{'A','V','I',' '}; - public byte[] fcc3 = new byte[]{'L','I','S','T'}; - public int listSize = 200; - public byte[] fcc4 = new byte[]{'h','d','r','l'}; - - public RIFFHeader() - { - - } - - public byte[] toBytes() throws IOException - { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - baos.write(fcc); - baos.write(intBytes(swapInt(fileSize))); - baos.write(fcc2); - baos.write(fcc3); - baos.write(intBytes(swapInt(listSize))); - baos.write(fcc4); - baos.close(); - - return baos.toByteArray(); - } - } - - private class AVIMainHeader - { - /* - * - FOURCC fcc; - DWORD cb; - DWORD dwMicroSecPerFrame; - DWORD dwMaxBytesPerSec; - DWORD dwPaddingGranularity; - DWORD dwFlags; - DWORD dwTotalFrames; - DWORD dwInitialFrames; - DWORD dwStreams; - DWORD dwSuggestedBufferSize; - DWORD dwWidth; - DWORD dwHeight; - DWORD dwReserved[4]; - */ - - public byte[] fcc = new byte[]{'a','v','i','h'}; - public int cb = 56; - public int dwMicroSecPerFrame = 0; // (1 / frames per sec) * 1,000,000 - public int dwMaxBytesPerSec = 10000000; - public int dwPaddingGranularity = 0; - public int dwFlags = 65552; - public int dwTotalFrames = 0; // replace with correct value - public int dwInitialFrames = 0; - public int dwStreams = 1; - public int dwSuggestedBufferSize = 0; - public int dwWidth = 0; // replace with correct value - public int dwHeight = 0; // replace with correct value - public int[] dwReserved = new int[4]; - - public AVIMainHeader() - { - dwMicroSecPerFrame = (int)((1.0/framerate)*1000000.0); - dwWidth = width; - dwHeight = height; - dwTotalFrames = numFrames; - } - - public byte[] toBytes() throws IOException - { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - baos.write(fcc); - baos.write(intBytes(swapInt(cb))); - baos.write(intBytes(swapInt(dwMicroSecPerFrame))); - baos.write(intBytes(swapInt(dwMaxBytesPerSec))); - baos.write(intBytes(swapInt(dwPaddingGranularity))); - baos.write(intBytes(swapInt(dwFlags))); - baos.write(intBytes(swapInt(dwTotalFrames))); - baos.write(intBytes(swapInt(dwInitialFrames))); - baos.write(intBytes(swapInt(dwStreams))); - baos.write(intBytes(swapInt(dwSuggestedBufferSize))); - baos.write(intBytes(swapInt(dwWidth))); - baos.write(intBytes(swapInt(dwHeight))); - baos.write(intBytes(swapInt(dwReserved[0]))); - baos.write(intBytes(swapInt(dwReserved[1]))); - baos.write(intBytes(swapInt(dwReserved[2]))); - baos.write(intBytes(swapInt(dwReserved[3]))); - baos.close(); - - return baos.toByteArray(); - } - } - - private class AVIStreamList - { - public byte[] fcc = new byte[]{'L','I','S','T'}; - public int size = 124; - public byte[] fcc2 = new byte[]{'s','t','r','l'}; - - public AVIStreamList() - { - - } - - public byte[] toBytes() throws IOException - { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - baos.write(fcc); - baos.write(intBytes(swapInt(size))); - baos.write(fcc2); - baos.close(); - - return baos.toByteArray(); - } - } - - private class AVIStreamHeader - { - /* - FOURCC fcc; - DWORD cb; - FOURCC fccType; - FOURCC fccHandler; - DWORD dwFlags; - WORD wPriority; - WORD wLanguage; - DWORD dwInitialFrames; - DWORD dwScale; - DWORD dwRate; - DWORD dwStart; - DWORD dwLength; - DWORD dwSuggestedBufferSize; - DWORD dwQuality; - DWORD dwSampleSize; - struct { - short int left; - short int top; - short int right; - short int bottom; - } rcFrame; - */ - - public byte[] fcc = new byte[]{'s','t','r','h'}; - public int cb = 64; - public byte[] fccType = new byte[]{'v','i','d','s'}; - public byte[] fccHandler = new byte[]{'M','J','P','G'}; - public int dwFlags = 0; - public short wPriority = 0; - public short wLanguage = 0; - public int dwInitialFrames = 0; - public int dwScale = 0; // microseconds per frame - public int dwRate = 1000000; // dwRate / dwScale = frame rate - public int dwStart = 0; - public int dwLength = 0; // num frames - public int dwSuggestedBufferSize = 0; - public int dwQuality = -1; - public int dwSampleSize = 0; - public int left = 0; - public int top = 0; - public int right = 0; - public int bottom = 0; - - public AVIStreamHeader() - { - dwScale = (int)((1.0/framerate)*1000000.0); - dwLength = numFrames; - } - - public byte[] toBytes() throws IOException - { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - baos.write(fcc); - baos.write(intBytes(swapInt(cb))); - baos.write(fccType); - baos.write(fccHandler); - baos.write(intBytes(swapInt(dwFlags))); - baos.write(shortBytes(swapShort(wPriority))); - baos.write(shortBytes(swapShort(wLanguage))); - baos.write(intBytes(swapInt(dwInitialFrames))); - baos.write(intBytes(swapInt(dwScale))); - baos.write(intBytes(swapInt(dwRate))); - baos.write(intBytes(swapInt(dwStart))); - baos.write(intBytes(swapInt(dwLength))); - baos.write(intBytes(swapInt(dwSuggestedBufferSize))); - baos.write(intBytes(swapInt(dwQuality))); - baos.write(intBytes(swapInt(dwSampleSize))); - baos.write(intBytes(swapInt(left))); - baos.write(intBytes(swapInt(top))); - baos.write(intBytes(swapInt(right))); - baos.write(intBytes(swapInt(bottom))); - baos.close(); - - return baos.toByteArray(); - } - } - - private class AVIStreamFormat - { - /* - FOURCC fcc; - DWORD cb; - DWORD biSize; - LONG biWidth; - LONG biHeight; - WORD biPlanes; - WORD biBitCount; - DWORD biCompression; - DWORD biSizeImage; - LONG biXPelsPerMeter; - LONG biYPelsPerMeter; - DWORD biClrUsed; - DWORD biClrImportant; - */ - - public byte[] fcc = new byte[]{'s','t','r','f'}; - public int cb = 40; - public int biSize = 40; // same as cb - public int biWidth = 0; - public int biHeight = 0; - public short biPlanes = 1; - public short biBitCount = 24; - public byte[] biCompression = new byte[]{'M','J','P','G'}; - public int biSizeImage = 0; // width x height in pixels - public int biXPelsPerMeter = 0; - public int biYPelsPerMeter = 0; - public int biClrUsed = 0; - public int biClrImportant = 0; - - - public AVIStreamFormat() - { - biWidth = width; - biHeight = height; - biSizeImage = width * height; - } - - public byte[] toBytes() throws IOException - { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - baos.write(fcc); - baos.write(intBytes(swapInt(cb))); - baos.write(intBytes(swapInt(biSize))); - baos.write(intBytes(swapInt(biWidth))); - baos.write(intBytes(swapInt(biHeight))); - baos.write(shortBytes(swapShort(biPlanes))); - baos.write(shortBytes(swapShort(biBitCount))); - baos.write(biCompression); - baos.write(intBytes(swapInt(biSizeImage))); - baos.write(intBytes(swapInt(biXPelsPerMeter))); - baos.write(intBytes(swapInt(biYPelsPerMeter))); - baos.write(intBytes(swapInt(biClrUsed))); - baos.write(intBytes(swapInt(biClrImportant))); - baos.close(); - - return baos.toByteArray(); - } - } - - private class AVIMovieList - { - public byte[] fcc = new byte[]{'L','I','S','T'}; - public int listSize = 0; - public byte[] fcc2 = new byte[]{'m','o','v','i'}; - // 00db size jpg image data ... - - public AVIMovieList() - { - - } - - public byte[] toBytes() throws IOException - { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - baos.write(fcc); - baos.write(intBytes(swapInt(listSize))); - baos.write(fcc2); - baos.close(); - - return baos.toByteArray(); - } - } - - private class AVIIndexList - { - public byte[] fcc = new byte[]{'i','d','x','1'}; - public int cb = 0; - public ArrayList ind = new ArrayList(); - - public AVIIndexList() - { - - } - - public void addAVIIndex(AVIIndex ai) - { - ind.add(ai); - } - - public void addAVIIndex(int dwOffset, int dwSize) - { - ind.add(new AVIIndex(dwOffset, dwSize)); - } - - public byte[] toBytes() throws IOException - { - cb = 16 * ind.size(); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - baos.write(fcc); - baos.write(intBytes(swapInt(cb))); - for(int i = 0; i < ind.size(); i++) - { - AVIIndex in = (AVIIndex)ind.get(i); - baos.write(in.toBytes()); - } - - baos.close(); - - return baos.toByteArray(); - } - } - - private class AVIIndex - { - public byte[] fcc = new byte[]{'0','0','d','b'}; - public int dwFlags = 16; - public int dwOffset = 0; - public int dwSize = 0; - - public AVIIndex(int dwOffset, int dwSize) - { - this.dwOffset = dwOffset; - this.dwSize = dwSize; - } - - public byte[] toBytes() throws IOException - { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - baos.write(fcc); - baos.write(intBytes(swapInt(dwFlags))); - baos.write(intBytes(swapInt(dwOffset))); - baos.write(intBytes(swapInt(dwSize))); - baos.close(); - - return baos.toByteArray(); - } - } - - private class AVIJunk - { - public byte[] fcc = new byte[]{'J','U','N','K'}; - public int size = 1808; - public byte[] data = new byte[size]; - - public AVIJunk() - { - Arrays.fill(data,(byte)0); - } - - public byte[] toBytes() throws IOException - { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - baos.write(fcc); - baos.write(intBytes(swapInt(size))); - baos.write(data); - baos.close(); - - return baos.toByteArray(); - } - } - - private byte[] writeImageToBytes(Image image) throws IOException - { - BufferedImage bi = new BufferedImage(width, height,BufferedImage.TYPE_INT_RGB); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - Graphics2D g = bi.createGraphics(); - g.drawImage(image,0,0,width,height,null); - ImageIO.write(bi,"jpg",baos); - baos.close(); - bi = null; - g = null; - - return baos.toByteArray(); - } - - public static void main(String[] args) throws Exception - { - double framerate = 12.0; - double transitionDuration = 1; // seconds - double slideDuration = 3; // seconds - - File photoDir = new File(args[0]); - File[] files = photoDir.listFiles(new FilenameFilter(){ - public boolean accept(File dir, String name) - { - if(StringUtils.goLowerCase(name).endsWith("jpg")) - return true; - return false; - } - }); - - - int numFrames = (int)(files.length * framerate * (slideDuration + transitionDuration) + (transitionDuration * framerate)); - MJPEGGenerator m = new MJPEGGenerator(new File(args[1]), 640, 480, framerate, numFrames); - for(int i = 0; i < files.length; i++) - { - System.out.println("processing file "+i); - ImageIcon ii = new ImageIcon(files[i].getCanonicalPath()); - m.addImage(ii.getImage()); - } - m.finishAVI(); - } - + + public static int swapInt(int v) { + return (v >>> 24) | (v << 24) | ((v << 8) & 0x00FF0000) | ((v >> 8) & 0x0000FF00); + } + + public static short swapShort(short v) { + return (short) ((v >>> 8) | (v << 8)); + } + + public static byte[] intBytes(int i) { + byte[] b = new byte[4]; + b[0] = (byte) (i >>> 24); + b[1] = (byte) ((i >>> 16) & 0x000000FF); + b[2] = (byte) ((i >>> 8) & 0x000000FF); + b[3] = (byte) (i & 0x000000FF); + + return b; + } + + public static byte[] shortBytes(short i) { + byte[] b = new byte[2]; + b[0] = (byte) (i >>> 8); + b[1] = (byte) (i & 0x000000FF); + + return b; + } + + private class RIFFHeader { + public byte[] fcc = new byte[] { 'R', 'I', 'F', 'F' }; + public int fileSize = 0; + public byte[] fcc2 = new byte[] { 'A', 'V', 'I', ' ' }; + public byte[] fcc3 = new byte[] { 'L', 'I', 'S', 'T' }; + public int listSize = 200; + public byte[] fcc4 = new byte[] { 'h', 'd', 'r', 'l' }; + + public RIFFHeader() { + + } + + public byte[] toBytes() throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + baos.write(fcc); + baos.write(intBytes(swapInt(fileSize))); + baos.write(fcc2); + baos.write(fcc3); + baos.write(intBytes(swapInt(listSize))); + baos.write(fcc4); + baos.close(); + + return baos.toByteArray(); + } + } + + private class AVIMainHeader { + /* + * + * FOURCC fcc; DWORD cb; DWORD dwMicroSecPerFrame; DWORD dwMaxBytesPerSec; DWORD + * dwPaddingGranularity; DWORD dwFlags; DWORD dwTotalFrames; DWORD + * dwInitialFrames; DWORD dwStreams; DWORD dwSuggestedBufferSize; DWORD dwWidth; + * DWORD dwHeight; DWORD dwReserved[4]; + */ + + public byte[] fcc = new byte[] { 'a', 'v', 'i', 'h' }; + public int cb = 56; + public int dwMicroSecPerFrame = 0; // (1 / frames per sec) * 1,000,000 + public int dwMaxBytesPerSec = 10000000; + public int dwPaddingGranularity = 0; + public int dwFlags = 65552; + public int dwTotalFrames = 0; // replace with correct value + public int dwInitialFrames = 0; + public int dwStreams = 1; + public int dwSuggestedBufferSize = 0; + public int dwWidth = 0; // replace with correct value + public int dwHeight = 0; // replace with correct value + public int[] dwReserved = new int[4]; + + public AVIMainHeader() { + dwMicroSecPerFrame = (int) ((1.0 / framerate) * 1000000.0); + dwWidth = width; + dwHeight = height; + dwTotalFrames = numFrames; + } + + public byte[] toBytes() throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + baos.write(fcc); + baos.write(intBytes(swapInt(cb))); + baos.write(intBytes(swapInt(dwMicroSecPerFrame))); + baos.write(intBytes(swapInt(dwMaxBytesPerSec))); + baos.write(intBytes(swapInt(dwPaddingGranularity))); + baos.write(intBytes(swapInt(dwFlags))); + baos.write(intBytes(swapInt(dwTotalFrames))); + baos.write(intBytes(swapInt(dwInitialFrames))); + baos.write(intBytes(swapInt(dwStreams))); + baos.write(intBytes(swapInt(dwSuggestedBufferSize))); + baos.write(intBytes(swapInt(dwWidth))); + baos.write(intBytes(swapInt(dwHeight))); + baos.write(intBytes(swapInt(dwReserved[0]))); + baos.write(intBytes(swapInt(dwReserved[1]))); + baos.write(intBytes(swapInt(dwReserved[2]))); + baos.write(intBytes(swapInt(dwReserved[3]))); + baos.close(); + + return baos.toByteArray(); + } + } + + private class AVIStreamList { + public byte[] fcc = new byte[] { 'L', 'I', 'S', 'T' }; + public int size = 124; + public byte[] fcc2 = new byte[] { 's', 't', 'r', 'l' }; + + public AVIStreamList() { + + } + + public byte[] toBytes() throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + baos.write(fcc); + baos.write(intBytes(swapInt(size))); + baos.write(fcc2); + baos.close(); + + return baos.toByteArray(); + } + } + + private class AVIStreamHeader { + /* + * FOURCC fcc; DWORD cb; FOURCC fccType; FOURCC fccHandler; DWORD dwFlags; WORD + * wPriority; WORD wLanguage; DWORD dwInitialFrames; DWORD dwScale; DWORD + * dwRate; DWORD dwStart; DWORD dwLength; DWORD dwSuggestedBufferSize; DWORD + * dwQuality; DWORD dwSampleSize; struct { short int left; short int top; short + * int right; short int bottom; } rcFrame; + */ + + public byte[] fcc = new byte[] { 's', 't', 'r', 'h' }; + public int cb = 64; + public byte[] fccType = new byte[] { 'v', 'i', 'd', 's' }; + public byte[] fccHandler = new byte[] { 'M', 'J', 'P', 'G' }; + public int dwFlags = 0; + public short wPriority = 0; + public short wLanguage = 0; + public int dwInitialFrames = 0; + public int dwScale = 0; // microseconds per frame + public int dwRate = 1000000; // dwRate / dwScale = frame rate + public int dwStart = 0; + public int dwLength = 0; // num frames + public int dwSuggestedBufferSize = 0; + public int dwQuality = -1; + public int dwSampleSize = 0; + public int left = 0; + public int top = 0; + public int right = 0; + public int bottom = 0; + + public AVIStreamHeader() { + dwScale = (int) ((1.0 / framerate) * 1000000.0); + dwLength = numFrames; + } + + public byte[] toBytes() throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + baos.write(fcc); + baos.write(intBytes(swapInt(cb))); + baos.write(fccType); + baos.write(fccHandler); + baos.write(intBytes(swapInt(dwFlags))); + baos.write(shortBytes(swapShort(wPriority))); + baos.write(shortBytes(swapShort(wLanguage))); + baos.write(intBytes(swapInt(dwInitialFrames))); + baos.write(intBytes(swapInt(dwScale))); + baos.write(intBytes(swapInt(dwRate))); + baos.write(intBytes(swapInt(dwStart))); + baos.write(intBytes(swapInt(dwLength))); + baos.write(intBytes(swapInt(dwSuggestedBufferSize))); + baos.write(intBytes(swapInt(dwQuality))); + baos.write(intBytes(swapInt(dwSampleSize))); + baos.write(intBytes(swapInt(left))); + baos.write(intBytes(swapInt(top))); + baos.write(intBytes(swapInt(right))); + baos.write(intBytes(swapInt(bottom))); + baos.close(); + + return baos.toByteArray(); + } + } + + private class AVIStreamFormat { + /* + * FOURCC fcc; DWORD cb; DWORD biSize; LONG biWidth; LONG biHeight; WORD + * biPlanes; WORD biBitCount; DWORD biCompression; DWORD biSizeImage; LONG + * biXPelsPerMeter; LONG biYPelsPerMeter; DWORD biClrUsed; DWORD biClrImportant; + */ + + public byte[] fcc = new byte[] { 's', 't', 'r', 'f' }; + public int cb = 40; + public int biSize = 40; // same as cb + public int biWidth = 0; + public int biHeight = 0; + public short biPlanes = 1; + public short biBitCount = 24; + public byte[] biCompression = new byte[] { 'M', 'J', 'P', 'G' }; + public int biSizeImage = 0; // width x height in pixels + public int biXPelsPerMeter = 0; + public int biYPelsPerMeter = 0; + public int biClrUsed = 0; + public int biClrImportant = 0; + + public AVIStreamFormat() { + biWidth = width; + biHeight = height; + biSizeImage = width * height; + } + + public byte[] toBytes() throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + baos.write(fcc); + baos.write(intBytes(swapInt(cb))); + baos.write(intBytes(swapInt(biSize))); + baos.write(intBytes(swapInt(biWidth))); + baos.write(intBytes(swapInt(biHeight))); + baos.write(shortBytes(swapShort(biPlanes))); + baos.write(shortBytes(swapShort(biBitCount))); + baos.write(biCompression); + baos.write(intBytes(swapInt(biSizeImage))); + baos.write(intBytes(swapInt(biXPelsPerMeter))); + baos.write(intBytes(swapInt(biYPelsPerMeter))); + baos.write(intBytes(swapInt(biClrUsed))); + baos.write(intBytes(swapInt(biClrImportant))); + baos.close(); + + return baos.toByteArray(); + } + } + + private class AVIMovieList { + public byte[] fcc = new byte[] { 'L', 'I', 'S', 'T' }; + public int listSize = 0; + public byte[] fcc2 = new byte[] { 'm', 'o', 'v', 'i' }; + // 00db size jpg image data ... + + public AVIMovieList() { + + } + + public byte[] toBytes() throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + baos.write(fcc); + baos.write(intBytes(swapInt(listSize))); + baos.write(fcc2); + baos.close(); + + return baos.toByteArray(); + } + } + + private class AVIIndexList { + public byte[] fcc = new byte[] { 'i', 'd', 'x', '1' }; + public int cb = 0; + public ArrayList ind = new ArrayList(); + + public AVIIndexList() { + + } + + public void addAVIIndex(AVIIndex ai) { + ind.add(ai); + } + + public void addAVIIndex(int dwOffset, int dwSize) { + ind.add(new AVIIndex(dwOffset, dwSize)); + } + + public byte[] toBytes() throws IOException { + cb = 16 * ind.size(); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + baos.write(fcc); + baos.write(intBytes(swapInt(cb))); + for (int i = 0; i < ind.size(); i++) { + AVIIndex in = (AVIIndex) ind.get(i); + baos.write(in.toBytes()); + } + + baos.close(); + + return baos.toByteArray(); + } + } + + private class AVIIndex { + public byte[] fcc = new byte[] { '0', '0', 'd', 'b' }; + public int dwFlags = 16; + public int dwOffset = 0; + public int dwSize = 0; + + public AVIIndex(int dwOffset, int dwSize) { + this.dwOffset = dwOffset; + this.dwSize = dwSize; + } + + public byte[] toBytes() throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + baos.write(fcc); + baos.write(intBytes(swapInt(dwFlags))); + baos.write(intBytes(swapInt(dwOffset))); + baos.write(intBytes(swapInt(dwSize))); + baos.close(); + + return baos.toByteArray(); + } + } + + private class AVIJunk { + public byte[] fcc = new byte[] { 'J', 'U', 'N', 'K' }; + public int size = 1808; + public byte[] data = new byte[size]; + + public AVIJunk() { + Arrays.fill(data, (byte) 0); + } + + public byte[] toBytes() throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + baos.write(fcc); + baos.write(intBytes(swapInt(size))); + baos.write(data); + baos.close(); + + return baos.toByteArray(); + } + } + + private byte[] writeImageToBytes(Image image) throws IOException { + BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + Graphics2D g = bi.createGraphics(); + g.drawImage(image, 0, 0, width, height, null); + ImageIO.write(bi, "jpg", baos); + baos.close(); + bi = null; + g = null; + + return baos.toByteArray(); + } + +// public static void main(String[] args) throws Exception { +// double framerate = 12.0; +// double transitionDuration = 1; // seconds +// double slideDuration = 3; // seconds +// +// File photoDir = SecurityUtils.file(args[0]); +// File[] files = photoDir.listFiles(new FilenameFilter() { +// public boolean accept(java.io.File dir, String name) { +// if (StringUtils.goLowerCase(name).endsWith("jpg")) +// return true; +// return false; +// } +// }); +// +// int numFrames = (int) (files.length * framerate * (slideDuration + transitionDuration) +// + (transitionDuration * framerate)); +// MJPEGGenerator m = new MJPEGGenerator(SecurityUtils.file(args[1]), 640, 480, framerate, numFrames); +// for (int i = 0; i < files.length; i++) { +// System.out.println("processing file " + i); +// ImageIcon ii = new ImageIcon(files[i].getCanonicalPath()); +// m.addImage(ii.getImage()); +// } +// m.finishAVI(); +// } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandComment.java b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandComment.java index 5901add7f..1f3646687 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandComment.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandComment.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandElement.java b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandElement.java index a93074617..9591c9a6f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandElement.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandElement.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandEndSomething.java b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandEndSomething.java index ac7f6f77d..e147bfc2d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandEndSomething.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandEndSomething.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandGroup.java b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandGroup.java index 1831ed262..d9ff7eae7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandGroup.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandGroup.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandLink.java b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandLink.java index 2198c67d0..f2d0f7c38 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandLink.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandLink.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandNetwork.java b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandNetwork.java index 9979b5506..ed8ad21ee 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandNetwork.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandNetwork.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandNwDiagInit.java b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandNwDiagInit.java index f5bd00fd5..5b1ed21da 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandNwDiagInit.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandNwDiagInit.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandProperty.java b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandProperty.java index 19bbb8138..27d6e15d8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandProperty.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/CommandProperty.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/DiagElement.java b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/DiagElement.java index a971ac7ef..c07b2d9a0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/DiagElement.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/DiagElement.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,16 +31,19 @@ package net.sourceforge.plantuml.nwdiag; import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.ComponentStyle; import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.USymbol; +import net.sourceforge.plantuml.skin.ActorStyle; +import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class DiagElement { @@ -74,17 +77,17 @@ private TextBlock toTextBlock(String s) { private FontConfiguration getFontConfiguration() { final UFont font = UFont.serif(11); - return new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK, false); + return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); } public LinkedElement asTextBlock(final String adress1, final String adress2) { final TextBlock ad1 = toTextBlock(adress1); final TextBlock ad2 = toTextBlock(adress2); final SymbolContext symbolContext = new SymbolContext(ColorParam.activityBackground.getDefaultValue(), - ColorParam.activityBorder.getDefaultValue()).withShadow(true); + ColorParam.activityBorder.getDefaultValue()).withShadow(3); final TextBlock desc = toTextBlock(description); - final TextBlock box = shape - .asSmall(TextBlockUtils.empty(0, 0), desc, TextBlockUtils.empty(0, 0), symbolContext, HorizontalAlignment.CENTER); + final TextBlock box = shape.asSmall(TextBlockUtils.empty(0, 0), desc, TextBlockUtils.empty(0, 0), symbolContext, + HorizontalAlignment.CENTER); return new LinkedElement(ad1, box, ad2, mainNetwork, this); } @@ -105,7 +108,8 @@ public String getName() { } public final void setShape(String shapeName) { - final USymbol shapeFromString = USymbol.getFromString(shapeName); + final USymbol shapeFromString = USymbol.fromString(shapeName, ActorStyle.STICKMAN, ComponentStyle.RECTANGLE, + PackageStyle.RECTANGLE); if (shapeFromString != null) { this.shape = shapeFromString; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/DiagGroup.java b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/DiagGroup.java index f8ae0f1a0..8d2bd9354 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/DiagGroup.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/DiagGroup.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,14 +33,14 @@ import java.util.HashSet; import java.util.Set; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class DiagGroup { private final String name; private final Network network; private final Set elements = new HashSet(); - private HtmlColor color; + private HColor color; @Override public String toString() { @@ -67,11 +67,11 @@ public boolean matches(LinkedElement tested) { return elements.contains(tested.getElement().getName()); } - public final HtmlColor getColor() { + public final HColor getColor() { return color; } - public final void setColor(HtmlColor color) { + public final void setColor(HColor color) { this.color = color; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/GridTextBlockDecorated.java b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/GridTextBlockDecorated.java index 896ea3075..f90f6821e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/GridTextBlockDecorated.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/GridTextBlockDecorated.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,18 +32,17 @@ import java.util.Collection; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.MinMax; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; 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.HColorSet; public class GridTextBlockDecorated extends GridTextBlockSimple { - public static final HtmlColorSetSimple colors = new HtmlColorSetSimple(); + public static final HColorSet colors = HColorSet.instance(); public static final int NETWORK_THIN = 5; @@ -83,7 +82,7 @@ private void drawGroups(UGraphic ug, DiagGroup group) { y += lineHeight; } if (size != null) { - HtmlColor color = group.getColor(); + HColor color = group.getColor(); if (color == null) { color = colors.getColorIfValid("#AAA"); } @@ -114,7 +113,7 @@ private void drawNetworkTube(final UGraphic ug) { rect.setDeltaShadow(1.0); UGraphic ug2 = ug.apply(new UTranslate(xmin, y)); if (network != null && network.getColor() != null) { - ug2 = ug2.apply(new UChangeBackColor(network.getColor())); + ug2 = ug2.apply(network.getColor().bg()); } ug2.draw(rect); y += lineHeight(stringBounder, i); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/GridTextBlockSimple.java b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/GridTextBlockSimple.java index 4e3aebccb..22e1f10b7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/GridTextBlockSimple.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/GridTextBlockSimple.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/LinkedElement.java b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/LinkedElement.java index fa6c4a1be..1cd4dc081 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/LinkedElement.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/LinkedElement.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,14 +34,13 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.MinMax; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.MathUtils; public class LinkedElement { @@ -86,8 +85,8 @@ public void drawMe(UGraphic ug, double width, double height) { drawCenter(ug, box, xMiddle, yMiddle); - final HtmlColor color = ColorParam.activityBorder.getDefaultValue(); - ug = ug.apply(new UChangeColor(color)); + final HColor color = ColorParam.activityBorder.getDefaultValue(); + ug = ug.apply(color); drawHLine(ug, xMiddle, GridTextBlockDecorated.NETWORK_THIN, y1); if (ad2 != null) { drawHLine(ug, xMiddle, y2, height); @@ -106,7 +105,7 @@ private void drawCenter(UGraphic ug, TextBlock block, double x, double y) { } private void drawHLine(UGraphic ug, double x, double y1, double y2) { - final ULine line = new ULine(0, y2 - y1); + final ULine line = ULine.vline(y2 - y1); ug.apply(new UTranslate(x, y1)).draw(line); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/Network.java b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/Network.java index 47e224de2..fb32406e1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/Network.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/Network.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,13 +33,13 @@ import java.util.LinkedHashMap; import java.util.Map; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Network { private final String name; private final Map localElements = new LinkedHashMap(); - private HtmlColor color; + private HColor color; private String ownAdress; @@ -88,11 +88,11 @@ public final String getName() { return name; } - public final HtmlColor getColor() { + public final HColor getColor() { return color; } - public final void setColor(HtmlColor color) { + public final void setColor(HColor color) { this.color = color; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java index 1e5aa4fc5..25b11c6b2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,6 +31,7 @@ package net.sourceforge.plantuml.nwdiag; import java.awt.geom.Dimension2D; +import java.awt.geom.Rectangle2D; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; @@ -41,9 +42,12 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import net.sourceforge.plantuml.AnnotatedWorker; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FileFormatOption; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.Scale; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; @@ -53,19 +57,22 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; +import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; +import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.ugraphic.ImageBuilder; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UEmpty; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class NwDiagram extends UmlDiagram { @@ -174,19 +181,47 @@ protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormat final Scale scale = getScale(); final double dpiFactor = scale == null ? 1 : scale.getScale(100, 100); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), dpiFactor, null, "", "", 0, 0, - null, false); - final UDrawable result = getUDrawable(); + final ISkinParam skinParam = getSkinParam(); + final int margin1; + final int margin2; + if (SkinParam.USE_STYLES()) { + margin1 = SkinParam.zeroMargin(0); + margin2 = SkinParam.zeroMargin(0); + } else { + margin1 = 0; + margin2 = 0; + } + final ImageBuilder imageBuilder = ImageBuilder.buildB(new ColorMapperIdentity(), false, + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, "", "", dpiFactor, null); + TextBlock result = getTextBlock(); + result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder()).addAdd(result); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormatOption, 0, os); } - private UDrawable getUDrawable() { - return new UDrawable() { + private TextBlockBackcolored getTextBlock() { + return new TextBlockBackcolored() { public void drawU(UGraphic ug) { drawMe(ug); } + + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) { + return null; + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return getTotalDimension(stringBounder); + } + + public MinMax getMinMax(StringBounder stringBounder) { + throw new UnsupportedOperationException(); + } + + public HColor getBackcolor() { + return null; + } + }; } @@ -200,11 +235,20 @@ private TextBlock toTextBlock(String name, String s) { private FontConfiguration getFontConfiguration() { final UFont font = UFont.serif(11); - return new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK, false); + return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); + } + + private Dimension2D getTotalDimension(StringBounder stringBounder) { + return TextBlockUtils.getMinMax(new UDrawable() { + public void drawU(UGraphic ug) { + drawMe(ug); + } + }, stringBounder, true).getDimension(); } + private final double margin = 5; + private void drawMe(UGraphic ug) { - final double margin = 5; ug = ug.apply(new UTranslate(margin, margin)); final StringBounder stringBounder = ug.getStringBounder(); @@ -249,13 +293,12 @@ private void drawMe(UGraphic ug) { } deltaX += 5; - grid.drawU(ug.apply(new UChangeColor(ColorParam.activityBorder.getDefaultValue())) - .apply(new UChangeBackColor(ColorParam.activityBackground.getDefaultValue())) - .apply(new UTranslate(deltaX, deltaY))); + grid.drawU(ug.apply(ColorParam.activityBorder.getDefaultValue()) + .apply(ColorParam.activityBackground.getDefaultValue().bg()).apply(new UTranslate(deltaX, deltaY))); final Dimension2D dimGrid = grid.calculateDimension(stringBounder); - ug.apply(new UTranslate(dimGrid.getWidth() + deltaX + margin, dimGrid.getHeight() + deltaY + margin)).draw( - new UEmpty(1, 1)); + ug.apply(new UTranslate(dimGrid.getWidth() + deltaX + margin, dimGrid.getHeight() + deltaY + margin)) + .draw(new UEmpty(1, 1)); } @@ -267,7 +310,7 @@ public CommandExecutionResult setProperty(String property, String value) { currentNetwork().setOwnAdress(value); } if ("color".equalsIgnoreCase(property)) { - final HtmlColor color = GridTextBlockDecorated.colors.getColorIfValid(value); + final HColor color = GridTextBlockDecorated.colors.getColorIfValid(value); if (currentGroup != null) { currentGroup.setColor(color); } else if (currentNetwork() != null) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/NwDiagramFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/NwDiagramFactory.java index bf5450ea9..1434f6c55 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/NwDiagramFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/nwdiag/NwDiagramFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/AbstractClassOrObjectDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/AbstractClassOrObjectDiagram.java index b1c034c54..b86b43f97 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/AbstractClassOrObjectDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/AbstractClassOrObjectDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -42,6 +42,7 @@ import net.sourceforge.plantuml.cucadiagram.GroupRoot; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; @@ -54,6 +55,16 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram public AbstractClassOrObjectDiagram(ISkinSimple orig) { super(orig); } + + @Override + public Ident cleanIdent(Ident ident) { + String codeString = ident.getName(); + if (codeString.startsWith("\"") && codeString.endsWith("\"")) { + return ident.eventuallyRemoveStartingAndEndingDoubleQuote("\""); + } + return ident; + } + final public boolean insertBetween(IEntity entity1, IEntity entity2, IEntity node) { final Link link = foundLink(entity1, entity2); @@ -100,20 +111,31 @@ public int getNbOfHozizontalLollipop(IEntity entity) { private final List associations = new ArrayList(); - public CommandExecutionResult associationClass(Code clName1A, Code clName1B, Code clName2A, Code clName2B, + public CommandExecutionResult associationClass(String name1A, String name1B, String name2A, String name2B, LinkType linkType, Display label) { - final IEntity entity1A = getOrCreateLeaf(clName1A, null, null); - final IEntity entity1B = getOrCreateLeaf(clName1B, null, null); - final IEntity entity2A = getOrCreateLeaf(clName2A, null, null); - final IEntity entity2B = getOrCreateLeaf(clName2B, null, null); + final Ident ident1A = buildLeafIdent(name1A); + final Ident ident1B = buildLeafIdent(name1B); + final Ident ident2A = buildLeafIdent(name2A); + final Ident ident2B = buildLeafIdent(name2B); + final Code code1A = this.V1972() ? ident1A : buildCode(name1A); + final Code code1B = this.V1972() ? ident1B : buildCode(name1B); + final Code code2A = this.V1972() ? ident2A : buildCode(name2A); + final Code code2B = this.V1972() ? ident2B : buildCode(name2B); + final IEntity entity1A = getOrCreateLeaf(ident1A, code1A, null, null); + final IEntity entity1B = getOrCreateLeaf(ident1B, code1B, null, null); + final IEntity entity2A = getOrCreateLeaf(ident2A, code2A, null, null); + final IEntity entity2B = getOrCreateLeaf(ident2B, code2B, null, null); final List same1 = getExistingAssociatedPoints(entity1A, entity1B); final List same2 = getExistingAssociatedPoints(entity2A, entity2B); if (same1.size() == 0 && same2.size() == 0) { - - final IEntity point1 = getOrCreateLeaf(UniqueSequence.getCode("apoint"), LeafType.POINT_FOR_ASSOCIATION, - null); - final IEntity point2 = getOrCreateLeaf(UniqueSequence.getCode("apoint"), LeafType.POINT_FOR_ASSOCIATION, - null); + final String tmp1 = UniqueSequence.getString("apoint"); + final String tmp2 = UniqueSequence.getString("apoint"); + final Ident ident1 = buildLeafIdent(tmp1); + final Ident ident2 = buildLeafIdent(tmp2); + final Code code1 = this.V1972() ? ident1 : buildCode(tmp1); + final Code code2 = this.V1972() ? ident2 : buildCode(tmp2); + final IEntity point1 = getOrCreateLeaf(ident1, code1, LeafType.POINT_FOR_ASSOCIATION, null); + final IEntity point2 = getOrCreateLeaf(ident2, code2, LeafType.POINT_FOR_ASSOCIATION, null); insertPointBetween(entity1A, entity1B, point1); insertPointBetween(entity2A, entity2B, point2); @@ -163,10 +185,14 @@ private void insertPointBetween(final IEntity entity1A, final IEntity entity1B, addLink(pointToEntity2); } - public boolean associationClass(int mode, Code clName1, Code clName2, IEntity associed, LinkType linkType, + public boolean associationClass(int mode, String name1, String name2, IEntity associed, LinkType linkType, Display label) { - final IEntity entity1 = getOrCreateLeaf(clName1, null, null); - final IEntity entity2 = getOrCreateLeaf(clName2, null, null); + final Ident ident1 = buildLeafIdent(name1); + final Ident ident2 = buildLeafIdent(name2); + final Code code1 = this.V1972() ? ident1 : buildCode(name1); + final Code code2 = this.V1972() ? ident2 : buildCode(name2); + final IEntity entity1 = getOrCreateLeaf(ident1, code1, null, null); + final IEntity entity2 = getOrCreateLeaf(ident2, code2, null, null); final List same = getExistingAssociatedPoints(entity1, entity2); if (same.size() > 1) { return false; @@ -213,7 +239,10 @@ public Association(int mode, IEntity entity1, IEntity entity2, IEntity associed) this.entity1 = entity1; this.entity2 = entity2; this.associed = associed; - point = getOrCreateLeaf(UniqueSequence.getCode("apoint"), LeafType.POINT_FOR_ASSOCIATION, null); + final String idShort = UniqueSequence.getString("apoint"); + final Ident ident = buildLeafIdent(idShort); + final Code code = AbstractClassOrObjectDiagram.this.V1972() ? ident : buildCode(idShort); + point = getOrCreateLeaf(ident, code, LeafType.POINT_FOR_ASSOCIATION, null); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/ObjectDiagramFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/ObjectDiagramFactory.java deleted file mode 100644 index e83f2163f..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/ObjectDiagramFactory.java +++ /dev/null @@ -1,110 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.objectdiagram; - -import java.util.ArrayList; -import java.util.List; - -import net.sourceforge.plantuml.ISkinSimple; -import net.sourceforge.plantuml.UmlDiagramType; -import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass; -import net.sourceforge.plantuml.classdiagram.command.CommandUrl; -import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.CommandEndPackage; -import net.sourceforge.plantuml.command.CommandFootboxIgnored; -import net.sourceforge.plantuml.command.CommandPackage; -import net.sourceforge.plantuml.command.CommandPage; -import net.sourceforge.plantuml.command.CommandRankDir; -import net.sourceforge.plantuml.command.UmlDiagramFactory; -import net.sourceforge.plantuml.command.note.FactoryNoteCommand; -import net.sourceforge.plantuml.command.note.FactoryNoteOnEntityCommand; -import net.sourceforge.plantuml.command.note.FactoryNoteOnLinkCommand; -import net.sourceforge.plantuml.command.regex.RegexLeaf; -import net.sourceforge.plantuml.objectdiagram.command.CommandAddData; -import net.sourceforge.plantuml.objectdiagram.command.CommandCreateEntityObject; -import net.sourceforge.plantuml.objectdiagram.command.CommandCreateEntityObjectMultilines; - -public class ObjectDiagramFactory extends UmlDiagramFactory { - - private final ISkinSimple skinParam; - - public ObjectDiagramFactory(ISkinSimple skinParam) { - this.skinParam = skinParam; - } - - @Override - protected List createCommands() { - - final List cmds = new ArrayList(); - cmds.add(new CommandFootboxIgnored()); - - addCommonCommands1(cmds); - cmds.add(new CommandRankDir()); - cmds.add(new CommandPage()); - cmds.add(new CommandAddData()); - cmds.add(new CommandLinkClass(UmlDiagramType.OBJECT)); - // - cmds.add(new CommandCreateEntityObject()); - final FactoryNoteCommand factoryNoteCommand = new FactoryNoteCommand(); - - cmds.add(factoryNoteCommand.createSingleLine()); - cmds.add(new CommandPackage()); - cmds.add(new CommandEndPackage()); - // addCommand(new CommandNamespace()); - // addCommand(new CommandEndNamespace()); - // addCommand(new CommandStereotype()); - // - // addCommand(new CommandImport()); - final FactoryNoteOnEntityCommand factoryNoteOnEntityCommand = new FactoryNoteOnEntityCommand("object", - new RegexLeaf("ENTITY", "([\\p{L}0-9_.]+|[%g][^%g]+[%g])")); - cmds.add(factoryNoteOnEntityCommand.createSingleLine()); - - cmds.add(new CommandUrl()); - - cmds.add(factoryNoteCommand.createMultiLine(false)); - cmds.add(factoryNoteOnEntityCommand.createMultiLine(true)); - cmds.add(factoryNoteOnEntityCommand.createMultiLine(false)); - cmds.add(new CommandCreateEntityObjectMultilines()); - - final FactoryNoteOnLinkCommand factoryNoteOnLinkCommand = new FactoryNoteOnLinkCommand(); - cmds.add(factoryNoteOnLinkCommand.createSingleLine()); - cmds.add(factoryNoteOnLinkCommand.createMultiLine(false)); - - // addCommand(new CommandNoopClass()); - return cmds; - - } - - @Override - public ObjectDiagram createEmptyDiagram() { - return new ObjectDiagram(skinParam); - } -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/command/CommandAddData.java b/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/command/CommandAddData.java index 646fc93be..45274aa9a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/command/CommandAddData.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/command/CommandAddData.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,7 +37,6 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram; import net.sourceforge.plantuml.skin.VisibilityModifier; @@ -60,13 +59,15 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location, RegexResult arg) { - final IEntity entity = diagram.getOrCreateLeaf(Code.of(arg.get("NAME", 0)), null, null); + final String name = arg.get("NAME", 0); + final IEntity entity = diagram.getOrCreateLeaf(diagram.buildLeafIdent(name), + diagram.buildCode(name), null, null); final String field = arg.get("DATA", 0); if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field)) { diagram.setVisibilityModifierPresent(true); } - entity.getBodier().addFieldOrMethod(field, entity); + entity.getBodier().addFieldOrMethod(field); return CommandExecutionResult.ok(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java b/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java index 4bcf9decb..351dd84e4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.color.ColorParser; @@ -72,13 +73,16 @@ private static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location, RegexResult arg) { - final Code code = Code.of(arg.get("NAME", 1)); + final String idShort = arg.get("NAME", 1); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); final String display = arg.get("NAME", 0); final String stereotype = arg.get("STEREO", 0); - if (diagram.leafExist(code)) { + final boolean leafExist = diagram.V1972() ? diagram.leafExistSmart(ident) : diagram.leafExist(code); + if (leafExist) { return CommandExecutionResult.error("Object already exists : " + code); } - final IEntity entity = diagram.createLeaf(code, Display.getWithNewlines(display), LeafType.OBJECT, null); + final IEntity entity = diagram.createLeaf(ident, code, Display.getWithNewlines(display), LeafType.OBJECT, null); if (stereotype != null) { entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram .getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam() @@ -94,5 +98,4 @@ protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); return CommandExecutionResult.ok(); } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java b/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java index 9087ea28b..ed9dff252 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.color.ColorParser; @@ -78,9 +79,10 @@ public String getPatternEnd() { return "(?i)^[%s]*\\}[%s]*$"; } + @Override protected CommandExecutionResult executeNow(AbstractClassOrObjectDiagram diagram, BlocLines lines) { - lines = lines.trim(true); - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + lines = lines.trim().removeEmptyLines(); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final IEntity entity = executeArg0(diagram, line0); if (entity == null) { return CommandExecutionResult.error("No such entity"); @@ -91,19 +93,22 @@ protected CommandExecutionResult executeNow(AbstractClassOrObjectDiagram diagram if (VisibilityModifier.isVisibilityCharacter(s.getString())) { diagram.setVisibilityModifierPresent(true); } - entity.getBodier().addFieldOrMethod(s.getString(), entity); + entity.getBodier().addFieldOrMethod(s.getString()); } return CommandExecutionResult.ok(); } private IEntity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) { - final Code code = Code.of(line0.get("NAME", 1)); + final String name = line0.get("NAME", 1); + final Ident ident = diagram.buildLeafIdent(name); + final Code code = diagram.V1972() ? ident : diagram.buildCode(name); final String display = line0.get("NAME", 0); final String stereotype = line0.get("STEREO", 0); - if (diagram.leafExist(code)) { - return diagram.getOrCreateLeaf(code, LeafType.OBJECT, null); + final boolean leafExist = diagram.V1972() ? diagram.leafExistSmart(ident) : diagram.leafExist(code); + if (leafExist) { + return diagram.getOrCreateLeaf(diagram.buildLeafIdent(name), code, LeafType.OBJECT, null); } - final IEntity entity = diagram.createLeaf(code, Display.getWithNewlines(display), LeafType.OBJECT, null); + final IEntity entity = diagram.createLeaf(ident, code, Display.getWithNewlines(display), LeafType.OBJECT, null); if (stereotype != null) { entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram .getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam() diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateMap.java b/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateMap.java new file mode 100644 index 000000000..4b75f8e58 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateMap.java @@ -0,0 +1,138 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.objectdiagram.command; + +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.StringLocated; +import net.sourceforge.plantuml.UrlBuilder; +import net.sourceforge.plantuml.command.BlocLines; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.CommandMultilines2; +import net.sourceforge.plantuml.command.MultilinesStrategy; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.BodierMap; +import net.sourceforge.plantuml.cucadiagram.Code; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.Ident; +import net.sourceforge.plantuml.cucadiagram.LeafType; +import net.sourceforge.plantuml.cucadiagram.Link; +import net.sourceforge.plantuml.cucadiagram.LinkDecor; +import net.sourceforge.plantuml.cucadiagram.LinkType; +import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram; + +public class CommandCreateMap extends CommandMultilines2 { + + public CommandCreateMap() { + super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE); + } + + private static IRegex getRegexConcat() { + return RegexConcat.build(CommandCreateMap.class.getName(), RegexLeaf.start(), // + new RegexLeaf("TYPE", "map"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("NAME", "(?:[%g]([^%g]+)[%g][%s]+as[%s]+)?([\\p{L}0-9_.]+)"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREO", "(\\<\\<.+\\>\\>)?"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // + RegexLeaf.spaceZeroOrMore(), // + ColorParser.exp1(), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("\\{"), // + RegexLeaf.end()); + } + + @Override + public String getPatternEnd() { + return "(?i)^[%s]*\\}[%s]*$"; + } + + @Override + protected CommandExecutionResult executeNow(AbstractClassOrObjectDiagram diagram, BlocLines lines) { + lines = lines.trim().removeEmptyLines(); + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); + final IEntity entity1 = executeArg0(diagram, line0); + if (entity1 == null) { + return CommandExecutionResult.error("No such entity"); + } + lines = lines.subExtract(1, 1); + for (StringLocated sl : lines) { + final String line = sl.getString(); + assert line.length() > 0; + entity1.getBodier().addFieldOrMethod(line); + if (BodierMap.getLinkedEntry(line) != null) { + final String linkStr = BodierMap.getLinkedEntry(line); + final int x = line.indexOf(linkStr); + final String key = line.substring(0, x).trim(); + final String dest = line.substring(x + linkStr.length()).trim(); + final Ident ident2 = diagram.buildLeafIdentSpecial(dest); + final ILeaf entity2 = diagram.getEntityFactory().getLeafStrict(ident2); + final LinkType linkType = new LinkType(LinkDecor.ARROW, LinkDecor.NONE); + final int length = linkStr.length() - 2; + final Link link = new Link(entity1, entity2, linkType, Display.NULL, length, + diagram.getSkinParam().getCurrentStyleBuilder()); + link.setPortMembers(key, null); + diagram.addLink(link); + } + } + return CommandExecutionResult.ok(); + } + + private IEntity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) { + final String name = line0.get("NAME", 1); + final Ident ident = diagram.buildLeafIdent(name); + final Code code = diagram.V1972() ? ident : diagram.buildCode(name); + final String display = line0.get("NAME", 0); + final String stereotype = line0.get("STEREO", 0); + final boolean leafExist = diagram.V1972() ? diagram.leafExistSmart(ident) : diagram.leafExist(code); + if (leafExist) { + return diagram.getOrCreateLeaf(diagram.buildLeafIdent(name), code, LeafType.MAP, null); + } + final IEntity entity = diagram.createLeaf(ident, code, Display.getWithNewlines(display), LeafType.MAP, null); + if (stereotype != null) { + entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), + diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), + diagram.getSkinParam().getIHtmlColorSet())); + } + entity.setSpecificColorTOBEREMOVED(ColorType.BACK, + diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0))); + return entity; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/Movement.java b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/Movement.java index bc2ba3c8e..338e113f2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/Movement.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/Movement.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/OpenIcon.java b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/OpenIcon.java index 000264eb3..a1adc2a69 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/OpenIcon.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/OpenIcon.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,7 +32,6 @@ import java.awt.geom.Dimension2D; import java.io.BufferedReader; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -42,12 +41,12 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.openiconic.data.DummyIcon; -import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class OpenIcon { @@ -96,8 +95,8 @@ private OpenIcon(InputStream is, String id) throws IOException { } } - void saveCopy(File fnew) throws IOException { - final PrintWriter pw = new PrintWriter(fnew); + void saveCopy(SFile fnew) throws IOException { + final PrintWriter pw = fnew.createPrintWriter(); pw.println(rawData.get(0)); pw.println(svgPath.toSvg()); pw.println(rawData.get(rawData.size() - 1)); @@ -127,10 +126,10 @@ private String getNumber(String s, String arg) { return s.substring(x1 + 1, x2); } - public TextBlock asTextBlock(final HtmlColor color, final double factor) { + public TextBlock asTextBlock(final HColor color, final double factor) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { - svgPath.drawMe(ug.apply(new UChangeColor(color)), factor); + svgPath.drawMe(ug.apply(color), factor); } public Dimension2D calculateDimension(StringBounder stringBounder) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/PSystemListOpenIconic.java b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/PSystemListOpenIconic.java index 6acc7b1f1..47ccf302a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/PSystemListOpenIconic.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/PSystemListOpenIconic.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,14 +43,14 @@ import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.donors.PSystemDonors; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockHorizontal; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.openiconic.data.DummyIcon; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemListOpenIconic extends AbstractPSystem { @@ -58,8 +58,8 @@ public class PSystemListOpenIconic extends AbstractPSystem { final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { final UDrawable result = getGraphicStrings(); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, - fileFormat.isWithMetadata() ? getMetadata() : null, null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), + false, null, fileFormat.isWithMetadata() ? getMetadata() : null, null, 1.0, HColorUtils.WHITE); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/PSystemListOpenIconicFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/PSystemListOpenIconicFactory.java index e836f3797..a4fe93033 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/PSystemListOpenIconicFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/PSystemListOpenIconicFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/PSystemOpenIconic.java b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/PSystemOpenIconic.java index c86b10d16..4943007c5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/PSystemOpenIconic.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/PSystemOpenIconic.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,11 +35,13 @@ import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.FileFormatOption; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemOpenIconic extends AbstractPSystem { @@ -57,14 +59,23 @@ final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatO final OpenIcon icon = OpenIcon.retrieve(iconName); // final Dimension2D dim = new Dimension2DDouble(100, 100); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, null, null, null, 5, 5, - null, false); - imageBuilder.setUDrawable(icon.asTextBlock(HtmlColorUtils.BLACK, factor)); + final int margin1; + final int margin2; + if (SkinParam.USE_STYLES()) { + margin1 = SkinParam.zeroMargin(5); + margin2 = SkinParam.zeroMargin(5); + } else { + margin1 = 5; + margin2 = 5; + } + final ImageBuilder imageBuilder = ImageBuilder.buildB(new ColorMapperIdentity(), false, ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), + null, null, null, 1.0, null); + imageBuilder.setUDrawable(icon.asTextBlock(HColorUtils.BLACK, factor)); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); // UGraphic2 ug = fileFormat.createUGraphic(dim); // ug = (UGraphic2) ug.apply(new UTranslate(10, 10)); - // // ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); + // // ug = ug.apply(UChangeColor.nnn(HtmlColorUtils.BLACK)); // // ug.draw(new URectangle(7, 6)); // icon.asTextBlock(HtmlColorUtils.BLACK, factor).drawU(ug); // ug.writeImageTOBEMOVED(os, null, 96); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/PSystemOpenIconicFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/PSystemOpenIconicFactory.java index fc047ed46..921269cf6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/PSystemOpenIconicFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/PSystemOpenIconicFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/StringDecipher.java b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/StringDecipher.java index 63780c7dd..b07c3c92d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/StringDecipher.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/StringDecipher.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgCommand.java index bb6f1312f..6db9c01a2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgCommand.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgCommandLetter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgCommandLetter.java index 7d29c9044..10e58dac3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgCommandLetter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgCommandLetter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgCommandNumber.java b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgCommandNumber.java index 4b9db31e0..bfb9c87a5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgCommandNumber.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgCommandNumber.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgPath.java b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgPath.java index 702fb0d22..b208d41b3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgPath.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgPath.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgPosition.java b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgPosition.java index 5541502b8..93ff92db4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgPosition.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/SvgPosition.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/data/DummyIcon.java b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/data/DummyIcon.java index 3e18efe2e..3036342f1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/data/DummyIcon.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/openiconic/data/DummyIcon.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/BasicGame.java b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/BasicGame.java index 1b9055f73..824c04c5a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/BasicGame.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/BasicGame.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/Keyboard.java b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/Keyboard.java index 22eba2b8a..e68d33476 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/Keyboard.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/Keyboard.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/KeyboardList.java b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/KeyboardList.java index 3429f0a6f..ea7b96b15 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/KeyboardList.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/KeyboardList.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/MagicTable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/MagicTable.java index 3f28aaa64..adfabf83b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/MagicTable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/MagicTable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/NoInputException.java b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/NoInputException.java index 87f58fcb8..8267ce1d1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/NoInputException.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/NoInputException.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/OregonBasicGame.java b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/OregonBasicGame.java index aaba023c9..77e4beab0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/OregonBasicGame.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/OregonBasicGame.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/PSystemOregon.java b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/PSystemOregon.java index c3554fe77..09b6d77b6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/PSystemOregon.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/PSystemOregon.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -42,8 +42,8 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemOregon extends AbstractPSystem { @@ -93,8 +93,8 @@ private Screen getScreen() { final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { final TextBlockBackcolored result = getGraphicStrings(); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, result.getBackcolor(), - getMetadata(), null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), + false, null, getMetadata(), null, 1.0, result.getBackcolor()); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/PSystemOregonFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/PSystemOregonFactory.java index 5e60bf132..e7914788b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/PSystemOregonFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/PSystemOregonFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/Screen.java b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/Screen.java index 083abb512..c9af9aac0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/Screen.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/Screen.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/SecureCoder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/SecureCoder.java index 6a4b1b6c2..eb1629c95 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/SecureCoder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/SecureCoder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/SmartKeyboard.java b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/SmartKeyboard.java index 70108b284..d21eb15ce 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/SmartKeyboard.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/oregon/SmartKeyboard.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/pdf/PdfConverter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/pdf/PdfConverter.java index aac739171..5a46e81a9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/pdf/PdfConverter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/pdf/PdfConverter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/png/Metadata.java b/src/plantuml-asl/src/net/sourceforge/plantuml/png/Metadata.java index 657f1c3dc..44de1f732 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/png/Metadata.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/png/Metadata.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,11 +30,9 @@ */ package net.sourceforge.plantuml.png; -import java.io.File; import java.io.IOException; import java.util.Iterator; -import javax.imageio.ImageIO; import javax.imageio.ImageReader; import javax.imageio.metadata.IIOMetadata; import javax.imageio.stream.ImageInputStream; @@ -42,17 +40,20 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; +import net.sourceforge.plantuml.security.ImageIO; +import net.sourceforge.plantuml.security.SFile; + public class Metadata { public static void main(String[] args) throws IOException { final Metadata meta = new Metadata(); final int length = args.length; for (int i = 0; i < length; i++) { - meta.readAndDisplayMetadata(new File(args[i])); + meta.readAndDisplayMetadata(new SFile(args[i])); } } - public void readAndDisplayMetadata(File file) throws IOException { + public void readAndDisplayMetadata(SFile file) throws IOException { final ImageInputStream iis = ImageIO.createImageInputStream(file); final Iterator readers = ImageIO.getImageReaders(iis); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/png/MetadataTag.java b/src/plantuml-asl/src/net/sourceforge/plantuml/png/MetadataTag.java index 0ee607631..227cb6989 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/png/MetadataTag.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/png/MetadataTag.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,12 +30,11 @@ */ package net.sourceforge.plantuml.png; -import java.io.File; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Iterator; -import javax.imageio.ImageIO; import javax.imageio.ImageReader; import javax.imageio.metadata.IIOMetadata; import javax.imageio.stream.ImageInputStream; @@ -43,12 +42,20 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; +import net.sourceforge.plantuml.security.ImageIO; +import net.sourceforge.plantuml.security.SFile; + public class MetadataTag { private final Object source; private final String tag; - public MetadataTag(File file, String tag) { + public MetadataTag(SFile file, String tag) throws FileNotFoundException { + this.source = file.conv(); + this.tag = tag; + } + + public MetadataTag(java.io.File file, String tag) { this.source = file; this.tag = tag; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngFlashcoder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngFlashcoder.java index fdf10d85d..c26cf1b74 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngFlashcoder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngFlashcoder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngIO.java b/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngIO.java index 82cd140f3..f580050f8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngIO.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngIO.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,21 +31,18 @@ package net.sourceforge.plantuml.png; import java.awt.image.RenderedImage; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; -import javax.imageio.ImageIO; - import net.sourceforge.plantuml.Log; +import net.sourceforge.plantuml.security.ImageIO; +import net.sourceforge.plantuml.security.SFile; public class PngIO { private static final String copyleft = "Generated by http://plantuml.com"; - public static void write(RenderedImage image, File file, int dpi) throws IOException { + public static void write(RenderedImage image, SFile file, int dpi) throws IOException { write(image, file, null, dpi); } @@ -53,10 +50,10 @@ public static void write(RenderedImage image, OutputStream os, int dpi) throws I write(image, os, null, dpi); } - public static void write(RenderedImage image, File file, String metadata, int dpi) throws IOException { + public static void write(RenderedImage image, SFile file, String metadata, int dpi) throws IOException { OutputStream os = null; try { - os = new BufferedOutputStream(new FileOutputStream(file)); + os = file.createBufferedOutputStream(); write(image, os, metadata, dpi); } finally { if (os != null) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngIOMetadata.java b/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngIOMetadata.java index fae1a40b5..79918aea9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngIOMetadata.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngIOMetadata.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,14 +36,14 @@ import java.util.Iterator; import javax.imageio.IIOImage; -import javax.imageio.ImageIO; import javax.imageio.ImageWriter; import javax.imageio.stream.ImageOutputStream; -import net.sourceforge.plantuml.Log; - import com.sun.imageio.plugins.png.PNGMetadata; +import net.sourceforge.plantuml.Log; +import net.sourceforge.plantuml.security.ImageIO; + public class PngIOMetadata { private static final String copyleft = "Generated by http://plantuml.com"; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngRotation.java b/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngRotation.java index b3329e2ad..a7247095b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngRotation.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngRotation.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngSegment.java b/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngSegment.java index 993f4c79b..35b4ead33 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngSegment.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngSegment.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngSizer.java b/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngSizer.java index ddc3c9f7f..e13fb636f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngSizer.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngSizer.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngSplitter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngSplitter.java index b5ed69caf..bc88ff2f2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngSplitter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngSplitter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,21 +32,20 @@ import java.awt.Graphics2D; import java.awt.image.BufferedImage; -import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import javax.imageio.ImageIO; - import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.SplitParam; import net.sourceforge.plantuml.SuggestedFile; +import net.sourceforge.plantuml.security.ImageIO; +import net.sourceforge.plantuml.security.SFile; public class PngSplitter { - private final List files = new ArrayList(); + private final List files = new ArrayList(); public PngSplitter(SuggestedFile pngFile, int horizontalPages, int verticalPages, String source, int dpi, boolean isWithMetadata, SplitParam splitParam) throws IOException { @@ -56,7 +55,7 @@ public PngSplitter(SuggestedFile pngFile, int horizontalPages, int verticalPages } Log.info("Splitting " + horizontalPages + " x " + verticalPages); - final File full = pngFile.getTmpFile(); // new File(pngFile.getParentFile(), pngFile.getName() + ".tmp"); + final SFile full = pngFile.getTmpFile(); // SecurityUtils.File(pngFile.getParentFile(), pngFile.getName() + ".tmp"); // Thread.yield(); full.delete(); // Thread.yield(); @@ -75,7 +74,7 @@ public PngSplitter(SuggestedFile pngFile, int horizontalPages, int verticalPages int x = 0; for (int i = 0; i < horizontalPages; i++) { for (int j = 0; j < verticalPages; j++) { - final File f = pngFile.getFile(x++); + final SFile f = pngFile.getFile(x++); this.files.add(f); final int width = horizontalSegment.getLen(i); final int height = verticalSegment.getLen(j); @@ -111,7 +110,7 @@ public PngSplitter(SuggestedFile pngFile, int horizontalPages, int verticalPages Log.info("End of splitting"); } - public List getFiles() { + public List getFiles() { return Collections.unmodifiableList(files); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngTitler.java b/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngTitler.java index ed908659c..dadf95510 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngTitler.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/png/PngTitler.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,34 +34,33 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ISkinSimple; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.DisplaySection; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class PngTitler { - private final HtmlColor textColor; - private final HtmlColor hyperlinkColor; + private final HColor textColor; + private final HColor hyperlinkColor; private final DisplaySection text; private final int fontSize; private final String fontFamily; private final boolean useUnderlineForHyperlink; private final Style style; - private final IHtmlColorSet set; + private final HColorSet set; private final ISkinSimple spriteContainer; - public PngTitler(HtmlColor textColor, DisplaySection text, int fontSize, String fontFamily, - HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink, Style style, IHtmlColorSet set, + public PngTitler(HColor textColor, DisplaySection text, int fontSize, String fontFamily, + HColor hyperlinkColor, boolean useUnderlineForHyperlink, Style style, HColorSet set, ISkinSimple spriteContainer) { this.style = style; this.set = set; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/AbstractEntityImage2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/AbstractEntityImage2.java index 8bf2c2b1a..0789f9901 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/AbstractEntityImage2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/AbstractEntityImage2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,10 +36,10 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.IEntity; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; abstract class AbstractEntityImage2 implements IEntityImageBlock { @@ -66,11 +66,11 @@ protected UFont getFont(FontParam fontParam) { return skinParam.getFont(null, false, fontParam); } - protected HtmlColor getFontColor(FontParam fontParam) { + protected HColor getFontColor(FontParam fontParam) { return skinParam.getFontHtmlColor(null, fontParam); } - protected final HtmlColor getColor(ColorParam colorParam) { + protected final HColor getColor(ColorParam colorParam) { return rose.getHtmlColor(skinParam, colorParam); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/BezierUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/BezierUtils.java index a89a0a507..53e54be7a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/BezierUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/BezierUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Block.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Block.java index 300df1059..b904c551e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Block.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Block.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Cluster.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Cluster.java index 82f719d6a..ccb1d7980 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Cluster.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Cluster.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Clusterable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Clusterable.java index 03e880427..24814366e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Clusterable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Clusterable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Decor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Decor.java index c284fecc9..ff94d2ee5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Decor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Decor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/DecorInterfaceProvider.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/DecorInterfaceProvider.java index f7cca23b0..f2fbb0de8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/DecorInterfaceProvider.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/DecorInterfaceProvider.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/DotPath.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/DotPath.java index 46dc77260..96ba5dc51 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/DotPath.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/DotPath.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,9 +40,11 @@ import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; import net.sourceforge.plantuml.EnsureVisible; import net.sourceforge.plantuml.asciiart.BasicCharArea; @@ -163,6 +165,29 @@ public Point2D getStartPoint() { return beziers.get(0).getP1(); } + public Set sample() { + final Set result = new HashSet(); + for (CubicCurve2D.Double bez : beziers) { + sample(bez, result); + } + return Collections.unmodifiableSet(result); + } + + private static void sample(CubicCurve2D bez, Set result) { + final Point2D p1 = bez.getCtrlP1(); + final Point2D p2 = bez.getCtrlP2(); + if (bez.getFlatnessSq() > 0.5 || p1.distance(p2) > 4) { + final CubicCurve2D.Double left = new CubicCurve2D.Double(); + final CubicCurve2D.Double right = new CubicCurve2D.Double(); + bez.subdivide(left, right); + sample(left, result); + sample(right, result); + } else { + result.add(p1); + result.add(p2); + } + } + public PointAndAngle getMiddle() { Point2D result = null; double angle = 0; @@ -356,8 +381,8 @@ private PointDirected getIntersection(ClusterPosition position) { public void draw(Graphics2D g2d, double x, double y) { final GeneralPath p = new GeneralPath(); for (CubicCurve2D.Double bez : beziers) { - bez = new CubicCurve2D.Double(x + bez.x1, y + bez.y1, x + bez.ctrlx1, y + bez.ctrly1, x + bez.ctrlx2, y - + bez.ctrly2, x + bez.x2, y + bez.y2); + bez = new CubicCurve2D.Double(x + bez.x1, y + bez.y1, x + bez.ctrlx1, y + bez.ctrly1, x + bez.ctrlx2, + y + bez.ctrly2, x + bez.x2, y + bez.y2); p.append(bez, true); } g2d.draw(p); @@ -374,8 +399,8 @@ public void manageEnsureVisible(double x, double y, EnsureVisible visible) { public void drawOk(EpsGraphics eps, double x, double y) { // boolean first = true; for (CubicCurve2D.Double bez : beziers) { - bez = new CubicCurve2D.Double(x + bez.x1, y + bez.y1, x + bez.ctrlx1, y + bez.ctrly1, x + bez.ctrlx2, y - + bez.ctrly2, x + bez.x2, y + bez.y2); + bez = new CubicCurve2D.Double(x + bez.x1, y + bez.y1, x + bez.ctrlx1, y + bez.ctrly1, x + bez.ctrlx2, + y + bez.ctrly2, x + bez.x2, y + bez.y2); eps.epsLine(bez.x1, bez.y1, bez.x2, bez.y2); } } @@ -385,8 +410,8 @@ public void draw(EpsGraphics eps, double x, double y) { final boolean dashed = false; boolean first = true; for (CubicCurve2D.Double bez : beziers) { - bez = new CubicCurve2D.Double(x + bez.x1, y + bez.y1, x + bez.ctrlx1, y + bez.ctrly1, x + bez.ctrlx2, y - + bez.ctrly2, x + bez.x2, y + bez.y2); + bez = new CubicCurve2D.Double(x + bez.x1, y + bez.y1, x + bez.ctrlx1, y + bez.ctrly1, x + bez.ctrlx2, + y + bez.ctrly2, x + bez.x2, y + bez.y2); if (first) { eps.movetoNoMacro(bez.x1, bez.y1); first = dashed; @@ -499,14 +524,14 @@ public void draw(BasicCharArea area, double pixelXPerChar, double pixelYPerChar) area.drawHLine('-', (int) (bez.y1 / pixelYPerChar), (int) (bez.x1 / pixelXPerChar), (int) (bez.x2 / pixelXPerChar)); } /* - * else { throw new UnsupportedOperationException("bez=" + toString(bez)); } - */ + * else { throw new UnsupportedOperationException("bez=" + toString(bez)); } + */ } } static String toString(CubicCurve2D.Double c) { - return "(" + c.x1 + "," + c.y1 + ") " + "(" + c.ctrlx1 + "," + c.ctrly1 + ") " + "(" + c.ctrlx2 + "," - + c.ctrly2 + ") " + "(" + c.x2 + "," + c.y2 + ") "; + return "(" + c.x1 + "," + c.y1 + ") " + "(" + c.ctrlx1 + "," + c.ctrly1 + ") " + "(" + c.ctrlx2 + "," + c.ctrly2 + + ") " + "(" + c.x2 + "," + c.y2 + ") "; } @@ -521,8 +546,8 @@ public String toString() { } public static CubicCurve2D.Double reverse(CubicCurve2D curv) { - return new CubicCurve2D.Double(curv.getX2(), curv.getY2(), curv.getCtrlX2(), curv.getCtrlY2(), - curv.getCtrlX1(), curv.getCtrlY1(), curv.getX1(), curv.getY1()); + return new CubicCurve2D.Double(curv.getX2(), curv.getY2(), curv.getCtrlX2(), curv.getCtrlY2(), curv.getCtrlX1(), + curv.getCtrlY1(), curv.getX1(), curv.getY1()); } public DotPath reverse() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/DotxMaker.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/DotxMaker.java index efad447df..7829586ec 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/DotxMaker.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/DotxMaker.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/EntityImageNote2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/EntityImageNote2.java index e8c6ae0ad..09e701265 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/EntityImageNote2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/EntityImageNote2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Frame.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Frame.java index adc3fe59f..4b2fdbb0b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Frame.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Frame.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,7 +37,6 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.Area; @@ -45,15 +44,15 @@ import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.style.StyleDefinition; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; 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.HColorNone; public class Frame implements Component { @@ -61,7 +60,7 @@ public Style[] getUsedStyles() { throw new UnsupportedOperationException(); } - public StyleDefinition getDefaultStyleDefinition() { + public StyleSignature getDefaultStyleDefinition() { throw new UnsupportedOperationException(); } @@ -77,9 +76,9 @@ public Frame(List name, ISkinParam skinParam) { public void drawU(UGraphic ug, Area area, Context2D context) { final Dimension2D dimensionToUse = area.getDimensionToUse(); - final HtmlColor lineColor = rose.getHtmlColor(skinParam, ColorParam.packageBorder); - ug = ug.apply(new UChangeColor(lineColor)); - ug = ug.apply(new UChangeBackColor(null)); + final HColor lineColor = rose.getHtmlColor(skinParam, ColorParam.packageBorder); + ug = ug.apply(lineColor); + ug = ug.apply(new HColorNone().bg()); ug.apply(new UStroke(1.4)).draw(new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight())); final TextBlock textBlock = createTextBloc(); @@ -115,7 +114,7 @@ public Dimension2D getTextDim(StringBounder stringBounder) { private TextBlock createTextBloc() { final UFont font = skinParam.getFont(null, false, FontParam.PACKAGE); - final HtmlColor textColor = skinParam.getFontHtmlColor(null, FontParam.PACKAGE); + final HColor textColor = skinParam.getFontHtmlColor(null, FontParam.PACKAGE); // final TextBlock bloc = Display.create(name).create(new FontConfiguration(font, textColor, // skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink()), HorizontalAlignment.LEFT, new // SpriteContainerEmpty()); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/GraphvizSolverB.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/GraphvizSolverB.java index 127b1646e..49ca5e649 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/GraphvizSolverB.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/GraphvizSolverB.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,10 +32,7 @@ import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; -import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Collection; @@ -47,6 +44,7 @@ import net.sourceforge.plantuml.cucadiagram.dot.Graphviz; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; import net.sourceforge.plantuml.cucadiagram.dot.ProcessState; +import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.svek.MinFinder; import net.sourceforge.plantuml.svek.SvgResult; import net.sourceforge.plantuml.svek.YDelta; @@ -54,10 +52,10 @@ public class GraphvizSolverB { // static private void traceDotString(String dotString) throws IOException { - // final File f = new File("dottmpfile" + UniqueSequence.getValue() + ".tmp"); + // final File f = SecurityUtils.File("dottmpfile" + UniqueSequence.getValue() + ".tmp"); // PrintWriter pw = null; // try { - // pw = new PrintWriter(new FileWriter(f)); + // pw = SecurityUtils.PrintWriter(new FileWriter(f)); // pw.print(dotString); // Log.info("Creating file " + f); // } finally { @@ -68,10 +66,10 @@ public class GraphvizSolverB { // } // // static private void traceSvgString(String svg) throws IOException { - // final File f = new File("svgtmpfile" + UniqueSequence.getValue() + ".svg"); + // final File f = SecurityUtils.File("svgtmpfile" + UniqueSequence.getValue() + ".svg"); // PrintWriter pw = null; // try { - // pw = new PrintWriter(new FileWriter(f)); + // pw = SecurityUtils.PrintWriter(new FileWriter(f)); // pw.print(svg); // Log.info("Creating file " + f); // } finally { @@ -92,7 +90,7 @@ public Dimension2D solve(Cluster root, Collection paths) throws IOExceptio // Log.println("dotString=" + dotString); - // exportPng(dotString, new File("png", "test1.png")); + // exportPng(dotString, SecurityUtils.File("png", "test1.png")); final Graphviz graphviz = GraphvizUtils.create(null, dotString, "svg"); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -217,9 +215,9 @@ static private double getMinY(List points) { return result; } - private void exportPng(final String dotString, File f) throws IOException { + private void exportPng(final String dotString, SFile f) throws IOException { final Graphviz graphviz = GraphvizUtils.create(null, dotString, "png"); - final OutputStream os = new BufferedOutputStream(new FileOutputStream(f)); + final OutputStream os = f.createBufferedOutputStream(); final ProcessState state = graphviz.createFile3(os); os.close(); if (state.differs(ProcessState.TERMINATED_OK())) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/IEntityImageBlock.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/IEntityImageBlock.java index 420a60a42..68856532b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/IEntityImageBlock.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/IEntityImageBlock.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Label.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Label.java index 4a2f5ca13..da0d4ead0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Label.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Label.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/LabelImage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/LabelImage.java index 4398170d5..f7b7c417e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/LabelImage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/LabelImage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/LineRectIntersection.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/LineRectIntersection.java index d0feb1a14..e143bd051 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/LineRectIntersection.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/LineRectIntersection.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/LineSegmentIntersection.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/LineSegmentIntersection.java index 6efe510a9..7fe383a8e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/LineSegmentIntersection.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/LineSegmentIntersection.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/MargedBlock.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/MargedBlock.java index 6d1ab03d0..6e86f9fc7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/MargedBlock.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/MargedBlock.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Mirror.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Mirror.java index 6bc902f1d..e16b0ac01 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Mirror.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Mirror.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Moveable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Moveable.java index 6784637c0..a21fe812d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Moveable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Moveable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Path.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Path.java index fb3c67940..da8583891 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Path.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Path.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,18 +37,20 @@ public class Path { private final Block end; private final int length; private DotPath dotPath; + private final boolean invis; public Path(Block start, Block end, Label label) { - this(start, end, label, 2); + this(start, end, label, 2, false); } - public Path(Block start, Block end, Label label, int length) { + public Path(Block start, Block end, Label label, int length, boolean invis) { if (start == null || end == null) { throw new IllegalArgumentException(); } if (length < 1) { throw new IllegalArgumentException("length=" + length); } + this.invis = invis; this.start = start; this.end = end; this.label = label; @@ -90,4 +92,8 @@ public int getLength() { return length; } + public final boolean isInvis() { + return invis; + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/PathDrawer.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/PathDrawer.java index 1213a4651..c8a7b27f6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/PathDrawer.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/PathDrawer.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/PathDrawerInterface.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/PathDrawerInterface.java index ee6c66d67..8575a8d95 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/PathDrawerInterface.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/PathDrawerInterface.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,8 +40,6 @@ import net.sourceforge.plantuml.cucadiagram.LinkStyle; import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.skin.rose.Rose; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; @@ -128,14 +126,14 @@ public void drawPathAfter(UGraphic ug, Positionable start, Positionable end, Pat // final Map all = dotPath.somePoints(); // final Point2D p = getFarest(outPoint, inPoint, all.keySet()); // -// ug = ug.apply(new UChangeBackColor(rose.getHtmlColor(param, ColorParam.background))); -// ug = ug.apply(new UChangeColor(rose.getHtmlColor(param, ColorParam.classBorder))); +// ug = ug.apply(UChangeBackColor.nnn(rose.getHtmlColor(param, ColorParam.background))); +// ug = ug.apply(UChangeColor.nnn(rose.getHtmlColor(param, ColorParam.classBorder))); // // decor.drawDecor(ug, p, all.get(p)); // } throw new UnsupportedOperationException(); -// ug = ug.apply(new UChangeColor(rose.getHtmlColor(param, ColorParam.classBorder))); +// ug = ug.apply(UChangeColor.nnn(rose.getHtmlColor(param, ColorParam.classBorder))); // if (linkType.isDashed()) { // goDash(ug); // } @@ -211,8 +209,8 @@ private static Point2D getFarest(Point2D p1, Point2D p2, Collection all } private Point2D drawSquare(UGraphic ug, double centerX, double centerY) { - ug = ug.apply(new UChangeBackColor(rose.getHtmlColor(param, ColorParam.classBackground))); - ug = ug.apply(new UChangeColor(rose.getHtmlColor(param, ColorParam.classBorder))); + ug = ug.apply(rose.getHtmlColor(param, ColorParam.classBackground).bg()); + ug = ug.apply(rose.getHtmlColor(param, ColorParam.classBorder)); final double width = 10; final double height = 10; ug.apply(new UTranslate(centerX - width / 2, centerY - height / 2)).draw(new URectangle(width, height)); @@ -220,8 +218,8 @@ private Point2D drawSquare(UGraphic ug, double centerX, double centerY) { } Point2D drawExtends(UGraphic ug, double x, double y, double theta) { - ug = ug.apply(new UChangeBackColor(rose.getHtmlColor(param, ColorParam.background))); - ug = ug.apply(new UChangeColor(rose.getHtmlColor(param, ColorParam.classBorder))); + ug = ug.apply(rose.getHtmlColor(param, ColorParam.background).bg()); + ug = ug.apply(rose.getHtmlColor(param, ColorParam.classBorder)); // final double theta = Math.atan2(-pathPoint.getX() + x, // pathPoint.getY() - y); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Positionable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Positionable.java index ea70a4f6f..695bc862a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Positionable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Positionable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/PositionableImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/PositionableImpl.java index 1d1597409..a67fdc227 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/PositionableImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/PositionableImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/PositionableUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/PositionableUtils.java index f26908521..fe1690c3e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/PositionableUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/PositionableUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Racorder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Racorder.java index 91a51d28a..9a2e0d6dd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Racorder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/Racorder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderAbstract.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderAbstract.java index 6c628a504..65f2e9b3a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderAbstract.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderAbstract.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeante.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeante.java index 34a024610..6bf5b82cd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeante.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeante.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeanteOld.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeanteOld.java index 26d9baa73..94e1c9cf3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeanteOld.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderFollowTangeanteOld.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderInToCenter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderInToCenter.java index 0401612b4..287f95df9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderInToCenter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderInToCenter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderOrthogonal.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderOrthogonal.java index 3b77d4bed..9a872534d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderOrthogonal.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/RacorderOrthogonal.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/SimpleDrawer.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/SimpleDrawer.java index d0415af15..c3e591638 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/SimpleDrawer.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/SimpleDrawer.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/TwoLinesIntersection.java b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/TwoLinesIntersection.java index d86056400..7e5735bd0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/TwoLinesIntersection.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/posimo/TwoLinesIntersection.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/Area.java b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/Area.java index d39ebac53..5379d4bac 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/Area.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/Area.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/AreaLayout.java b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/AreaLayout.java index 710a79dc3..e8b81629a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/AreaLayout.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/AreaLayout.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/AreaLayoutFixedWidth.java b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/AreaLayoutFixedWidth.java index 80a0e1969..964b5434d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/AreaLayoutFixedWidth.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/AreaLayoutFixedWidth.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/CommandCreatePostIt.java b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/CommandCreatePostIt.java index ec7baa6e8..541e10268 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/CommandCreatePostIt.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/CommandCreatePostIt.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/CommandWidth.java b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/CommandWidth.java index 1dc43891c..8d8326547 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/CommandWidth.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/CommandWidth.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/Elastic.java b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/Elastic.java index 2dfd564ce..69eda8407 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/Elastic.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/Elastic.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/PostIdDiagramFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/PostIdDiagramFactory.java index ccdc6c2e0..a713c579a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/PostIdDiagramFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/PostIdDiagramFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/PostIt.java b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/PostIt.java index 123b85458..345bd4ac1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/PostIt.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/PostIt.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,9 +39,6 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.Area; @@ -51,6 +48,9 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PostIt { @@ -105,12 +105,12 @@ public void drawU(UGraphic ug) { } private Component getComponent() { - final HtmlColor noteBackgroundColor = new HtmlColorSetSimple().getColorIfValid("#FBFB77"); - final HtmlColor borderColor = HtmlColorUtils.MY_RED; + final HColor noteBackgroundColor = HColorSet.instance().getColorIfValid("#FBFB77"); + final HColor borderColor = HColorUtils.MY_RED; final SkinParam param = SkinParam.noShadowing(null); final UFont fontNote = param.getFont(null, false, FontParam.NOTE); - final FontConfiguration font2 = fontNote.toFont2(HtmlColorUtils.BLACK, true, HtmlColorUtils.BLUE, 8); + final FontConfiguration font2 = fontNote.toFont2(HColorUtils.BLACK, true, HColorUtils.BLUE, 8); final ComponentRoseNote note = new ComponentRoseNote( null, new SymbolContext(noteBackgroundColor, borderColor).withStroke(new UStroke()), font2, text, 0, 0, new SpriteContainerEmpty(), 0, HorizontalAlignment.LEFT); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/PostItDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/PostItDiagram.java index 7824c6c90..7e01f0b1a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/postit/PostItDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/postit/PostItDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -48,8 +48,8 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.png.PngIO; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.eps.UGraphicEps; import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d; import net.sourceforge.plantuml.ugraphic.svg.UGraphicSvg; @@ -111,11 +111,11 @@ void drawU(UGraphic ug) { private UGraphic createImage(FileFormatOption fileFormatOption) { final Color backColor = getSkinParam().getColorMapper() - .getMappedColor(this.getSkinParam().getBackgroundColor()); + .toColor(this.getSkinParam().getBackgroundColor(false)); final FileFormat fileFormat = fileFormatOption.getFileFormat(); if (fileFormat == FileFormat.PNG) { final double height = getDefaultArea().heightWhenWidthIs(width, fileFormatOption.getDefaultStringBounder()); - final EmptyImageBuilder builder = new EmptyImageBuilder(width, height, backColor); + final EmptyImageBuilder builder = new EmptyImageBuilder(fileFormatOption.getWatermark(), width, height, backColor); final Graphics2D graphics2D = builder.getGraphics2D(); final double dpiFactor = this.getScaleCoef(fileFormatOption); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Define.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Define.java index 077563e7b..0be7e741f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Define.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Define.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,6 +37,7 @@ import net.sourceforge.plantuml.AParentFolder; import net.sourceforge.plantuml.BackSlash; +import net.sourceforge.plantuml.tim.expression.TValue; public class Define { @@ -117,4 +118,7 @@ public final String getFunctionName() { return signature.getFonctionName(); } + public TValue asTVariable() { + return TValue.fromString(definition); + } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/DefineSignature.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/DefineSignature.java index 5cf3e0b49..19cc4c827 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/DefineSignature.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/DefineSignature.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/DefineVariable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/DefineVariable.java index 3457290d4..f8bc1f537 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/DefineVariable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/DefineVariable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Defines.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Defines.java index aa4ffb2a7..8a45263f8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Defines.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Defines.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,7 +30,6 @@ */ package net.sourceforge.plantuml.preproc; -import java.io.File; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; @@ -40,6 +39,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -47,13 +47,18 @@ import net.sourceforge.plantuml.AParentFolder; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.api.ApiWarning; +import net.sourceforge.plantuml.security.SFile; +import net.sourceforge.plantuml.security.SecurityProfile; +import net.sourceforge.plantuml.security.SecurityUtils; +import net.sourceforge.plantuml.tim.EaterException; +import net.sourceforge.plantuml.tim.TMemory; +import net.sourceforge.plantuml.tim.TVariableScope; import net.sourceforge.plantuml.version.Version; public class Defines implements Truth { private final Map environment = new LinkedHashMap(); private final Map values = new LinkedHashMap(); - private final Map savedState = new LinkedHashMap(); @Deprecated @ApiWarning(willBeRemoved = "in next major release") @@ -70,6 +75,15 @@ public static Defines createEmpty() { return new Defines(); } + public void copyTo(TMemory memory) throws EaterException { + for (Entry ent : values.entrySet()) { + final String name = ent.getKey(); + final Define def = ent.getValue(); + memory.putVariable(name, def.asTVariable(), TVariableScope.GLOBAL); + } + + } + public void overrideFilename(String filename) { if (filename != null) { environment.put("filename", filename); @@ -89,19 +103,42 @@ public Defines cloneMe() { return result; } - public static Defines createWithFileName(File file) { + public static Defines createWithFileName(SFile file) { if (file == null) { throw new IllegalArgumentException(); } final Defines result = createEmpty(); result.overrideFilename(file.getName()); result.environment.put("filedate", new Date(file.lastModified()).toString()); - // result.environment.put("filename", file.getName()); - // result.environment.put("filenameNoExtension", nameNoExtension(file)); - result.environment.put("dirpath", file.getAbsoluteFile().getParentFile().getAbsolutePath().replace('\\', '/')); + if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) { + result.environment.put("dirpath", + file.getAbsoluteFile().getParentFile().getAbsolutePath().replace('\\', '/')); + } return result; } - + + public static Defines createWithFileName(java.io.File file) { + if (file == null) { + throw new IllegalArgumentException(); + } + final Defines result = createEmpty(); + result.overrideFilename(file.getName()); + result.environment.put("filedate", new Date(file.lastModified()).toString()); + if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) { + result.environment.put("dirpath", + file.getAbsoluteFile().getParentFile().getAbsolutePath().replace('\\', '/')); + } + return result; + } + + public static Defines createWithMap(Map init) { + final Defines result = createEmpty(); + for (Map.Entry ent : init.entrySet()) { + result.environment.put(ent.getKey(), ent.getValue()); + } + return result; + } + public String getEnvironmentValue(String key) { return this.environment.get(key); } @@ -233,15 +270,4 @@ private String manageDate(String line) { return line; } - public void saveState1() { - this.savedState.putAll(values); - - } - - public void restoreState1() { - this.values.clear(); - this.values.putAll(savedState); - magic = null; - } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/EvalBoolean.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/EvalBoolean.java index b05dfb456..18663efba 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/EvalBoolean.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/EvalBoolean.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/EvalMath.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/EvalMath.java index 70625a092..32d462873 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/EvalMath.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/EvalMath.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/FileWithSuffix.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/FileWithSuffix.java index 3696a36cb..b1bed678d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/FileWithSuffix.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/FileWithSuffix.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,6 +31,7 @@ package net.sourceforge.plantuml.preproc; import java.io.File; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -44,6 +45,7 @@ import net.sourceforge.plantuml.AFileRegular; import net.sourceforge.plantuml.AParentFolder; import net.sourceforge.plantuml.Log; +import net.sourceforge.plantuml.security.SFile; public class FileWithSuffix { @@ -52,16 +54,31 @@ public class FileWithSuffix { private final String entry; private final String description; + @Override + public String toString() { + if (file == null) { + return super.toString(); + } + return file.toString(); + } + public Reader getReader(String charset) throws IOException { + if (file == null) { + return null; + } + final InputStream tmp = file.openFile(); + if (tmp == null) { + return null; + } if (entry == null) { if (charset == null) { Log.info("Using default charset"); - return new InputStreamReader(file.open()); + return new InputStreamReader(tmp); } Log.info("Using charset " + charset); - return new InputStreamReader(file.open(), charset); + return new InputStreamReader(tmp, charset); } - final InputStream is = getDataFromZip(file.open(), entry); + final InputStream is = getDataFromZip(tmp, entry); if (is == null) { return null; } @@ -94,49 +111,37 @@ public boolean fileOk() { return file != null && file.isOk(); } - FileWithSuffix(File file, String suffix) { + FileWithSuffix(SFile file, String suffix) { this.file = new AFileRegular(file); this.suffix = suffix; this.entry = null; - // this.description = file.getAbsolutePath(); - this.description = getFileName(file); - } - - public static String getFileName(File file) { - return file.getName(); + this.description = file.getName(); } - public static String getAbsolutePath(File file) { - return file.getAbsolutePath(); - } - - public FileWithSuffix(ImportedFiles importedFiles, String fileName, String suffix) throws IOException { - final int idx = fileName.indexOf('~'); + FileWithSuffix(String description, String suffix, AFile file, String entry) { + this.description = description; this.suffix = suffix; - if (idx == -1) { - this.file = importedFiles.getAFile(fileName); - this.entry = null; - } else { - this.file = importedFiles.getAFile(fileName.substring(0, idx)); - this.entry = fileName.substring(idx + 1); - } - - if (file == null) { - this.description = fileName; - } else if (entry == null) { - // this.description = file.getAbsolutePath(); - this.description = fileName; - } else { - // this.description = file.getAbsolutePath() + "~" + entry; - this.description = fileName; - } + this.file = file; + this.entry = entry; + } + static FileWithSuffix none() { + return new FileWithSuffix("NONE", null, null, null); } @Override public int hashCode() { - return (file == null ? 0 : file.hashCode()) + (suffix == null ? 0 : suffix.hashCode() * 43) - + (entry == null ? 0 : entry.hashCode()); + int v = 0; + if (file != null) { + v += file.hashCode(); + } + if (suffix != null) { + v += suffix.hashCode() * 43; + } + if (entry != null) { + v += entry.hashCode(); + } + return v; } @Override @@ -155,6 +160,23 @@ private static boolean same(String s1, String s2) { return false; } + public AParentFolder getParentFile() { + if (file == null) { + return null; + } + Log.info("Getting parent of " + file); + Log.info("-->The parent is " + file.getParentFile()); + return file.getParentFile(); + } + + public String getDescription() { + return description; + } + + public final String getSuffix() { + return suffix; + } + private static boolean equals(String s1, String s2) { if (s1 == null && s2 == null) { return true; @@ -166,30 +188,16 @@ private static boolean equals(String s1, String s2) { return false; } - public static Set convert(Set all) { + public static Set convert(Set all) throws FileNotFoundException { final Set result = new HashSet(); for (FileWithSuffix f : all) { - result.add(f.file.getUnderlyingFile()); + result.add(f.file.getUnderlyingFile().conv()); } return result; } - public AParentFolder getParentFile() { - Log.info("Getting parent of " + file); - Log.info("-->The parent is " + file.getParentFile()); - return file.getParentFile(); - } - - public String getDescription() { - return description; - } - - public final String getSuffix() { - return suffix; - } - - public String toStringDebug() { - return file.getAbsolutePath(); + public static String getFileName(File file) { + return file.getName(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/IfManager.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/IfManager.java deleted file mode 100644 index b541e1b4b..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/IfManager.java +++ /dev/null @@ -1,121 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.preproc; - -import java.io.IOException; - -import net.sourceforge.plantuml.StringLocated; -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.version.Version; - -public class IfManager extends ReadLineInstrumented implements ReadLine { - - protected static final Pattern2 ifdefPattern = MyPattern.cmpile("^[%s]*!if(n)?def[%s]+(.+)$"); - protected static final Pattern2 ifcomparePattern = MyPattern - .cmpile("^[%s]*!if[%s]+\\%(\\w+)\\%[%s]*(\\<|\\<=|\\>|\\>=|=|==|!=|\\<\\>)[%s]*(\\d+)$"); - protected static final Pattern2 elsePattern = MyPattern.cmpile("^[%s]*!else[%s]*$"); - protected static final Pattern2 endifPattern = MyPattern.cmpile("^[%s]*!endif[%s]*$"); - - private final DefinesGet defines; - private final ReadLine source; - - private IfManager child; - - public IfManager(ReadLine source, DefinesGet defines) { - this.defines = defines; - this.source = source; - } - - @Override - final StringLocated readLineInst() throws IOException { - if (child != null) { - final StringLocated s = child.readLine(); - if (s != null) { - return s; - } - child = null; - } - - return readLineInternal(); - } - - protected StringLocated readLineInternal() throws IOException { - final StringLocated s = source.readLine(); - if (s == null) { - return null; - } - - Matcher2 m = ifcomparePattern.matcher(s.getString()); - if (m.find()) { - final int value1 = getValue(m.group(1)); - final String operator = m.group(2); - final int value2 = Integer.parseInt(m.group(3)); - final boolean ok = new NumericCompare(operator).isCompareOk(value1, value2); - if (ok) { - child = new IfManagerPositif(source, defines); - } else { - child = new IfManagerNegatif(source, defines); - } - return this.readLine(); - } - - m = ifdefPattern.matcher(s.getString()); - if (m.find()) { - boolean ok = defines.get().isDefine(m.group(2)); - if (m.group(1) != null) { - ok = !ok; - } - if (ok) { - child = new IfManagerPositif(source, defines); - } else { - child = new IfManagerNegatif(source, defines); - } - return this.readLine(); - } - - return s; - } - - private int getValue(final String arg) { - if (arg.equalsIgnoreCase("PLANTUML_VERSION")) { - return Version.versionPatched(); - } - return 0; - } - - @Override - void closeInst() throws IOException { - source.close(); - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ImportedFiles.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ImportedFiles.java index 71ed244d1..5941f697d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ImportedFiles.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ImportedFiles.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,7 +30,6 @@ */ package net.sourceforge.plantuml.preproc; -import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -39,15 +38,17 @@ import net.sourceforge.plantuml.AFileRegular; import net.sourceforge.plantuml.AFileZipEntry; import net.sourceforge.plantuml.AParentFolder; -import net.sourceforge.plantuml.FileSystem; import net.sourceforge.plantuml.Log; +import net.sourceforge.plantuml.OptionFlags; +import net.sourceforge.plantuml.security.SFile; +import net.sourceforge.plantuml.security.SecurityUtils; public class ImportedFiles { - private final List imported; + private final List imported; private final AParentFolder currentDir; - private ImportedFiles(List imported, AParentFolder currentDir) { + private ImportedFiles(List imported, AParentFolder currentDir) { this.imported = imported; this.currentDir = currentDir; } @@ -60,7 +61,7 @@ public ImportedFiles withCurrentDir(AParentFolder newCurrentDir) { } public static ImportedFiles createImportedFiles(AParentFolder newCurrentDir) { - return new ImportedFiles(new ArrayList(), newCurrentDir); + return new ImportedFiles(new ArrayList(), newCurrentDir); } @Override @@ -69,21 +70,22 @@ public String toString() { } public AFile getAFile(String nameOrPath) throws IOException { - Log.info("ImportedFiles::getAFile nameOrPath = " + nameOrPath); - Log.info("ImportedFiles::getAFile currentDir = " + currentDir); + // Log.info("ImportedFiles::getAFile nameOrPath = " + nameOrPath); + // Log.info("ImportedFiles::getAFile currentDir = " + currentDir); final AParentFolder dir = currentDir; if (dir == null || isAbsolute(nameOrPath)) { - return new AFileRegular(new File(nameOrPath).getCanonicalFile()); + return new AFileRegular(new SFile(nameOrPath).getCanonicalFile()); } - // final File filecurrent = new File(dir.getAbsoluteFile(), nameOrPath); + // final File filecurrent = SecurityUtils.File(dir.getAbsoluteFile(), + // nameOrPath); final AFile filecurrent = dir.getAFile(nameOrPath); Log.info("ImportedFiles::getAFile filecurrent = " + filecurrent); if (filecurrent != null && filecurrent.isOk()) { return filecurrent; } - for (File d : getPath()) { + for (SFile d : getPath()) { if (d.isDirectory()) { - final File file = new File(d, nameOrPath); + final SFile file = d.file(nameOrPath); if (file.exists()) { return new AFileRegular(file.getCanonicalFile()); } @@ -97,19 +99,23 @@ public AFile getAFile(String nameOrPath) throws IOException { return filecurrent; } - public List getPath() { - final List result = new ArrayList(imported); - result.addAll(FileSystem.getPath("plantuml.include.path", true)); - result.addAll(FileSystem.getPath("java.class.path", true)); + public List getPath() { + final List result = new ArrayList(imported); + result.addAll(includePath()); + result.addAll(SecurityUtils.getPath("java.class.path")); return result; } + private List includePath() { + return SecurityUtils.getPath("plantuml.include.path"); + } + private boolean isAbsolute(String nameOrPath) { - final File f = new File(nameOrPath); + final SFile f = new SFile(nameOrPath); return f.isAbsolute(); } - public void add(File file) { + public void add(SFile file) { this.imported.add(file); } @@ -117,4 +123,36 @@ public AParentFolder getCurrentDir() { return currentDir; } + public FileWithSuffix getFile(String filename, String suffix) throws IOException { + final int idx = filename.indexOf('~'); + final AFile file; + final String entry; + if (idx == -1) { + file = getAFile(filename); + entry = null; + } else { + file = getAFile(filename.substring(0, idx)); + entry = filename.substring(idx + 1); + } + if (isAllowed(file) == false) { + return FileWithSuffix.none(); + } + return new FileWithSuffix(filename, suffix, file, entry); + } + + private boolean isAllowed(AFile file) throws IOException { + if (OptionFlags.ALLOW_INCLUDE) { + return true; + } + if (file != null) { + final SFile folder = file.getSystemFolder(); + // System.err.println("canonicalPath=" + path + " " + folder + " " + + // INCLUDE_PATH); + if (includePath().contains(folder)) { + return true; + } + } + return false; + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/NumericCompare.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/NumericCompare.java index 72ea085a2..0fc7e1237 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/NumericCompare.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/NumericCompare.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLine.java index 81dae9ab9..1c466d379 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineInstrumented.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineInstrumented.java deleted file mode 100644 index 06aed563b..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineInstrumented.java +++ /dev/null @@ -1,93 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.preproc; - -import java.io.IOException; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.atomic.AtomicLong; - -import net.sourceforge.plantuml.Log; -import net.sourceforge.plantuml.StringLocated; - -public abstract class ReadLineInstrumented implements ReadLine { - - private static final boolean TRACE = false; - - private static ConcurrentMap durations = new ConcurrentHashMap(); - private static ConcurrentMap maxes = new ConcurrentHashMap(); - - private long current = 0; - - private AtomicLong get(ConcurrentMap source) { - AtomicLong result = source.get(getClass()); - if (result == null) { - result = new AtomicLong(); - source.put(getClass(), result); - } - return result; - } - - public final StringLocated readLine() throws IOException { - if (TRACE == false) { - return readLineInst(); - } - final long now = System.currentTimeMillis(); - try { - return readLineInst(); - } finally { - final long time = System.currentTimeMillis() - now; - current += time; - get(durations).addAndGet(time); - } - } - - @Override - public String toString() { - return super.toString() + " current=" + current; - } - - abstract StringLocated readLineInst() throws IOException; - - public final void close() throws IOException { - if (TRACE) { - if (current > get(maxes).get()) { - get(maxes).set(current); - } - Log.info("DURATION::" + getClass() + " duration= " + get(durations).get() + " current=" + current + " max=" - + get(maxes).get()); - } - closeInst(); - } - - abstract void closeInst() throws IOException; - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineList.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineList.java index c52c27f4f..e3a938054 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineList.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineList.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineNumbered.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineNumbered.java index 5fc79f184..8d18a5b5a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineNumbered.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineNumbered.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,9 +30,7 @@ */ package net.sourceforge.plantuml.preproc; -import java.util.Set; - public interface ReadLineNumbered extends ReadLine { - public Set getFilesUsed(); + // public Set getFilesUsedTOBEREMOVED(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineReader.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineReader.java index 0acc3a275..14b8ee2f7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineReader.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineReader.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,9 +39,8 @@ import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.StringLocated; -public class ReadLineReader extends ReadLineInstrumented implements ReadLine { +public class ReadLineReader implements ReadLine { - // private static final int LIMIT = 850; private final BufferedReader br; private LineLocationImpl location; private final String description; @@ -73,8 +72,7 @@ public static ReadLine create(Reader reader, String description, LineLocation pa return new ReadLineReader(reader, description, parent); } - @Override - StringLocated readLineInst() throws IOException { + public StringLocated readLine() throws IOException { String s = br.readLine(); location = location.oneLineRead(); if (s == null) { @@ -103,8 +101,7 @@ StringLocated readLineInst() throws IOException { return new StringLocated(s, location); } - @Override - void closeInst() throws IOException { + public void close() throws IOException { br.close(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineSimple.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineSimple.java index 637d61188..fe6f4afb3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineSimple.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineSimple.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/StartDiagramExtractReader.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/StartDiagramExtractReader.java index 604fcc1e6..2daf5cf5e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/StartDiagramExtractReader.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/StartDiagramExtractReader.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,10 +34,10 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; -import java.net.URL; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.StringLocated; +import net.sourceforge.plantuml.security.SURL; import net.sourceforge.plantuml.utils.StartUtils; public class StartDiagramExtractReader implements ReadLine { @@ -49,7 +49,7 @@ public static StartDiagramExtractReader build(FileWithSuffix f2, StringLocated s return new StartDiagramExtractReader(getReadLine(f2, s, charset), f2.getSuffix()); } - public static StartDiagramExtractReader build(URL url, StringLocated s, String uid, String charset) { + public static StartDiagramExtractReader build(SURL url, StringLocated s, String uid, String charset) { return new StartDiagramExtractReader(getReadLine(url, s, charset), uid); } @@ -112,16 +112,18 @@ private static ReadLine getReadLine(InputStream is, StringLocated s, String desc return new UncommentReadLine(ReadLineReader.create(new InputStreamReader(is), description)); } - private static ReadLine getReadLine(URL url, StringLocated s, String charset) { + private static ReadLine getReadLine(SURL url, StringLocated s, String charset) { try { + final InputStream tmp = url.openStream(); + if (tmp == null) { + return new ReadLineSimple(s, "Cannot connect"); + } if (charset == null) { Log.info("Using default charset"); - return new UncommentReadLine(ReadLineReader.create(new InputStreamReader(url.openStream()), - url.toString())); + return new UncommentReadLine(ReadLineReader.create(new InputStreamReader(tmp), url.toString())); } Log.info("Using charset " + charset); - return new UncommentReadLine(ReadLineReader.create(new InputStreamReader(url.openStream(), charset), - url.toString())); + return new UncommentReadLine(ReadLineReader.create(new InputStreamReader(tmp, charset), url.toString())); } catch (IOException e) { return new ReadLineSimple(s, e.toString()); } @@ -132,7 +134,7 @@ static public boolean containsStartDiagram(FileWithSuffix f2, StringLocated s, S return containsStartDiagram(r); } - static public boolean containsStartDiagram(URL url, StringLocated s, String charset) throws IOException { + static public boolean containsStartDiagram(SURL url, StringLocated s, String charset) throws IOException { final ReadLine r = getReadLine(url, s, charset); return containsStartDiagram(r); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Stdlib.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Stdlib.java index 24a52877c..f6f31e369 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Stdlib.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Stdlib.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,7 +33,6 @@ import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.DataInputStream; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -53,6 +52,7 @@ import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.brotli.BrotliInputStream; +import net.sourceforge.plantuml.security.SFile; public class Stdlib { @@ -86,7 +86,7 @@ public static InputStream getResourceAsStream(String fullname) { } } - private static Stdlib retrieve(final String name) throws IOException { + public static Stdlib retrieve(final String name) throws IOException { Stdlib result = all.get(name); if (result == null) { final DataInputStream dataStream = getDataStream(name); @@ -252,7 +252,7 @@ private static InputStream getInternalInputStream(String fullname, String extens public static void extractStdLib() throws IOException { for (String name : getAll()) { final Stdlib folder = Stdlib.retrieve(name); - folder.extractMeFull(new File("stdlib", name)); + folder.extractMeFull(); } } @@ -267,7 +267,7 @@ private static Collection getAll() throws IOException { return Collections.unmodifiableCollection(result); } - private void extractMeFull(File dir) throws IOException { + private void extractMeFull() throws IOException { final DataInputStream dataStream = getDataStream(); if (dataStream == null) { return; @@ -280,9 +280,9 @@ private void extractMeFull(File dir) throws IOException { if (filename.equals(SEPARATOR)) { return; } - final File f = new File("stdlib/" + name + "/" + filename + ".puml"); + final SFile f = new SFile("stdlib/" + name + "/" + filename + ".puml"); f.getParentFile().mkdirs(); - final PrintWriter fos = new PrintWriter(f); + final PrintWriter fos = f.createPrintWriter(); while (true) { final String s = dataStream.readUTF(); if (s.equals(SEPARATOR)) { @@ -310,6 +310,46 @@ private void extractMeFull(File dir) throws IOException { } } + public List extractAllSprites() throws IOException { + final List result = new ArrayList(); + final DataInputStream dataStream = getDataStream(); + if (dataStream == null) { + return Collections.unmodifiableList(result); + } + dataStream.readUTF(); + final InputStream spriteStream = getSpriteStream(); + try { + while (true) { + final String filename = dataStream.readUTF(); + if (filename.equals(SEPARATOR)) { + return Collections.unmodifiableList(result); + } + while (true) { + final String s = dataStream.readUTF(); + if (s.equals(SEPARATOR)) { + break; + } + if (isSpriteLine(s)) { + final Matcher m = sizePattern.matcher(s); + final boolean ok = m.find(); + if (ok == false) { + throw new IOException(s); + } + final int width = Integer.parseInt(m.group(1)); + final int height = Integer.parseInt(m.group(2)); + final String sprite = readSprite(width, height, spriteStream); + if (s.contains("_LARGE") == false) { + result.add(s + "\n" + sprite + "}"); + } + } + } + } + } finally { + dataStream.close(); + spriteStream.close(); + } + } + public static void addInfoVersion(List strings, boolean details) { try { for (String name : getAll()) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Sub.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Sub.java index baea05a22..c852e923b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Sub.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Sub.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,27 +30,75 @@ */ package net.sourceforge.plantuml.preproc; +import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.List; -import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringLocated; +import net.sourceforge.plantuml.tim.EaterException; +import net.sourceforge.plantuml.tim.EaterStartsub; +import net.sourceforge.plantuml.tim.TContext; +import net.sourceforge.plantuml.tim.TLineType; +import net.sourceforge.plantuml.tim.TMemory; public class Sub { private final String name; - private final List lines = new ArrayList(); + private final List lines = new ArrayList(); +// private boolean indentationDone = false; public Sub(String name) { this.name = name; } + @Override + public String toString() { + return super.toString() + " " + name; + } + public void add(StringLocated s) { - this.lines.add(s.getString()); +// if (indentationDone) { +// throw new IllegalStateException(); +// } + this.lines.add(s); + } + + public final List lines() { +// if (indentationDone == false) { +// CodeIteratorImpl.indentNow(lines); +// indentationDone = true; +// } + return Collections.unmodifiableList(lines); } - public ReadLine getReadLine(LineLocation lineLocation) { - return new ReadLineList(lines, lineLocation); + public static Sub fromFile(ReadLine reader, String blocname, TContext context, TMemory memory) + throws IOException, EaterException { + Sub result = null; + StringLocated s = null; + boolean skip = false; + while ((s = reader.readLine()) != null) { + final TLineType type = s.getTrimmed().getType(); + if (type == TLineType.STARTSUB) { + final EaterStartsub eater = new EaterStartsub(s.getTrimmed()); + eater.analyze(context, memory); + if (eater.getSubname().equals(blocname)) { + skip = false; + if (result == null) { + result = new Sub(blocname); + } + } + continue; + } + if (type == TLineType.ENDSUB && result != null) { + skip = true; + } + if (result != null && skip == false) { + result.add(s); + } + } + reader.close(); + return result; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Sub2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Sub2.java deleted file mode 100644 index 29bd1858c..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Sub2.java +++ /dev/null @@ -1,88 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.preproc; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import net.sourceforge.plantuml.StringLocated; -import net.sourceforge.plantuml.tim.EaterException; -import net.sourceforge.plantuml.tim.EaterStartsub; -import net.sourceforge.plantuml.tim.TContext; -import net.sourceforge.plantuml.tim.TLineType; -import net.sourceforge.plantuml.tim.TMemory; - -public class Sub2 { - - private final String name; - private final List lines = new ArrayList(); - - public Sub2(String name) { - this.name = name; - } - - public void add(StringLocated s) { - this.lines.add(s); - } - - public final List lines() { - return Collections.unmodifiableList(lines); - } - - public static Sub2 fromFile(ReadLine reader, String blocname, TContext context, TMemory memory) throws IOException, - EaterException { - Sub2 result = null; - StringLocated s = null; - while ((s = reader.readLine()) != null) { - final TLineType type = TLineType.getFromLine(s.getTrimmed().getString()); - if (type == TLineType.STARTSUB) { - final EaterStartsub eater = new EaterStartsub(s.getTrimmed().getString()); - eater.execute(context, memory); - if (eater.getSubname().equals(blocname)) { - result = new Sub2(blocname); - } - continue; - } - if (type == TLineType.ENDSUB && result != null) { - reader.close(); - return result; - } - if (result != null) { - result.add(s); - } - } - reader.close(); - return null; - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Truth.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Truth.java index 4b84b2486..a4cbf877b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Truth.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Truth.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/UncommentReadLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/UncommentReadLine.java index dcacddf6a..dd7cd052f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/UncommentReadLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/UncommentReadLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,7 +38,7 @@ import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.utils.StartUtils; -public class UncommentReadLine extends ReadLineInstrumented implements ReadLine { +public class UncommentReadLine implements ReadLine { private static final Pattern2 unpause = MyPattern.cmpile(StartUtils.PAUSE_PATTERN); @@ -50,13 +50,7 @@ public UncommentReadLine(ReadLine source) { this.raw = source; } - @Override - public String toString() { - return "UncommentReadLine of " + raw; - } - - @Override - StringLocated readLineInst() throws IOException { + public StringLocated readLine() throws IOException { final StringLocated result = raw.readLine(); if (result == null) { @@ -77,13 +71,12 @@ StringLocated readLineInst() throws IOException { return new StringLocated("", result.getLocation()); } if (headerToRemove != null && result.getString().startsWith(headerToRemove)) { - return result.sub(headerToRemove.length(), result.getString().length()); + return result.substring(headerToRemove.length(), result.getString().length()); } return result; } - @Override - void closeInst() throws IOException { + public void close() throws IOException { this.raw.close(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Variables.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Variables.java index 30c4bb41b..f34adaf22 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Variables.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/Variables.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/Preprocessor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/Preprocessor.java index c55d22df7..489f45078 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/Preprocessor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/Preprocessor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,68 +31,25 @@ package net.sourceforge.plantuml.preproc2; import java.io.IOException; -import java.util.Collections; -import java.util.HashSet; import java.util.List; -import java.util.Set; -import net.sourceforge.plantuml.DefinitionsContainer; import net.sourceforge.plantuml.StringLocated; -import net.sourceforge.plantuml.preproc.Defines; -import net.sourceforge.plantuml.preproc.DefinesGet; -import net.sourceforge.plantuml.preproc.FileWithSuffix; -import net.sourceforge.plantuml.preproc.IfManagerFilter; -import net.sourceforge.plantuml.preproc.ImportedFiles; import net.sourceforge.plantuml.preproc.ReadLine; import net.sourceforge.plantuml.preproc.ReadLineNumbered; public class Preprocessor implements ReadLineNumbered { private final ReadLine source; - private final PreprocessorInclude include; - private final PreprocessorModeSet mode; - private final ReadLine sourceV2; - - public Preprocessor(List config, ReadLine reader, String charset, Defines defines, - DefinitionsContainer definitionsContainer, ImportedFiles importedFiles) throws IOException { - this(config, reader, charset, new DefinesGet(defines), definitionsContainer, new HashSet(), - importedFiles, true); - } - - Preprocessor(List config, ReadLine reader, String charset, DefinesGet defines, - DefinitionsContainer definitionsContainer, Set filesUsedGlobal, - ImportedFiles importedFiles, boolean doSaveState) throws IOException { - this.mode = definitionsContainer; - if (doSaveState) { - defines.saveState(); - } - final ReadFilterAnd filtersV2 = new ReadFilterAnd(); - filtersV2.add(new ReadLineQuoteComment(true)); - filtersV2.add(new ReadLineAddConfig(config)); - this.sourceV2 = filtersV2.applyFilter(reader); + public Preprocessor(List config, ReadLine reader) throws IOException { final ReadFilterAnd filters = new ReadFilterAnd(); - filters.add(new ReadLineQuoteComment(false)); - include = new PreprocessorInclude(config, charset, defines, definitionsContainer, importedFiles, - filesUsedGlobal); - filters.add(new ReadLineAddConfig(config)); - filters.add(new IfManagerFilter(defines)); - filters.add(new PreprocessorDefineApply(defines)); - filters.add(new SubPreprocessor(charset, definitionsContainer)); - filters.add(new PreprocessorDefineLearner(defines, importedFiles.getCurrentDir())); - filters.add(include); - + // filters.add(new ReadLineQuoteComment(true)); + filters.add(new ReadFilterAddConfig(config)); + filters.add(new ReadFilterMergeLines()); this.source = filters.applyFilter(reader); } - private boolean isV2() { - return mode != null && mode.getPreprocessorMode() == PreprocessorMode.V2_NEW_TIM; - } - public StringLocated readLine() throws IOException { - if (isV2()) { - return sourceV2.readLine(); - } return source.readLine(); } @@ -100,9 +57,9 @@ public void close() throws IOException { this.source.close(); } - public Set getFilesUsed() { - // System.err.println("************************** WARNING **************************"); - // return Collections.emptySet(); - return Collections.unmodifiableSet(include.getFilesUsedGlobal()); - } +// public Set getFilesUsedTOBEREMOVED() { +// // System.err.println("************************** WARNING **************************"); +// return Collections.emptySet(); +// // return Collections.unmodifiableSet(include.getFilesUsedGlobal()); +// } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorDefineApply.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorDefineApply.java deleted file mode 100644 index 38784e9e3..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorDefineApply.java +++ /dev/null @@ -1,86 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.preproc2; - -import java.io.IOException; -import java.util.List; - -import net.sourceforge.plantuml.StringLocated; -import net.sourceforge.plantuml.preproc.DefinesGet; -import net.sourceforge.plantuml.preproc.ReadLine; -import net.sourceforge.plantuml.preproc.ReadLineList; - -public class PreprocessorDefineApply implements ReadFilter { - - private final DefinesGet defines; - - public PreprocessorDefineApply(DefinesGet defines) throws IOException { - this.defines = defines; - } - - public ReadLine applyFilter(final ReadLine source) { - return new Inner(source); - } - - class Inner extends ReadLineInsertable { - - final ReadLine source; - - Inner(ReadLine source) { - this.source = source; - } - - @Override - void closeInternal() throws IOException { - source.close(); - } - - @Override - StringLocated readLineInternal() throws IOException { - final StringLocated s = this.source.readLine(); - if (s == null || s.getPreprocessorError() != null) { - return s; - } - if (PreprocessorDefineLearner.isLearningLine(s)) { - return s; - } - final List result = defines.get().applyDefines(s.getString()); - if (result.size() > 1) { - insert(new ReadLineList(result, s.getLocation())); - return readLine(); - } - String tmp = result.get(0); - return new StringLocated(tmp, s.getLocation(), s.getPreprocessorError()); - } - - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorDefineLearner.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorDefineLearner.java deleted file mode 100644 index 99a4eccde..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorDefineLearner.java +++ /dev/null @@ -1,177 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.preproc2; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import net.sourceforge.plantuml.AParentFolder; -import net.sourceforge.plantuml.StringLocated; -import net.sourceforge.plantuml.StringUtils; -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.preproc.DefinesGet; -import net.sourceforge.plantuml.preproc.ReadLine; -import net.sourceforge.plantuml.utils.StartUtils; - -public class PreprocessorDefineLearner implements ReadFilter { - - private static final String END_DEFINE_LONG = "!enddefinelong"; - private static final String ID = "[A-Za-z_][A-Za-z_0-9]*"; - private static final String ID_ARG = "\\s*[A-Za-z_][A-Za-z_0-9]*\\s*(?:=\\s*(?:\"[^\"]*\"|'[^']*')\\s*)?"; - private static final String ARG = "(?:\\(" + ID_ARG + "(?:," + ID_ARG + ")*?\\))?"; - private static final Pattern2 defineShortPattern = MyPattern.cmpile("^[%s]*!define[%s]+(" + ID + ARG + ")" - + "(?:[%s]+(.*))?$"); - private static final Pattern2 filenamePattern = MyPattern.cmpile("^[%s]*!filename[%s]+(.+)$"); - private static final Pattern2 undefPattern = MyPattern.cmpile("^[%s]*!undef[%s]+(" + ID + ")$"); - private static final Pattern2 definelongPattern = MyPattern.cmpile("^[%s]*!definelong[%s]+(" + ID + ARG + ")"); - private static final Pattern2 enddefinelongPattern = MyPattern.cmpile("^[%s]*" + END_DEFINE_LONG + "[%s]*$"); - - private final DefinesGet defines; - private final AParentFolder currentDir; - - public PreprocessorDefineLearner(DefinesGet defines, AParentFolder currentDir) { - this.defines = defines; - this.currentDir = currentDir; - } - - public static boolean isLearningLine(StringLocated s) { - Matcher2 m = defineShortPattern.matcher(s.getString()); - if (m.find()) { - return true; - } - m = definelongPattern.matcher(s.getString()); - if (m.find()) { - return true; - } - m = undefPattern.matcher(s.getString()); - if (m.find()) { - return true; - } - return false; - } - - public ReadLine applyFilter(final ReadLine source) { - return new ReadLine() { - - public void close() throws IOException { - source.close(); - } - - public StringLocated readLine() throws IOException { - while (true) { - final StringLocated s = source.readLine(); - if (s == null || s.getPreprocessorError() != null) { - return s; - } - if (StartUtils.isArobaseStartDiagram(s.getString())) { - defines.restoreState(); - return s; - } - - Matcher2 m = filenamePattern.matcher(s.getString()); - if (m.find()) { - manageFilename(m); - continue; - } - m = defineShortPattern.matcher(s.getString()); - if (m.find()) { - manageDefineShort(source, m, s.getString().trim().endsWith("()")); - continue; - } - m = definelongPattern.matcher(s.getString()); - if (m.find()) { - manageDefineLong(source, m, s.getString().trim().endsWith("()")); - continue; - } - - m = undefPattern.matcher(s.getString()); - if (m.find()) { - manageUndef(m); - continue; - } - return s; - } - } - }; - } - - private void manageUndef(Matcher2 m) throws IOException { - defines.get().undefine(m.group(1)); - } - - private void manageDefineLong(ReadLine source, Matcher2 m, boolean emptyParentheses) throws IOException { - final String group1 = m.group(1); - final List def = new ArrayList(); - while (true) { - final StringLocated read = source.readLine(); - if (read == null) { - return; - } - if (enddefinelongPattern.matcher(read.getString()).find()) { - defines.get().define(group1, def, emptyParentheses, currentDir); - return; - } - def.add(read.getString()); - } - } - - private void manageFilename(Matcher2 m) { - final String group1 = m.group(1); - this.defines.get().overrideFilename(group1); - } - - private void manageDefineShort(ReadLine source, Matcher2 m, boolean emptyParentheses) throws IOException { - final String group1 = m.group(1); - final String group2 = m.group(2); - if (group2 == null) { - defines.get().define(group1, null, emptyParentheses, null); - } else { - final List strings = defines.get().applyDefines(group2); - if (strings.size() > 1) { - defines.get().define(group1, strings, emptyParentheses, null); - } else { - final StringBuilder value = new StringBuilder(strings.get(0)); - while (StringUtils.endsWithBackslash(value.toString())) { - value.setLength(value.length() - 1); - final StringLocated read = source.readLine(); - value.append(read.getString()); - } - final List li = new ArrayList(); - li.add(value.toString()); - defines.get().define(group1, li, emptyParentheses, null); - } - } - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorInclude.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorInclude.java deleted file mode 100644 index f677bcba0..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorInclude.java +++ /dev/null @@ -1,376 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.preproc2; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import net.sourceforge.plantuml.DefinitionsContainer; -import net.sourceforge.plantuml.FileSystem; -import net.sourceforge.plantuml.Log; -import net.sourceforge.plantuml.OptionFlags; -import net.sourceforge.plantuml.StringLocated; -import net.sourceforge.plantuml.StringUtils; -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.preproc.DefinesGet; -import net.sourceforge.plantuml.preproc.FileWithSuffix; -import net.sourceforge.plantuml.preproc.ImportedFiles; -import net.sourceforge.plantuml.preproc.ReadLine; -import net.sourceforge.plantuml.preproc.ReadLineEmpty; -import net.sourceforge.plantuml.preproc.ReadLineList; -import net.sourceforge.plantuml.preproc.ReadLineReader; -import net.sourceforge.plantuml.preproc.ReadLineSimple; -import net.sourceforge.plantuml.preproc.ReadLineSingle; -import net.sourceforge.plantuml.preproc.StartDiagramExtractReader; -import net.sourceforge.plantuml.preproc.Stdlib; -import net.sourceforge.plantuml.tim.EaterException; -import net.sourceforge.plantuml.utils.StartUtils; - -public class PreprocessorInclude implements ReadFilter { - - private static final Pattern2 includeDefPattern = MyPattern.cmpile("^[%s]*!includedef[%s]+[%g]?([^%g]+)[%g]?$"); - - private static final Pattern2 includeDefaultStrategy = MyPattern.cmpile("^[%s]*!default_include[%s]+(once|many)$"); - - private static final Pattern2 includePattern = MyPattern.cmpile("^[%s]*!include[%s]+[%g]?([^%g]+)[%g]?$"); - private static final Pattern2 includeManyPattern = MyPattern.cmpile("^[%s]*!include_many[%s]+[%g]?([^%g]+)[%g]?$"); - private static final Pattern2 includeOncePattern = MyPattern.cmpile("^[%s]*!include_once[%s]+[%g]?([^%g]+)[%g]?$"); - - private static final Pattern2 importPattern = MyPattern.cmpile("^[%s]*!import[%s]+[%g]?([^%g]+)[%g]?$"); - private static final Pattern2 includePatternStdlib = MyPattern.cmpile("^[%s]*!include[%s]+(\\<[^%g]+\\>)$"); - private static final Pattern2 includeURLPattern = MyPattern.cmpile("^[%s]*!includeurl[%s]+[%g]?([^%g]+)[%g]?$"); - - private final String charset; - private final DefinesGet defines; - private final List config; - private final DefinitionsContainer definitionsContainer; - private final ImportedFiles importedFiles; - - private final Set filesUsedCurrent = new HashSet(); - private final Set filesUsedGlobal; - private PreprocessorIncludeStrategy strategy = PreprocessorIncludeStrategy.ONCE; - - public PreprocessorInclude(List config, String charset, DefinesGet defines, - DefinitionsContainer definitionsContainer, ImportedFiles importedFiles, Set filesUsedGlobal) { - this.charset = charset; - this.config = config; - this.defines = defines; - this.definitionsContainer = definitionsContainer; - this.importedFiles = importedFiles; - this.filesUsedGlobal = filesUsedGlobal; - } - - public ReadLine applyFilter(ReadLine source) { - return new Inner(source); - } - - class Inner extends ReadLineInsertable { - - final ReadLine source; - - Inner(ReadLine source) { - this.source = source; - } - - @Override - void closeInternal() throws IOException { - source.close(); - } - - @Override - StringLocated readLineInternal() throws IOException { - final StringLocated s = source.readLine(); - if (s == null || s.getPreprocessorError() != null) { - return s; - } - if (s != null && StartUtils.startOrEnd(s)) { - // http://plantuml.sourceforge.net/qa/?qa=3389/error-generating-when-same-file-included-different-diagram - filesUsedCurrent.clear(); - strategy = PreprocessorIncludeStrategy.ONCE; - return s; - } - if (s.getPreprocessorError() == null && OptionFlags.ALLOW_INCLUDE) { - final Matcher2 m0 = importPattern.matcher(s.getString()); - if (m0.find()) { - final StringLocated err = manageFileImport(s, m0); - if (err != null) { - insert(new ReadLineSingle(err)); - } - return readLine(); - } - final Matcher2 m1 = includePattern.matcher(s.getString()); - if (m1.find()) { - insert(manageFileInclude(s, m1, strategy)); - return readLine(); - } - final Matcher2 m2 = includeManyPattern.matcher(s.getString()); - if (m2.find()) { - insert(manageFileInclude(s, m2, PreprocessorIncludeStrategy.MANY)); - return readLine(); - } - final Matcher2 m3 = includeOncePattern.matcher(s.getString()); - if (m3.find()) { - insert(manageFileInclude(s, m3, PreprocessorIncludeStrategy.ONCE)); - return readLine(); - } - final Matcher2 m4 = includeDefPattern.matcher(s.getString()); - if (m4.find()) { - insert(manageDefinitionInclude(s, m4)); - return readLine(); - } - } else { - final Matcher2 m1 = includePatternStdlib.matcher(s.getString()); - if (m1.find()) { - insert(manageFileInclude(s, m1, PreprocessorIncludeStrategy.ONCE)); - return readLine(); - } - } - final Matcher2 mUrl = includeURLPattern.matcher(s.getString()); - if (s.getPreprocessorError() == null && mUrl.find()) { - insert(manageUrlInclude(s, mUrl)); - return readLine(); - } - final Matcher2 m2 = includeDefaultStrategy.matcher(s.getString()); - if (m2.find()) { - strategy = PreprocessorIncludeStrategy.fromString(m2.group(1)); - return readLine(); - } - - return s; - } - - } - - private StringLocated manageFileImport(StringLocated s, Matcher2 m) throws IOException { - final String fileName = m.group(1); - final File file = FileSystem.getInstance().getFile(withEnvironmentVariable(fileName)); - if (file.exists() && file.isDirectory() == false) { - importedFiles.add(file); - return null; - } - return s.withErrorPreprocessor("Cannot import " + FileWithSuffix.getFileName(file)); - - } - - private ReadLine manageUrlInclude(StringLocated s, Matcher2 m) throws IOException { - String urlString = m.group(1); - urlString = defines.get().applyDefines(urlString).get(0); - - final int idx = urlString.lastIndexOf('!'); - String suf = null; - if (idx != -1) { - suf = urlString.substring(idx + 1); - urlString = urlString.substring(0, idx); - } - try { - if (urlString.toLowerCase().startsWith("https://") == false - && urlString.toLowerCase().startsWith("http://") == false) { - return new ReadLineSingle(s.withErrorPreprocessor("Cannot include url " + urlString)); - } - final URL url = new URL(urlString); - return new Preprocessor(config, getReaderIncludeUrl(url, s, suf, charset), charset, defines, definitionsContainer, - filesUsedGlobal, importedFiles, false); - - } catch (MalformedURLException e) { - return new ReadLineSingle(s.withErrorPreprocessor("Cannot include url " + urlString)); - } - } - - private ReadLine manageDefinitionInclude(StringLocated s, Matcher2 matcher) throws IOException { - final String definitionName = matcher.group(1); - final List definition = definitionsContainer.getDefinition1(definitionName); - return new Preprocessor(config, new ReadLineList(definition, s.getLocation()), charset, defines, - definitionsContainer, filesUsedGlobal, importedFiles, false); - } - - private ReadLine manageFileInclude(StringLocated s, Matcher2 matcher, PreprocessorIncludeStrategy allowMany) - throws IOException { - String fileName = matcher.group(1); - fileName = defines.get().applyDefines(fileName).get(0); - if (fileName.startsWith("<") && fileName.endsWith(">")) { - final ReadLine strlibReader = getReaderStdlibInclude(s, fileName.substring(1, fileName.length() - 1)); - if (strlibReader == null) { - return new ReadLineSingle(s.withErrorPreprocessor("Cannot include " + fileName)); - } - return new Preprocessor(config, strlibReader, charset, defines, definitionsContainer, filesUsedGlobal, - importedFiles, false); - } - final int idx = fileName.lastIndexOf('!'); - String suf = null; - if (idx != -1) { - suf = fileName.substring(idx + 1); - fileName = fileName.substring(0, idx); - } - final FileWithSuffix f2 = new FileWithSuffix(importedFiles, withEnvironmentVariable(fileName), suf); - if (f2.fileOk() == false) { - Log.error("Current path is " + FileWithSuffix.getAbsolutePath(new File("."))); - Log.error("Cannot include " + f2.getDescription()); - return new ReadLineSingle(s.withErrorPreprocessor("Cannot include " + f2.getDescription())); - } else if (allowMany == PreprocessorIncludeStrategy.ONCE && filesUsedCurrent.contains(f2)) { - // return new ReadLineSimple(s, "File already included " + f2.getDescription()); - return new ReadLineEmpty(); - } - filesUsedCurrent.add(f2); - filesUsedGlobal.add(f2); - - return new Preprocessor(config, getReaderInclude(f2, s), charset, defines, definitionsContainer, - filesUsedGlobal, importedFiles.withCurrentDir(f2.getParentFile()), false); - } - - public static String withEnvironmentVariable(String s) { - final Pattern p = Pattern.compile("%(\\w+)%"); - - final Matcher m = p.matcher(s); - final StringBuffer sb = new StringBuffer(); - while (m.find()) { - final String var = m.group(1); - final String value = getenv(var); - if (value != null) { - m.appendReplacement(sb, Matcher.quoteReplacement(value)); - } - } - m.appendTail(sb); - s = sb.toString(); - return s; - } - - public static String getenv(String var) { - final String env = System.getProperty(var); - if (StringUtils.isNotEmpty(env)) { - return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(env); - } - final String getenv = System.getenv(var); - if (StringUtils.isNotEmpty(getenv)) { - return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(getenv); - } - return null; - } - - private static InputStream getStdlibInputStream(String filename) { - final InputStream result = Stdlib.getResourceAsStream(filename); - // Log.info("Loading sdlib " + filename + " ok"); - return result; - } - - public static ReadLine getReaderStdlibInclude(StringLocated s, String filename) { - Log.info("Loading sdlib " + filename); - InputStream is = getStdlibInputStream(filename); - if (is == null) { - return null; - } - final String description = "<" + filename + ">"; - try { - if (StartDiagramExtractReader.containsStartDiagram(is, s, description)) { - is = getStdlibInputStream(filename); - return StartDiagramExtractReader.build(is, s, description); - } - is = getStdlibInputStream(filename); - if (is == null) { - return null; - } - return ReadLineReader.create(new InputStreamReader(is), description); - } catch (IOException e) { - e.printStackTrace(); - return new ReadLineSimple(s, e.toString()); - } - } - - private ReadLine getReaderInclude(FileWithSuffix f2, StringLocated s) { - try { - if (StartDiagramExtractReader.containsStartDiagram(f2, s, charset)) { - return StartDiagramExtractReader.build(f2, s, charset); - } - final Reader reader = f2.getReader(charset); - if (reader == null) { - return new ReadLineSimple(s, "Cannot open " + f2.getDescription()); - } - return ReadLineReader.create(reader, f2.getDescription(), s.getLocation()); - } catch (IOException e) { - e.printStackTrace(); - return new ReadLineSimple(s, e.toString()); - } - } - - private static ReadLine getReaderIncludeUrl(final URL url, StringLocated s, String suf, String charset) { - try { - if (StartDiagramExtractReader.containsStartDiagram(url, s, charset)) { - return StartDiagramExtractReader.build(url, s, suf, charset); - } - final InputStream is = url.openStream(); - if (charset == null) { - Log.info("Using default charset"); - return ReadLineReader.create(new InputStreamReader(is), url.toString(), s.getLocation()); - } - Log.info("Using charset " + charset); - return ReadLineReader.create(new InputStreamReader(is, charset), url.toString(), s.getLocation()); - } catch (IOException e) { - e.printStackTrace(); - return new ReadLineSimple(s, e.toString()); - } - - } - - public static ReadLine getReaderIncludeUrl2(final URL url, StringLocated s, String suf, String charset) throws EaterException { - try { - if (StartDiagramExtractReader.containsStartDiagram(url, s, charset)) { - return StartDiagramExtractReader.build(url, s, suf, charset); - } - final InputStream is = url.openStream(); - if (charset == null) { - Log.info("Using default charset"); - return ReadLineReader.create(new InputStreamReader(is), url.toString(), s.getLocation()); - } - Log.info("Using charset " + charset); - return ReadLineReader.create(new InputStreamReader(is, charset), url.toString(), s.getLocation()); - } catch (IOException e) { - e.printStackTrace(); - throw new EaterException("Cannot open URL"); - } - - } - - public Set getFilesUsedGlobal() { - return filesUsedGlobal; - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorIncludeStrategy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorIncludeStrategy.java index 20605f606..427c2be13 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorIncludeStrategy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorIncludeStrategy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorModeSet.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorModeSet.java index 41c0bbf02..c570407ab 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorModeSet.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorModeSet.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,10 +34,6 @@ public interface PreprocessorModeSet { - public PreprocessorMode getPreprocessorMode(); - - public void setPreprocessorMode(PreprocessorMode mode); - public ImportedFiles getImportedFiles(); public String getCharset(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorUtils.java new file mode 100644 index 000000000..d7a90751a --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/PreprocessorUtils.java @@ -0,0 +1,133 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.preproc2; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.sourceforge.plantuml.Log; +import net.sourceforge.plantuml.StringLocated; +import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.preproc.ReadLine; +import net.sourceforge.plantuml.preproc.ReadLineReader; +import net.sourceforge.plantuml.preproc.ReadLineSimple; +import net.sourceforge.plantuml.preproc.StartDiagramExtractReader; +import net.sourceforge.plantuml.preproc.Stdlib; +import net.sourceforge.plantuml.security.SURL; +import net.sourceforge.plantuml.tim.EaterException; + +public class PreprocessorUtils { + + public static String withEnvironmentVariable(String s) { + final Pattern p = Pattern.compile("%(\\w+)%"); + + final Matcher m = p.matcher(s); + final StringBuffer sb = new StringBuffer(); + while (m.find()) { + final String var = m.group(1); + final String value = getenv(var); + if (value != null) { + m.appendReplacement(sb, Matcher.quoteReplacement(value)); + } + } + m.appendTail(sb); + s = sb.toString(); + return s; + } + + public static String getenv(String var) { + final String env = System.getProperty(var); + if (StringUtils.isNotEmpty(env)) { + return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(env); + } + final String getenv = System.getenv(var); + if (StringUtils.isNotEmpty(getenv)) { + return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(getenv); + } + return null; + } + + private static InputStream getStdlibInputStream(String filename) { + final InputStream result = Stdlib.getResourceAsStream(filename); + // Log.info("Loading sdlib " + filename + " ok"); + return result; + } + + public static ReadLine getReaderStdlibInclude(StringLocated s, String filename) { + Log.info("Loading sdlib " + filename); + InputStream is = getStdlibInputStream(filename); + if (is == null) { + return null; + } + final String description = "<" + filename + ">"; + try { + if (StartDiagramExtractReader.containsStartDiagram(is, s, description)) { + is = getStdlibInputStream(filename); + return StartDiagramExtractReader.build(is, s, description); + } + is = getStdlibInputStream(filename); + if (is == null) { + return null; + } + return ReadLineReader.create(new InputStreamReader(is), description); + } catch (IOException e) { + e.printStackTrace(); + return new ReadLineSimple(s, e.toString()); + } + } + + public static ReadLine getReaderIncludeUrl2(final SURL url, StringLocated s, String suf, String charset) + throws EaterException { + try { + if (StartDiagramExtractReader.containsStartDiagram(url, s, charset)) { + return StartDiagramExtractReader.build(url, s, suf, charset); + } + final InputStream is = url.openStream(); + if (is == null) { + throw EaterException.located("Cannot open URL"); + } + if (charset == null) { + Log.info("Using default charset"); + return ReadLineReader.create(new InputStreamReader(is), url.toString(), s.getLocation()); + } + Log.info("Using charset " + charset); + return ReadLineReader.create(new InputStreamReader(is, charset), url.toString(), s.getLocation()); + } catch (IOException e) { + e.printStackTrace(); + throw EaterException.located("Cannot open URL " + e.getMessage()); + } + + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilter.java index db093b168..abb22f4cb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadLineAddConfig.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilterAddConfig.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadLineAddConfig.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilterAddConfig.java index 85e7dfbae..89aeeea49 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadLineAddConfig.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilterAddConfig.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,11 +38,11 @@ import net.sourceforge.plantuml.preproc.ReadLineList; import net.sourceforge.plantuml.utils.StartUtils; -public class ReadLineAddConfig implements ReadFilter { +public class ReadFilterAddConfig implements ReadFilter { private final List config; - public ReadLineAddConfig(List config) { + public ReadFilterAddConfig(List config) { this.config = config; } @@ -69,7 +69,7 @@ public StringLocated readLine() throws IOException { } result = raw.readLine(); if (result != null && StartUtils.isArobaseStartDiagram(result.getString()) && config.size() > 0) { - inserted = new ReadLineQuoteComment(false).applyFilter(new ReadLineList(config, result.getLocation())); + inserted = new ReadFilterQuoteComment().applyFilter(new ReadLineList(config, result.getLocation())); } return result; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilterAnd.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilterAnd.java index f3ad3a77b..d96891092 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilterAnd.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilterAnd.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilterMergeLines.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilterMergeLines.java new file mode 100644 index 000000000..bbe7e6568 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilterMergeLines.java @@ -0,0 +1,84 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.preproc2; + +import java.io.IOException; + +import net.sourceforge.plantuml.StringLocated; +import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.core.DiagramType; +import net.sourceforge.plantuml.preproc.ReadLine; +import net.sourceforge.plantuml.utils.StartUtils; + +public class ReadFilterMergeLines implements ReadFilter { + + public ReadLine applyFilter(final ReadLine source) { + return new ReadLine() { + + private boolean manageEndingBackslash = true; + + public void close() throws IOException { + source.close(); + } + + public StringLocated readLine() throws IOException { + StringLocated result = source.readLine(); + if (result != null && StartUtils.isArobaseStartDiagram(result.getString()) + && isDitaa(result.getString())) { + this.manageEndingBackslash = false; + } + if (result != null && StartUtils.isArobaseEndDiagram(result.getString())) { + this.manageEndingBackslash = true; + } + + ReadLine sourceWithoutComment = null; + + while (result != null && manageEndingBackslash && StringUtils.endsWithBackslash(result.getString())) { + if (sourceWithoutComment == null) { + sourceWithoutComment = new ReadFilterQuoteComment().applyFilter(source); + } + final StringLocated next = sourceWithoutComment.readLine(); + if (next == null) { + break; + } else { + result = result.mergeEndBackslash(next); + } + } + return result; + } + + private boolean isDitaa(String string) { + return DiagramType.getTypeFromArobaseStart(StringUtils.trinNoTrace((string))) == DiagramType.DITAA; + } + }; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadLineQuoteComment.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilterQuoteComment.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadLineQuoteComment.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilterQuoteComment.java index 96c835d2c..a534e4be3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadLineQuoteComment.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadFilterQuoteComment.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,21 +35,10 @@ import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.preproc.ReadLine; -public class ReadLineQuoteComment implements ReadFilter { - - private final boolean ignoreMe; - - public ReadLineQuoteComment(boolean ignoreMe) { - this.ignoreMe = ignoreMe; - } +public class ReadFilterQuoteComment implements ReadFilter { public ReadLine applyFilter(final ReadLine source) { - if (ignoreMe) { - return source; - } - return new ReadLine() { - public void close() throws IOException { source.close(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadLineInsertable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadLineInsertable.java deleted file mode 100644 index ec4a7aa12..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/ReadLineInsertable.java +++ /dev/null @@ -1,72 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.preproc2; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import net.sourceforge.plantuml.StringLocated; -import net.sourceforge.plantuml.preproc.ReadLine; - -public abstract class ReadLineInsertable implements ReadLine { - - private final List sources = new ArrayList(); - - final protected void insert(ReadLine inserted) throws IOException { - sources.add(0, inserted); - } - - abstract StringLocated readLineInternal() throws IOException; - - final public StringLocated readLine() throws IOException { - while (sources.size() > 0) { - final ReadLine tmp = sources.get(0); - final StringLocated result = tmp.readLine(); - if (result != null) { - return result; - } - tmp.close(); - sources.remove(0); - } - return readLineInternal(); - } - - abstract void closeInternal() throws IOException; - - final public void close() throws IOException { - for (ReadLine s : sources) { - s.close(); - } - closeInternal(); - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/SubPreprocessor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/SubPreprocessor.java deleted file mode 100644 index 87a085dfe..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc2/SubPreprocessor.java +++ /dev/null @@ -1,194 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.preproc2; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.HashMap; -import java.util.Map; - -import net.sourceforge.plantuml.DefinitionsContainer; -import net.sourceforge.plantuml.FileSystem; -import net.sourceforge.plantuml.Log; -import net.sourceforge.plantuml.StringLocated; -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.preproc.FileWithSuffix; -import net.sourceforge.plantuml.preproc.ReadLine; -import net.sourceforge.plantuml.preproc.ReadLineReader; -import net.sourceforge.plantuml.preproc.ReadLineSimple; -import net.sourceforge.plantuml.preproc.Sub; - -public class SubPreprocessor implements ReadFilter { - - private static final String ID = "[A-Za-z_][A-Za-z_0-9]*"; - - private static final Pattern2 includeSubPattern = MyPattern.cmpile("^[%s]*!includesub[%s]+[%g]?([^%g]+)[%g]?$"); - - private static final Pattern2 startsub = MyPattern.cmpile("^[%s]*!startsub[%s]+(" + ID + ")"); - private static final Pattern2 endsub = MyPattern.cmpile("^[%s]*!endsub[%s]*"); - - private final DefinitionsContainer definitionsContainer; - private final String charset; - - public SubPreprocessor(String charset, DefinitionsContainer definitionsContainer) { - this.charset = charset; - this.definitionsContainer = definitionsContainer; - } - - private final Map subs = new HashMap(); - private Sub learningSub; - private ReadLine includedSub; - - public ReadLine applyFilter(ReadLine source) { - return new InnerReadLine(source); - } - - class InnerReadLine implements ReadLine { - final ReadLine source; - - public InnerReadLine(ReadLine source) { - this.source = source; - } - - private StringLocated manageStartsub(Matcher2 m) throws IOException { - final String name = m.group(1); - learningSub = getSub(name); - return this.readLine(); - } - - private StringLocated manageEndsub(Matcher2 m) throws IOException { - learningSub = null; - return this.readLine(); - } - - public void close() throws IOException { - source.close(); - } - - private StringLocated manageIncludeSub(StringLocated s, Matcher2 m) throws IOException { - final String name = m.group(1); - final int idx = name.indexOf('!'); - if (idx != -1) { - final String filename = name.substring(0, idx); - final String blocname = name.substring(idx + 1); - final File f = FileSystem.getInstance().getFile(PreprocessorInclude.withEnvironmentVariable(filename)); - if (f.exists() == false || f.isDirectory()) { - Log.error("Cannot include " + FileWithSuffix.getAbsolutePath(f)); - return s.withErrorPreprocessor("Cannot include " + FileWithSuffix.getFileName(f)); - } - final SubPreprocessor data = new SubPreprocessor(charset, definitionsContainer); - InnerReadLine tmp = (InnerReadLine) data.applyFilter(getReaderIncludeWithoutComment(s, f)); - while (tmp.readLine() != null) { - // Read file - } - tmp.close(); - includedSub = tmp.getSub(blocname).getReadLine(s.getLocation()); - } else { - includedSub = getSub(name).getReadLine(s.getLocation()); - } - return this.readLine(); - } - - public StringLocated readLine() throws IOException { - if (includedSub != null) { - final StringLocated s = includedSub.readLine(); - if (s != null) { - eventuallyLearn(s); - return s; - } - includedSub = null; - } - - final StringLocated s = source.readLine(); - if (s == null) { - return null; - } - - final Matcher2 m1 = includeSubPattern.matcher(s.getString()); - if (m1.find()) { - return manageIncludeSub(s, m1); - } - - Matcher2 m = startsub.matcher(s.getString()); - if (m.find()) { - return manageStartsub(m); - } - - m = endsub.matcher(s.getString()); - if (m.find()) { - return manageEndsub(m); - } - eventuallyLearn(s); - return s; - } - - private void eventuallyLearn(final StringLocated s) { - if (learningSub != null) { - learningSub.add(s); - } - } - - Sub getSub(String name) { - Sub result = subs.get(name); - if (result == null) { - result = new Sub(name); - subs.put(name, result); - } - return result; - } - - } - - private ReadLine getReaderIncludeWithoutComment(StringLocated s, final File f) { - return new ReadLineQuoteComment(false).applyFilter(getReaderIncludeRaw(s, f)); - } - - private ReadLine getReaderIncludeRaw(StringLocated s, final File f) { - try { - if (charset == null) { - Log.info("Using default charset"); - return ReadLineReader.create(new FileReader(f), FileWithSuffix.getFileName(f), s.getLocation()); - } - Log.info("Using charset " + charset); - return ReadLineReader.create(new InputStreamReader(new FileInputStream(f), charset), FileWithSuffix.getFileName(f), - s.getLocation()); - } catch (IOException e) { - return new ReadLineSimple(s, e.toString()); - } - - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Arrows.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/Arrows.java similarity index 93% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/Arrows.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/Arrows.java index 227a04827..4776fd5ad 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Arrows.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/Arrows.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project; import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.ugraphic.UPolygon; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/Completion.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/Completion.java new file mode 100644 index 000000000..d710b63bf --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/Completion.java @@ -0,0 +1,47 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project; + +import net.sourceforge.plantuml.project.lang.Complement; + +public class Completion implements Complement { + + private final int completion; + + public Completion(int completion) { + this.completion = completion; + } + + public final int getCompletion() { + return completion; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ConstantPlan.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/ConstantPlan.java similarity index 83% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/ConstantPlan.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/ConstantPlan.java index 49af50f5b..111d47e63 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ConstantPlan.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/ConstantPlan.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,9 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project; + +import net.sourceforge.plantuml.project.time.Wink; public class ConstantPlan implements LoadPlanable { @@ -46,7 +48,7 @@ public static LoadPlanable partial(int load) { return new ConstantPlan(load); } - public int getLoadAt(Instant instant) { + public int getLoadAt(Wink instant) { return loadPerInstant; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/DaysAsDates.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/DaysAsDates.java similarity index 68% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/DaysAsDates.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/DaysAsDates.java index fd5e65da1..845e5966d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/DaysAsDates.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/DaysAsDates.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,23 +28,27 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project; import java.util.Iterator; -public class DaysAsDates implements Subject, Complement, Iterable { +import net.sourceforge.plantuml.project.lang.Complement; +import net.sourceforge.plantuml.project.lang.Subject; +import net.sourceforge.plantuml.project.time.Day; - private final DayAsDate date1; - private final DayAsDate date2; +public class DaysAsDates implements Subject, Complement, Iterable { - public DaysAsDates(DayAsDate date1, DayAsDate date2) { + private final Day date1; + private final Day date2; + + public DaysAsDates(Day date1, Day date2) { this.date1 = date1; this.date2 = date2; } - public DaysAsDates(GanttDiagram gantt, DayAsDate date1, int count) { + public DaysAsDates(GanttDiagram gantt, Day date1, int count) { this.date1 = date1; - DayAsDate tmp = date1; + Day tmp = date1; while (count > 0) { if (gantt.isOpen(tmp)) { count--; @@ -54,11 +58,11 @@ public DaysAsDates(GanttDiagram gantt, DayAsDate date1, int count) { this.date2 = tmp; } - class MyIterator implements Iterator { + class MyIterator implements Iterator { - private DayAsDate current; + private Day current; - public MyIterator(DayAsDate current) { + public MyIterator(Day current) { this.current = current; } @@ -66,8 +70,8 @@ public boolean hasNext() { return current.compareTo(date2) <= 0; } - public DayAsDate next() { - final DayAsDate result = current; + public Day next() { + final Day result = current; current = current.next(); return result; } @@ -78,7 +82,7 @@ public void remove() { } - public Iterator iterator() { + public Iterator iterator() { return new MyIterator(date1); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Failable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/Failable.java similarity index 91% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/Failable.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/Failable.java index 7069bc92d..c70456a09 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Failable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/Failable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project; public class Failable { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/GanttArrow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/GanttArrow.java similarity index 84% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/GanttArrow.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/GanttArrow.java index a0d8823b8..7444dac0c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/GanttArrow.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/GanttArrow.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,17 +28,19 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project; import net.sourceforge.plantuml.Direction; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.project.core.Task; +import net.sourceforge.plantuml.project.core.TaskAttribute; +import net.sourceforge.plantuml.project.core.TaskInstant; +import net.sourceforge.plantuml.project.timescale.TimeScale; 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.HColorUtils; public class GanttArrow implements UDrawable { @@ -71,11 +73,10 @@ public GanttArrow(TimeScale timeScale, TaskInstant source, TaskInstant dest) { } public void drawU(UGraphic ug) { - ug = ug.apply(new UChangeBackColor(HtmlColorUtils.RED_DARK)).apply(new UChangeColor(HtmlColorUtils.RED_DARK)) - .apply(new UStroke(1.5)); + ug = ug.apply(HColorUtils.RED_DARK.bg()).apply(HColorUtils.RED_DARK).apply(new UStroke(1.5)); - final TaskDraw draw1 = ((Task) source.getMoment()).getTaskDraw(); - final TaskDraw draw2 = ((Task) dest.getMoment()).getTaskDraw(); + final Task draw1 = (Task) source.getMoment(); + final Task draw2 = (Task) dest.getMoment(); double x1 = getX(source.withDelta(0), atStart); double y1 = draw1.getY(atStart); @@ -83,8 +84,15 @@ public void drawU(UGraphic ug) { final double x2 = getX(dest, atEnd.getInv()); final double y2 = draw2.getY(atEnd); + if (atStart == Direction.DOWN && y2 < y1) { + y1 = draw1.getY(atStart.getInv()); + } + if (this.atStart == Direction.DOWN && this.atEnd == Direction.RIGHT) { if (x2 > x1) { + if (x2 - x1 < 8) { + x1 = x2 - 8; + } drawLine(ug, x1, y1, x1, y2, x2, y2); } else { x1 = getX(source.withDelta(0), Direction.RIGHT); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/GanttConstraint.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/GanttConstraint.java similarity index 65% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/GanttConstraint.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/GanttConstraint.java index aa7a0ad6a..eb23d1688 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/GanttConstraint.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/GanttConstraint.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,9 +28,13 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project; import net.sourceforge.plantuml.graphic.UDrawable; +import net.sourceforge.plantuml.project.core.TaskInstant; +import net.sourceforge.plantuml.project.lang.Complement; +import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.timescale.TimeScale; public class GanttConstraint implements Complement { @@ -50,4 +54,24 @@ public String toString() { public UDrawable getUDrawable(final TimeScale timeScale) { return new GanttArrow(timeScale, source, dest); } + + public boolean isHidden(Wink min, Wink max) { + if (isHidden(source.getInstantPrecise(), min, max)) { + return true; + } + if (isHidden(dest.getInstantPrecise(), min, max)) { + return true; + } + return false; + } + + private boolean isHidden(Wink now, Wink min, Wink max) { + if (now.compareTo(min) < 0) { + return true; + } + if (now.compareTo(max) > 0) { + return true; + } + return false; + } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/GanttDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/GanttDiagram.java similarity index 51% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/GanttDiagram.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/GanttDiagram.java index 2241487b0..b64bd1c2f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/GanttDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/GanttDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project; import java.awt.geom.Dimension2D; import java.awt.geom.Rectangle2D; @@ -50,47 +50,76 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.Scale; import net.sourceforge.plantuml.SkinParam; -import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.project.core.Moment; +import net.sourceforge.plantuml.project.core.MomentImpl; +import net.sourceforge.plantuml.project.core.PrintScale; +import net.sourceforge.plantuml.project.core.Resource; +import net.sourceforge.plantuml.project.core.Task; +import net.sourceforge.plantuml.project.core.TaskAttribute; +import net.sourceforge.plantuml.project.core.TaskCode; +import net.sourceforge.plantuml.project.core.TaskImpl; +import net.sourceforge.plantuml.project.core.TaskInstant; +import net.sourceforge.plantuml.project.core.TaskSeparator; +import net.sourceforge.plantuml.project.draw.ResourceDraw; +import net.sourceforge.plantuml.project.draw.TaskDraw; +import net.sourceforge.plantuml.project.draw.TaskDrawDiamond; +import net.sourceforge.plantuml.project.draw.TaskDrawRegular; +import net.sourceforge.plantuml.project.draw.TaskDrawSeparator; +import net.sourceforge.plantuml.project.draw.TimeHeader; +import net.sourceforge.plantuml.project.draw.TimeHeaderDaily; +import net.sourceforge.plantuml.project.draw.TimeHeaderMonthly; +import net.sourceforge.plantuml.project.draw.TimeHeaderSimple; +import net.sourceforge.plantuml.project.draw.TimeHeaderWeekly; +import net.sourceforge.plantuml.project.lang.ComplementColors; +import net.sourceforge.plantuml.project.lang.Subject; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.DayOfWeek; +import net.sourceforge.plantuml.project.time.GCalendar; +import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.timescale.TimeScale; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.MinMax; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.ULine; -import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class GanttDiagram extends TitledDiagram implements Subject { private final Map tasks = new LinkedHashMap(); private final Map byShortName = new HashMap(); private final List constraints = new ArrayList(); - private final IHtmlColorSet colorSet = new HtmlColorSetSimple(); + private final HColorSet colorSet = HColorSet.instance(); + private final Collection closedDayOfWeek = EnumSet.noneOf(DayOfWeek.class); - private final Collection closedDayAsDate = new HashSet(); - private final Collection openedDayAsDate = new HashSet(); + private final Collection closedDayAsDate = new HashSet(); + private final Collection openedDayAsDate = new HashSet(); + + private final Map resources = new LinkedHashMap(); + private final Map colorDays = new HashMap(); + private final Map nameDays = new HashMap(); + + private PrintScale printScale = PrintScale.DAILY; + private Day today; private GCalendar calendar; + private double totalHeight; + private Wink min = new Wink(0); + private Wink max; - private final Instant min = new InstantDay(0); - private Instant max; + private Day printStart; + private Day printEnd; public DiagramDescription getDescription() { return new DiagramDescription("(Project)"); @@ -127,13 +156,20 @@ public final int getDpi(FileFormatOption fileFormatOption) { @Override protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption, long seed) throws IOException { - final double margin = 10; - final Scale scale = getScale(); + final int margin1; + final int margin2; + if (SkinParam.USE_STYLES()) { + margin1 = SkinParam.zeroMargin(0); + margin2 = SkinParam.zeroMargin(0); + } else { + margin1 = 0; + margin2 = 0; + } final double dpiFactor = scale == null ? 1 : scale.getScale(100, 100); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), dpiFactor, null, "", "", 0, 0, - null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildB(new ColorMapperIdentity(), false, + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, getMetadata(), "", dpiFactor, null); final SkinParam skinParam = SkinParam.create(UmlDiagramType.TIMING); TextBlock result = getTextBlock(); @@ -143,16 +179,51 @@ protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOptio return imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed, os); } + public void setPrintScale(PrintScale printScale) { + this.printScale = printScale; + } + + private boolean isHidden(Task task) { + if (printStart == null || task instanceof TaskSeparator) { + return false; + } + if (task.getEnd().compareTo(min) < 0) { + return true; + } + if (task.getStart().compareTo(max) > 0) { + return true; + } + return false; + } + private TextBlockBackcolored getTextBlock() { - initMinMax(); - final TimeScale timeScale = getTimeScale(); - initTaskAndResourceDraws(timeScale); + if (printStart == null) { + initMinMax(); + } else { + this.min = calendar.fromDayAsDate(printStart); + this.max = calendar.fromDayAsDate(printEnd); + } + final TimeHeader timeHeader; + if (calendar == null) { + timeHeader = new TimeHeaderSimple(min, max); + } else if (printScale == PrintScale.WEEKLY) { + timeHeader = new TimeHeaderWeekly(calendar, min, max, getDefaultPlan(), colorDays, nameDays); + } else if (printScale == PrintScale.MONTHLY) { + timeHeader = new TimeHeaderMonthly(calendar, min, max, getDefaultPlan(), colorDays, nameDays); + } else { +// timeHeader = new TimeHeaderDaily(calendar, min, max, getDefaultPlan(), colorDays, nameDays, null, null); + timeHeader = new TimeHeaderDaily(calendar, min, max, getDefaultPlan(), colorDays, nameDays, printStart, + printEnd); + } + initTaskAndResourceDraws(timeHeader.getTimeScale(), timeHeader.getFullHeaderHeight()); return new TextBlockBackcolored() { public void drawU(UGraphic ug) { - drawTimeHeader(ug, timeScale); - drawTasks(ug, timeScale); - drawConstraints(ug, timeScale); + timeHeader.drawTimeHeader(ug, totalHeight); + drawConstraints(ug, timeHeader.getTimeScale()); + drawTasksRect(ug); + drawTasksTitle(ug); + drawResources(ug); } public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) { @@ -160,8 +231,8 @@ public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, } public Dimension2D calculateDimension(StringBounder stringBounder) { - final double xmin = timeScale.getStartingPosition(min); - final double xmax = timeScale.getEndingPosition(max); + final double xmin = timeHeader.getTimeScale().getStartingPosition(min); + final double xmax = timeHeader.getTimeScale().getEndingPosition(max); return new Dimension2DDouble(xmax - xmin, totalHeight); } @@ -169,31 +240,55 @@ public MinMax getMinMax(StringBounder stringBounder) { throw new UnsupportedOperationException(); } - public HtmlColor getBackcolor() { + public HColor getBackcolor() { return null; } }; } - private TimeScale getTimeScale() { - if (calendar == null) { - return new TimeScaleBasic(); + private void drawTasksRect(UGraphic ug) { + for (Task task : tasks.values()) { + final TaskDraw draw = draws.get(task); + final UTranslate move = UTranslate.dy(draw.getY()); + draw.drawU(ug.apply(move)); + } + } + + private void drawConstraints(final UGraphic ug, TimeScale timeScale) { + for (GanttConstraint constraint : constraints) { + if (printStart != null && constraint.isHidden(min, max)) { + continue; + } + constraint.getUDrawable(timeScale).drawU(ug); } - return new TimeScaleBasic2(getCalendarSimple()); - // return new TimeScaleWithoutWeekEnd(calendar); } - private GCalendarSimple getCalendarSimple() { - return (GCalendarSimple) calendar; + private void drawTasksTitle(final UGraphic ug1) { + for (Task task : tasks.values()) { + if (isHidden(task)) { + continue; + } + final TaskDraw draw = draws.get(task); + final UTranslate move = UTranslate.dy(draw.getY()); + draw.drawTitle(ug1.apply(move)); + } + } + + private void drawResources(UGraphic ug) { + for (Resource res : resources.values()) { + final ResourceDraw draw = res.getResourceDraw(); + final UTranslate move = UTranslate.dy(draw.getY()); + draw.drawU(ug.apply(move)); + } } public final LoadPlanable getDefaultPlan() { return new LoadPlanable() { - public int getLoadAt(Instant instant) { + public int getLoadAt(Wink instant) { if (calendar == null) { return 100; } - final DayAsDate day = getCalendarSimple().toDayAsDate((InstantDay) instant); + final Day day = calendar.toDayAsDate((Wink) instant); if (isClosed(day)) { return 0; } @@ -202,7 +297,7 @@ public int getLoadAt(Instant instant) { }; } - private boolean isClosed(final DayAsDate day) { + private boolean isClosed(final Day day) { if (openedDayAsDate.contains(day)) { return false; } @@ -214,170 +309,40 @@ public void closeDayOfWeek(DayOfWeek day) { closedDayOfWeek.add(day); } - public void closeDayAsDate(DayAsDate day) { + public void closeDayAsDate(Day day) { closedDayAsDate.add(day); } - public void openDayAsDate(DayAsDate day) { + public void openDayAsDate(Day day) { openedDayAsDate.add(day); } - private void drawConstraints(final UGraphic ug, TimeScale timeScale) { - for (GanttConstraint constraint : constraints) { - constraint.getUDrawable(timeScale).drawU(ug); - } - - } + private final Map draws = new LinkedHashMap(); - private double totalHeight; - - private void drawTimeHeader(final UGraphic ug, TimeScale timeScale) { - - final double xmin = timeScale.getStartingPosition(min); - final double xmax = timeScale.getEndingPosition(max); - if (calendar == null) { - drawSimpleDayCounter(ug, timeScale); - } else { - drawCalendar(ug, timeScale); - } - ug.apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY)).draw(new ULine(xmax - xmin, 0)); - ug.apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY)).apply(new UTranslate(0, getHeaderHeight() - 3)) - .draw(new ULine(xmax - xmin, 0)); - - } - - private final HtmlColor veryLightGray = new HtmlColorSetSimple().getColorIfValid("#E0E8E8"); - - private double getHeaderHeight() { - return getTimeHeaderHeight() + getHeaderNameDayHeight(); - } - - private double getTimeHeaderHeight() { - if (calendar != null) { - return Y_WEEKDAY + Y_NUMDAY; - } - return 16; - } - - private double getHeaderNameDayHeight() { - if (calendar != null && nameDays.size() > 0) { - return 16; - } - return 0; - } - - private static final int Y_WEEKDAY = 16; - private static final int Y_NUMDAY = 28; - - private void drawCalendar(final UGraphic ug, TimeScale timeScale) { - timeScale = new TimeScaleBasic(); - final ULine vbar = new ULine(0, totalHeight - Y_WEEKDAY); - Month lastMonth = null; - final GCalendarSimple calendarAll = getCalendarSimple(); - final Instant max2 = calendarAll.fromDayAsDate(calendar.toDayAsDate((InstantDay) max)); - for (Instant i = min; i.compareTo(max2.increment()) <= 0; i = i.increment()) { - final DayAsDate day = calendarAll.toDayAsDate((InstantDay) i); - final DayOfWeek dayOfWeek = day.getDayOfWeek(); - final boolean isWorkingDay = getDefaultPlan().getLoadAt(i) > 0; - final String d1 = "" + day.getDayOfMonth(); - final TextBlock num = getTextBlock(d1, 10, false); - final double x1 = timeScale.getStartingPosition(i); - final double x2 = timeScale.getEndingPosition(i); - if (i.compareTo(max2.increment()) < 0) { - final TextBlock weekDay = getTextBlock(dayOfWeek.shortName(), 10, false); - - final URectangle rect = new URectangle(x2 - x1 - 1, totalHeight - Y_WEEKDAY); - if (isWorkingDay) { - final HtmlColor back = colorDays.get(day); - if (back != null) { - ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(back)) - .apply(new UTranslate(x1 + 1, Y_WEEKDAY)).draw(rect); - } - drawCenter(ug.apply(new UTranslate(0, Y_NUMDAY)), num, x1, x2); - drawCenter(ug.apply(new UTranslate(0, Y_WEEKDAY)), weekDay, x1, x2); - } else { - ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(veryLightGray)) - .apply(new UTranslate(x1 + 1, Y_WEEKDAY)).draw(rect); - } - if (lastMonth != day.getMonth()) { - final int delta = 5; - if (lastMonth != null) { - final TextBlock lastMonthBlock = getTextBlock(lastMonth.name(), 12, true); - lastMonthBlock.drawU(ug.apply(new UTranslate(x1 - - lastMonthBlock.calculateDimension(ug.getStringBounder()).getWidth() - delta, 0))); - } - final TextBlock month = getTextBlock(day.getMonth().name(), 12, true); - month.drawU(ug.apply(new UTranslate(x1 + delta, 0))); - ug.apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY)).apply(new UTranslate(x1, 0)) - .draw(new ULine(0, Y_WEEKDAY)); - } - lastMonth = day.getMonth(); - } - ug.apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY)).apply(new UTranslate(x1, Y_WEEKDAY)).draw(vbar); - } - - if (nameDays.size() > 0) { - String last = null; - for (Instant i = min; i.compareTo(max2.increment()) <= 0; i = i.increment()) { - final DayAsDate day = calendarAll.toDayAsDate((InstantDay) i); - final String name = nameDays.get(day); - if (name != null && name.equals(last) == false) { - final double x1 = timeScale.getStartingPosition(i); - final double x2 = timeScale.getEndingPosition(i); - final TextBlock label = getTextBlock(name, 12, false); - final double h = label.calculateDimension(ug.getStringBounder()).getHeight(); - double y1 = getTimeHeaderHeight(); - double y2 = getHeaderHeight(); - label.drawU(ug.apply(new UTranslate(x1, Y_NUMDAY + 11))); - } - last = name; - } - - } - } - - private TextBlock getTextBlock(final String text, int size, boolean bold) { - return Display.getWithNewlines(text).create(getFontConfiguration(size, bold), HorizontalAlignment.LEFT, - new SpriteContainerEmpty()); - } - - private void drawCenter(final UGraphic ug, final TextBlock text, final double x1, final double x2) { - final double width = text.calculateDimension(ug.getStringBounder()).getWidth(); - final double delta = (x2 - x1) - width; - if (delta < 0) { - return; - } - text.drawU(ug.apply(new UTranslate(x1 + delta / 2, 0))); - } + private void initTaskAndResourceDraws(TimeScale timeScale, double headerHeight) { + double y = headerHeight; + for (Task task : tasks.values()) { + task.setY(y); + y += task.getHeight(); - private void drawSimpleDayCounter(final UGraphic ug, TimeScale timeScale) { - final ULine vbar = new ULine(0, totalHeight); - for (Instant i = min; i.compareTo(max.increment()) <= 0; i = i.increment()) { - final TextBlock num = Display.getWithNewlines(i.toShortString()).create(getFontConfiguration(10, false), - HorizontalAlignment.LEFT, new SpriteContainerEmpty()); - final double x1 = timeScale.getStartingPosition(i); - final double x2 = timeScale.getEndingPosition(i); - final double width = num.calculateDimension(ug.getStringBounder()).getWidth(); - final double delta = (x2 - x1) - width; - if (i.compareTo(max.increment()) < 0) { - num.drawU(ug.apply(new UTranslate(x1 + delta / 2, 0))); - } - ug.apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY)).apply(new UTranslate(x1, 0)).draw(vbar); } - } - - private void initTaskAndResourceDraws(TimeScale timeScale) { - double y = getHeaderHeight(); for (Task task : tasks.values()) { final TaskDraw draw; if (task instanceof TaskSeparator) { - draw = new TaskDrawSeparator((TaskSeparator) task, timeScale, y, min, max); + draw = new TaskDrawSeparator(((TaskSeparator) task).getName(), timeScale, task.getY(), min, max); } else { - draw = new TaskDrawRegular((TaskImpl) task, timeScale, y); + final TaskImpl tmp = (TaskImpl) task; + if (tmp.isDiamond()) { + draw = new TaskDrawDiamond(timeScale, task.getY(), tmp.getPrettyDisplay(), getStart(tmp)); + } else { + final boolean oddStart = printStart != null && min.compareTo(getStart(tmp)) == 0; + final boolean oddEnd = printStart != null && max.compareTo(getEnd(tmp)) == 0; + draw = new TaskDrawRegular(timeScale, task.getY(), tmp.getPrettyDisplay(), getStart(tmp), + getEnd(tmp), oddStart, oddEnd); + } + draw.setColorsAndCompletion(tmp.getColors(), tmp.getCompletion(), tmp.getUrl()); } - task.setTaskDraw(draw); - y += draw.getHeight(); - + draws.put(task, draw); } for (Resource res : resources.values()) { final ResourceDraw draw = new ResourceDraw(this, res, timeScale, y, min, max); @@ -388,6 +353,20 @@ private void initTaskAndResourceDraws(TimeScale timeScale) { this.totalHeight = y; } + private Wink getStart(final TaskImpl tmp) { + if (printStart == null) { + return tmp.getStart(); + } + return Wink.max(min, tmp.getStart()); + } + + private Wink getEnd(final TaskImpl tmp) { + if (printStart == null) { + return tmp.getEnd(); + } + return Wink.min(max, tmp.getEnd()); + } + private void initMinMax() { if (tasks.size() == 0) { max = min.increment(); @@ -397,8 +376,8 @@ private void initMinMax() { if (task instanceof TaskSeparator) { continue; } - final Instant start = task.getStart(); - final Instant end = task.getEnd(); + final Wink start = task.getStart(); + final Wink end = task.getEnd(); // if (min.compareTo(start) > 0) { // min = start; // } @@ -408,14 +387,14 @@ private void initMinMax() { } } if (calendar != null) { - for (DayAsDate d : colorDays.keySet()) { - final Instant instant = calendar.fromDayAsDate(d); + for (Day d : colorDays.keySet()) { + final Wink instant = calendar.fromDayAsDate(d); if (instant.compareTo(max) > 0) { max = instant; } } - for (DayAsDate d : nameDays.keySet()) { - final Instant instant = calendar.fromDayAsDate(d); + for (Day d : nameDays.keySet()) { + final Wink instant = calendar.fromDayAsDate(d); if (instant.compareTo(max) > 0) { max = instant; } @@ -423,14 +402,14 @@ private void initMinMax() { } } - public DayAsDate getThenDate() { - DayAsDate result = getStartingDate(); - for (DayAsDate d : colorDays.keySet()) { + public Day getThenDate() { + Day result = getStartingDate(); + for (Day d : colorDays.keySet()) { if (d.compareTo(result) > 0) { result = d; } } - for (DayAsDate d : nameDays.keySet()) { + for (Day d : nameDays.keySet()) { if (d.compareTo(result) > 0) { result = d; } @@ -438,28 +417,6 @@ public DayAsDate getThenDate() { return result; } - private void drawTasks(final UGraphic ug, TimeScale timeScale) { - for (Task task : tasks.values()) { - final TaskDraw draw = task.getTaskDraw(); - final UTranslate move = new UTranslate(0, draw.getY()); - draw.drawU(ug.apply(move)); - draw.drawTitle(ug.apply(move)); - } - for (Resource res : resources.values()) { - final ResourceDraw draw = res.getResourceDraw(); - final UTranslate move = new UTranslate(0, draw.getY()); - draw.drawU(ug.apply(move)); - } - } - - private FontConfiguration getFontConfiguration(int size, boolean bold) { - UFont font = UFont.serif(size); - if (bold) { - font = font.bold(); - } - return new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK, false); - } - public Task getExistingTask(String id) { if (id == null) { throw new IllegalArgumentException(); @@ -528,42 +485,40 @@ public void addContraint(GanttConstraint constraint) { constraints.add(constraint); } - public IHtmlColorSet getIHtmlColorSet() { + public HColorSet getIHtmlColorSet() { return colorSet; } - public void setStartingDate(DayAsDate start) { - this.calendar = new GCalendarSimple(start); + public void setStartingDate(Day start) { + this.calendar = new GCalendar(start); } - public DayAsDate getStartingDate() { + public Day getStartingDate() { if (this.calendar == null) { return null; } return this.calendar.getStartingDate(); } - public DayAsDate getStartingDate(int nday) { + public Day getStartingDate(int nday) { if (this.calendar == null) { return null; } - return ((GCalendarSimple) this.calendar).toDayAsDate(new InstantDay(nday)); + return this.calendar.toDayAsDate(new Wink(nday)); } public int daysInWeek() { return 7 - closedDayOfWeek.size(); } - public Instant convert(DayAsDate day) { + public Wink convert(Day day) { return calendar.fromDayAsDate(day); } - public boolean isOpen(DayAsDate day) { + public boolean isOpen(Day day) { return getDefaultPlan().getLoadAt(convert(day)) > 0; } - private final Map resources = new LinkedHashMap(); - public void affectResource(Task result, String description) { final Pattern p = Pattern.compile("([^:]+)(:(\\d+))?"); final Matcher m = p.matcher(description); @@ -581,13 +536,13 @@ public void affectResource(Task result, String description) { public Resource getResource(String resourceName) { Resource resource = resources.get(resourceName); if (resource == null) { - resource = new Resource(resourceName, getDefaultPlan()); + resource = new Resource(resourceName, getDefaultPlan(), calendar); } resources.put(resourceName, resource); return resource; } - public int getLoadForResource(Resource res, Instant i) { + public int getLoadForResource(Resource res, Wink i) { int result = 0; for (Task task : tasks.values()) { if (task instanceof TaskSeparator) { @@ -599,15 +554,12 @@ public int getLoadForResource(Resource res, Instant i) { return result; } - private final Map colorDays = new HashMap(); - private final Map nameDays = new HashMap(); - public Moment getExistingMoment(String id) { Moment result = getExistingTask(id); if (result == null) { - DayAsDate start = null; - DayAsDate end = null; - for (Map.Entry ent : nameDays.entrySet()) { + Day start = null; + Day end = null; + for (Map.Entry ent : nameDays.entrySet()) { if (ent.getValue().equalsIgnoreCase(id) == false) { continue; } @@ -621,7 +573,7 @@ public Moment getExistingMoment(String id) { return result; } - private DayAsDate min(DayAsDate d1, DayAsDate d2) { + private Day min(Day d1, Day d2) { if (d1 == null) { return d2; } @@ -631,7 +583,7 @@ private DayAsDate min(DayAsDate d1, DayAsDate d2) { return d1; } - private DayAsDate max(DayAsDate d1, DayAsDate d2) { + private Day max(Day d1, Day d2) { if (d1 == null) { return d2; } @@ -641,31 +593,34 @@ private DayAsDate max(DayAsDate d1, DayAsDate d2) { return d1; } - public void colorDay(DayAsDate day, HtmlColor color) { + public void colorDay(Day day, HColor color) { colorDays.put(day, color); } - public void nameDay(DayAsDate day, String name) { + public void nameDay(Day day, String name) { nameDays.put(day, name); } public void setTodayColors(ComplementColors colors) { if (today == null) { - this.today = DayAsDate.today(); + this.today = Day.today(); } colorDay(today, colors.getCenter()); } - private DayAsDate today; - - public CommandExecutionResult setToday(DayAsDate date) { + public CommandExecutionResult setToday(Day date) { this.today = date; return CommandExecutionResult.ok(); } public CommandExecutionResult deleteTask(Task task) { - task.setColors(new ComplementColors(HtmlColorUtils.WHITE, HtmlColorUtils.BLACK)); + task.setColors(new ComplementColors(HColorUtils.WHITE, HColorUtils.BLACK)); return CommandExecutionResult.ok(); } + public void setPrintInterval(Day start, Day end) { + this.printStart = start; + this.printEnd = end; + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/GanttDiagramFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/GanttDiagramFactory.java similarity index 69% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/GanttDiagramFactory.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/GanttDiagramFactory.java index 92d50b8fd..f58a1b673 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/GanttDiagramFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/GanttDiagramFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,12 +28,11 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.List; import net.sourceforge.plantuml.command.Command; @@ -41,11 +40,31 @@ import net.sourceforge.plantuml.command.CommandScale; import net.sourceforge.plantuml.command.UmlDiagramFactory; import net.sourceforge.plantuml.core.DiagramType; +import net.sourceforge.plantuml.project.command.CommandColorTask; +import net.sourceforge.plantuml.project.command.CommandGanttArrow; +import net.sourceforge.plantuml.project.command.CommandGanttArrow2; +import net.sourceforge.plantuml.project.command.CommandPage; +import net.sourceforge.plantuml.project.command.CommandPrintBetween; +import net.sourceforge.plantuml.project.command.CommandPrintScale; +import net.sourceforge.plantuml.project.command.CommandSeparator; +import net.sourceforge.plantuml.project.command.NaturalCommand; +import net.sourceforge.plantuml.project.command.NaturalCommandAnd; +import net.sourceforge.plantuml.project.command.NaturalCommandAndAnd; +import net.sourceforge.plantuml.project.lang.ComplementPattern; +import net.sourceforge.plantuml.project.lang.SubjectDayAsDate; +import net.sourceforge.plantuml.project.lang.SubjectDayOfWeek; +import net.sourceforge.plantuml.project.lang.SubjectDaysAsDates; +import net.sourceforge.plantuml.project.lang.SubjectPattern; +import net.sourceforge.plantuml.project.lang.SubjectProject; +import net.sourceforge.plantuml.project.lang.SubjectResource; +import net.sourceforge.plantuml.project.lang.SubjectTask; +import net.sourceforge.plantuml.project.lang.SubjectToday; +import net.sourceforge.plantuml.project.lang.VerbPattern; public class GanttDiagramFactory extends UmlDiagramFactory { static private final List subjects() { - return Arrays. asList(new SubjectTask(), new SubjectProject(), new SubjectDayOfWeek(), + return Arrays.asList(new SubjectTask(), new SubjectProject(), new SubjectDayOfWeek(), new SubjectDayAsDate(), new SubjectDaysAsDates(), new SubjectResource(), new SubjectToday()); } @@ -64,8 +83,11 @@ protected List createCommands() { cmds.addAll(getLanguageCommands()); cmds.add(new CommandGanttArrow()); cmds.add(new CommandGanttArrow2()); + cmds.add(new CommandColorTask()); cmds.add(new CommandSeparator()); + cmds.add(new CommandPrintScale()); + cmds.add(new CommandPrintBetween()); cmds.add(new CommandScale()); cmds.add(new CommandPage()); // cmds.add(new CommandScaleWidthAndHeight()); @@ -98,7 +120,8 @@ private static Collection getLanguageCommands() { } for (ComplementPattern complement1 : verb1.getComplements()) { for (ComplementPattern complement2 : verb2.getComplements()) { - cache.add(NaturalCommandAnd.create(subject, verb1, complement1, verb2, complement2)); + cache.add( + NaturalCommandAnd.create(subject, verb1, complement1, verb2, complement2)); } } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/DefinesGet.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/Load.java similarity index 68% rename from src/plantuml-asl/src/net/sourceforge/plantuml/preproc/DefinesGet.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/Load.java index 09f526168..cc8c023da 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/DefinesGet.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/Load.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,26 +28,24 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.preproc; +package net.sourceforge.plantuml.project; -public class DefinesGet { +import net.sourceforge.plantuml.project.lang.Complement; - private final Defines defines; +public class Load implements Value, Complement { - public DefinesGet(Defines defines) { - this.defines = defines; - } + private final int winks; - public final Defines get() { - return defines; + private Load(int winks) { + this.winks = winks; } - public void saveState() { - this.defines.saveState1(); + public static Load inWinks(int winks) { + return new Load(winks); } - public void restoreState() { - this.defines.restoreState1(); + public int getFullLoad() { + return winks * 100; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/LoadPlanable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/LoadPlanable.java similarity index 79% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/LoadPlanable.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/LoadPlanable.java index 20925adb9..020835f90 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/LoadPlanable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/LoadPlanable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,9 +28,11 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project; + +import net.sourceforge.plantuml.project.time.Wink; public interface LoadPlanable { - public int getLoadAt(Instant instant); + public int getLoadAt(Wink instant); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/PlanUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/PlanUtils.java similarity index 82% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/PlanUtils.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/PlanUtils.java index 22b2b3d08..a151b3c8a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/PlanUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/PlanUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,9 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project; + +import net.sourceforge.plantuml.project.time.Wink; public class PlanUtils { @@ -38,7 +40,7 @@ private PlanUtils() { public static LoadPlanable minOf(final LoadPlanable p1, final LoadPlanable p2) { return new LoadPlanable() { - public int getLoadAt(Instant instant) { + public int getLoadAt(Wink instant) { return Math.min(p1.getLoadAt(instant), p2.getLoadAt(instant)); } }; @@ -46,7 +48,7 @@ public int getLoadAt(Instant instant) { public static LoadPlanable multiply(final LoadPlanable p1, final LoadPlanable p2) { return new LoadPlanable() { - public int getLoadAt(Instant instant) { + public int getLoadAt(Wink instant) { return p1.getLoadAt(instant) * p2.getLoadAt(instant) / 100; } }; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Solver3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/Solver3.java similarity index 80% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/Solver3.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/Solver3.java index aacfca31e..fbb34573e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Solver3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/Solver3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,13 +28,16 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; +import net.sourceforge.plantuml.project.core.TaskAttribute; +import net.sourceforge.plantuml.project.time.Wink; + public class Solver3 { private final Map values = new LinkedHashMap(); @@ -48,8 +51,8 @@ public Solver3(LoadPlanable loadPlanable) { public void setData(TaskAttribute attribute, Value value) { final Value previous = values.remove(attribute); if (previous != null && attribute == TaskAttribute.START) { - final Instant previousInstant = (Instant) previous; - if (previousInstant.compareTo((Instant) value) > 0) { + final Wink previousInstant = (Wink) previous; + if (previousInstant.compareTo((Wink) value) > 0) { value = previous; } } @@ -76,14 +79,14 @@ public Value getData(TaskAttribute attribute) { if (attribute == TaskAttribute.START) { return computeStart(); } - return LoadInDays.inDay(1); + return Load.inWinks(1); // throw new UnsupportedOperationException(attribute.toString()); } return result; } - private Instant computeEnd() { - Instant current = (Instant) values.get(TaskAttribute.START); + private Wink computeEnd() { + Wink current = (Wink) values.get(TaskAttribute.START); int fullLoad = ((Load) values.get(TaskAttribute.LOAD)).getFullLoad(); while (fullLoad > 0) { fullLoad -= loadPlanable.getLoadAt(current); @@ -92,12 +95,15 @@ private Instant computeEnd() { return current.decrement(); } - private Instant computeStart() { - Instant current = (Instant) values.get(TaskAttribute.END); + private Wink computeStart() { + Wink current = (Wink) values.get(TaskAttribute.END); int fullLoad = ((Load) values.get(TaskAttribute.LOAD)).getFullLoad(); while (fullLoad > 0) { fullLoad -= loadPlanable.getLoadAt(current); current = current.decrement(); + if (current.getWink() <= 0) { + return current; + } } return current.increment(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Today.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/Today.java similarity index 82% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/Today.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/Today.java index caa6dd6ec..132a3ba91 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Today.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/Today.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,9 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project; + +import net.sourceforge.plantuml.project.lang.Subject; public class Today implements Subject { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Value.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/Value.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/Value.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/Value.java index 9d37189f2..90124e528 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Value.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/Value.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project; public interface Value { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandColorTask.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandColorTask.java new file mode 100644 index 000000000..cd01aa50d --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandColorTask.java @@ -0,0 +1,77 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.command; + +import net.sourceforge.plantuml.LineLocation; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.SingleLineCommand2; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Task; +import net.sourceforge.plantuml.project.lang.ComplementColors; +import net.sourceforge.plantuml.ugraphic.color.HColor; + +public class CommandColorTask extends SingleLineCommand2 { + + public CommandColorTask() { + super(getRegexConcat()); + } + + static IRegex getRegexConcat() { + return RegexConcat.build(CommandColorTask.class.getName(), RegexLeaf.start(), // + new RegexLeaf("CODE", "\\[([\\p{L}0-9_.]+)\\]"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("COLORS", "#(\\w+)(?:/(#?\\w+))?"), // + RegexLeaf.spaceZeroOrMore(), RegexLeaf.end()); + } + + @Override + protected CommandExecutionResult executeArg(GanttDiagram diagram, LineLocation location, RegexResult arg) { + + final String code = arg.get("CODE", 0); + final Task task = diagram.getExistingTask(code); + if (task == null) { + return CommandExecutionResult.error("No such task " + code); + } + + final String color1 = arg.get("COLORS", 0); + final String color2 = arg.get("COLORS", 1); + final HColor col1 = diagram.getIHtmlColorSet().getColorIfValid(color1); + final HColor col2 = diagram.getIHtmlColorSet().getColorIfValid(color2); + task.setColors(new ComplementColors(col1, col2)); + + return CommandExecutionResult.ok(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/CommandGanttArrow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandGanttArrow.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/CommandGanttArrow.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandGanttArrow.java index c94763fff..552289d0b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/CommandGanttArrow.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandGanttArrow.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -37,6 +37,11 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttConstraint; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Task; +import net.sourceforge.plantuml.project.core.TaskAttribute; +import net.sourceforge.plantuml.project.core.TaskInstant; public class CommandGanttArrow extends SingleLineCommand2 { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/CommandGanttArrow2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandGanttArrow2.java similarity index 89% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/CommandGanttArrow2.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandGanttArrow2.java index acff8d3bc..8ad29e4fa 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/CommandGanttArrow2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandGanttArrow2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -37,6 +37,8 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Task; public class CommandGanttArrow2 extends SingleLineCommand2 { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/CommandPage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandPage.java similarity index 91% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/CommandPage.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandPage.java index 0ceb97561..eb88c2427 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/CommandPage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandPage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -37,6 +37,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; public class CommandPage extends SingleLineCommand2 { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandPrintBetween.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandPrintBetween.java new file mode 100644 index 000000000..d0d73f1fd --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandPrintBetween.java @@ -0,0 +1,75 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.command; + +import net.sourceforge.plantuml.LineLocation; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.SingleLineCommand2; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.lang.ComplementDate; +import net.sourceforge.plantuml.project.time.Day; + +public class CommandPrintBetween extends SingleLineCommand2 { + + private static final ComplementDate pattern = new ComplementDate(); + + public CommandPrintBetween() { + super(getRegexConcat()); + } + + static IRegex getRegexConcat() { + return RegexConcat.build(CommandPrintBetween.class.getName(), RegexLeaf.start(), // + // Print between 2020/02/14 and 2020/03/04 + new RegexLeaf("print"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("between"), // + RegexLeaf.spaceOneOrMore(), // + pattern.toRegex("START"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("and"), // + RegexLeaf.spaceOneOrMore(), // + pattern.toRegex("END"), // + RegexLeaf.end()); // + } + + @Override + protected CommandExecutionResult executeArg(GanttDiagram diagram, LineLocation location, RegexResult arg) { + final Day start = (Day) pattern.getComplement(diagram, arg, "START").get(); + final Day end = (Day) pattern.getComplement(diagram, arg, "END").get(); + diagram.setPrintInterval(start, end); + return CommandExecutionResult.ok(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandPrintScale.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandPrintScale.java new file mode 100644 index 000000000..723fac6c7 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandPrintScale.java @@ -0,0 +1,71 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.command; + +import net.sourceforge.plantuml.LineLocation; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.SingleLineCommand2; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexOr; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.PrintScale; + +public class CommandPrintScale extends SingleLineCommand2 { + + public CommandPrintScale() { + super(getRegexConcat()); + } + + static IRegex getRegexConcat() { + return RegexConcat.build(CommandPrintScale.class.getName(), RegexLeaf.start(), // + new RegexOr(new RegexLeaf("projectscale"), // + new RegexLeaf("ganttscale"), // + new RegexLeaf("printscale")), // + RegexLeaf.spaceOneOrMore(), // + new RegexOr("SCALE", // + new RegexLeaf("monthly"), // + new RegexLeaf("daily"), // + new RegexLeaf("weekly")), // + RegexLeaf.end()); // + } + + @Override + protected CommandExecutionResult executeArg(GanttDiagram diagram, LineLocation location, RegexResult arg) { + final String scaleString = arg.get("SCALE", 0); + final PrintScale scale = PrintScale.fromString(scaleString); + diagram.setPrintScale(scale); + return CommandExecutionResult.ok(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/CommandSeparator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandSeparator.java similarity index 89% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/CommandSeparator.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandSeparator.java index 0d10e576f..0ef3d0298 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/CommandSeparator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/CommandSeparator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -37,6 +37,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; public class CommandSeparator extends SingleLineCommand2 { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/NaturalCommand.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/NaturalCommand.java similarity index 82% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/NaturalCommand.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/command/NaturalCommand.java index 2256376c0..ad16362b6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/NaturalCommand.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/NaturalCommand.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.Command; @@ -37,6 +37,15 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.Failable; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.lang.Complement; +import net.sourceforge.plantuml.project.lang.ComplementEmpty; +import net.sourceforge.plantuml.project.lang.ComplementPattern; +import net.sourceforge.plantuml.project.lang.Subject; +import net.sourceforge.plantuml.project.lang.SubjectPattern; +import net.sourceforge.plantuml.project.lang.Verb; +import net.sourceforge.plantuml.project.lang.VerbPattern; public class NaturalCommand extends SingleLineCommand2 { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/NaturalCommandAnd.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/NaturalCommandAnd.java similarity index 86% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/NaturalCommandAnd.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/command/NaturalCommandAnd.java index 7015ddd1e..fe4481712 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/NaturalCommandAnd.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/NaturalCommandAnd.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.Command; @@ -37,6 +37,14 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.Failable; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.lang.Complement; +import net.sourceforge.plantuml.project.lang.ComplementPattern; +import net.sourceforge.plantuml.project.lang.Subject; +import net.sourceforge.plantuml.project.lang.SubjectPattern; +import net.sourceforge.plantuml.project.lang.Verb; +import net.sourceforge.plantuml.project.lang.VerbPattern; public class NaturalCommandAnd extends SingleLineCommand2 { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/NaturalCommandAndAnd.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/NaturalCommandAndAnd.java similarity index 88% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/NaturalCommandAndAnd.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/command/NaturalCommandAndAnd.java index 72999f6a3..614d0b2aa 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/NaturalCommandAndAnd.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/command/NaturalCommandAndAnd.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.Command; @@ -37,6 +37,13 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.lang.Complement; +import net.sourceforge.plantuml.project.lang.ComplementPattern; +import net.sourceforge.plantuml.project.lang.Subject; +import net.sourceforge.plantuml.project.lang.SubjectPattern; +import net.sourceforge.plantuml.project.lang.Verb; +import net.sourceforge.plantuml.project.lang.VerbPattern; public class NaturalCommandAndAnd extends SingleLineCommand2 { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/InstantDay.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/AbstractTask.java similarity index 56% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/InstantDay.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/core/AbstractTask.java index e2f2b469f..9c8ecc834 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/InstantDay.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/AbstractTask.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,39 +28,41 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.core; -public class InstantDay implements Instant { +import net.sourceforge.plantuml.Direction; - private final int numDay; +public abstract class AbstractTask implements Task { - public InstantDay(int numDay) { - this.numDay = numDay; - } + public static final double HEIGHT = 16; - @Override - public String toString() { - return "(day +" + numDay + ")"; + public double getHeight() { + return HEIGHT; } - public InstantDay increment() { - return new InstantDay(numDay + 1); - } + protected final TaskCode code; + private double y; - public InstantDay decrement() { - return new InstantDay(numDay - 1); + protected AbstractTask(TaskCode code) { + this.code = code; } - final int getNumDay() { - return numDay; + public final double getY() { + return y; } - public int compareTo(Instant other) { - return this.numDay - ((InstantDay) other).numDay; + public final void setY(double y) { + this.y = y; } - public String toShortString() { - return "" + (numDay + 1); + public double getY(Direction direction) { + if (direction == Direction.UP) { + return y; + } + if (direction == Direction.DOWN) { + return y + getHeight(); + } + return y + getHeight() / 2; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Moment.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/Moment.java similarity index 78% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/Moment.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/core/Moment.java index d2e6b9dcd..9a8de5751 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Moment.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/Moment.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,12 +28,14 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.core; + +import net.sourceforge.plantuml.project.time.Wink; public interface Moment { - public Instant getStart(); + public Wink getStart(); - public Instant getEnd(); + public Wink getEnd(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/MomentImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/MomentImpl.java similarity index 74% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/MomentImpl.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/core/MomentImpl.java index 2ce14f3de..5afa218f9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/MomentImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/MomentImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,23 +28,25 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.core; + +import net.sourceforge.plantuml.project.time.Wink; public class MomentImpl implements Moment { - private final Instant start; - private final Instant end; + private final Wink start; + private final Wink end; - public MomentImpl(Instant start, Instant end) { + public MomentImpl(Wink start, Wink end) { this.start = start; this.end = end; } - public Instant getStart() { + public Wink getStart() { return start; } - public Instant getEnd() { + public Wink getEnd() { return end; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineSingle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/PrintScale.java similarity index 64% rename from src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineSingle.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/core/PrintScale.java index 55546a17f..0fcae781a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/preproc/ReadLineSingle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/PrintScale.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,28 +28,28 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.preproc; +package net.sourceforge.plantuml.project.core; -import net.sourceforge.plantuml.StringLocated; +public enum PrintScale { + DAILY(1), WEEKLY(4), MONTHLY(15); -public class ReadLineSingle implements ReadLine { + private final int compress; - private final StringLocated data; - private int current = 0; - - public ReadLineSingle(StringLocated s2) { - this.data = s2; + private PrintScale(int compress) { + this.compress = compress; } - public void close() { + public int getCompress() { + return compress; } - public StringLocated readLine() { - if (current > 0) { - return null; + static public PrintScale fromString(String value) { + if (value.startsWith("w")) { + return WEEKLY; + } + if (value.startsWith("m")) { + return MONTHLY; } - current++; - return data; + return DAILY; } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/Resource.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/Resource.java new file mode 100644 index 000000000..f69f18999 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/Resource.java @@ -0,0 +1,113 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.core; + +import java.util.Collection; +import java.util.EnumSet; +import java.util.Set; +import java.util.TreeSet; + +import net.sourceforge.plantuml.project.LoadPlanable; +import net.sourceforge.plantuml.project.draw.ResourceDraw; +import net.sourceforge.plantuml.project.lang.Subject; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.DayOfWeek; +import net.sourceforge.plantuml.project.time.GCalendar; +import net.sourceforge.plantuml.project.time.Wink; + +public class Resource implements Subject { + + private final String name; + private ResourceDraw draw; + private final Set closed = new TreeSet(); + private final Set forcedOn = new TreeSet(); + private final GCalendar calendar; + + private final Collection closedDayOfWeek = EnumSet.noneOf(DayOfWeek.class); + + public Resource(String name, LoadPlanable loadPlanable, GCalendar calendar) { + this.name = name; + this.calendar = calendar; + } + + @Override + public int hashCode() { + return name.hashCode(); + } + + @Override + public boolean equals(Object obj) { + final Resource other = (Resource) obj; + return this.name.equals(other.name); + } + + @Override + public String toString() { + return name; + } + + public String getName() { + return name; + } + + public ResourceDraw getResourceDraw() { + return draw; + } + + public void setTaskDraw(ResourceDraw draw) { + this.draw = draw; + } + + public boolean isClosedAt(Wink instant) { + if (this.forcedOn.contains(instant)) { + return false; + } + if (closedDayOfWeek.size() > 0 && calendar != null) { + final Day d = calendar.toDayAsDate((Wink) instant); + if (closedDayOfWeek.contains(d.getDayOfWeek())) { + return true; + } + } + return this.closed.contains(instant); + } + + public void addCloseDay(Wink instant) { + this.closed.add(instant); + } + + public void addForceOnDay(Wink instant) { + this.forcedOn.add(instant); + } + + public void addCloseDay(DayOfWeek dayOfWeek) { + closedDayOfWeek.add(dayOfWeek); + } +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Task.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/Task.java similarity index 62% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/Task.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/core/Task.java index 52f49ef2b..104c8a584 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Task.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/Task.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,35 +28,49 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.core; + +import net.sourceforge.plantuml.Direction; +import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.project.Load; +import net.sourceforge.plantuml.project.lang.ComplementColors; +import net.sourceforge.plantuml.project.lang.Subject; +import net.sourceforge.plantuml.project.time.Wink; public interface Task extends Subject, Moment { public TaskCode getCode(); - public Instant getStart(); + public Wink getStart(); - public Instant getEnd(); + public Wink getEnd(); public Load getLoad(); public void setLoad(Load load); - public void setStart(Instant start); - - public void setEnd(Instant end); - - public void setTaskDraw(TaskDraw taskDraw); + public void setStart(Wink start); - public TaskDraw getTaskDraw(); + public void setEnd(Wink end); public void setColors(ComplementColors colors); public void addResource(Resource resource, int percentage); public void setDiamond(boolean diamond); - + public boolean isDiamond(); + public void setCompletion(int completion); + + public void setUrl(Url url); + + public double getHeight(); + + public double getY(); + + public void setY(double y); + + public double getY(Direction direction); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskAttribute.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/TaskAttribute.java similarity index 86% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskAttribute.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/core/TaskAttribute.java index 687832204..4cbb5ae96 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskAttribute.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/TaskAttribute.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.core; public enum TaskAttribute { START, END, LOAD; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskCode.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/TaskCode.java similarity index 89% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskCode.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/core/TaskCode.java index fc8379ba2..3ab1f3e80 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskCode.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/TaskCode.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.core; public class TaskCode { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/TaskImpl.java similarity index 73% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskImpl.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/core/TaskImpl.java index aaff3ef7e..f7bea9449 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/TaskImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,29 +28,43 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.core; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; -public class TaskImpl implements Task, LoadPlanable { +import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.project.Load; +import net.sourceforge.plantuml.project.LoadPlanable; +import net.sourceforge.plantuml.project.PlanUtils; +import net.sourceforge.plantuml.project.Solver3; +import net.sourceforge.plantuml.project.lang.ComplementColors; +import net.sourceforge.plantuml.project.time.Wink; + +public class TaskImpl extends AbstractTask implements Task, LoadPlanable { - private final TaskCode code; private final Solver3 solver; private final Map resources2 = new LinkedHashMap(); private final LoadPlanable defaultPlan; private boolean diamond; + private Url url; + private ComplementColors colors; + + public void setUrl(Url url) { + this.url = url; + } + public TaskImpl(TaskCode code, LoadPlanable defaultPlan) { - this.code = code; + super(code); this.defaultPlan = defaultPlan; this.solver = new Solver3(this); - setStart(new InstantDay(0)); - setLoad(LoadInDays.inDay(1)); + setStart(new Wink(0)); + setLoad(Load.inWinks(1)); } - public int getLoadAt(Instant instant) { + public int getLoadAt(Wink instant) { LoadPlanable result = defaultPlan; if (resources2.size() > 0) { result = PlanUtils.multiply(defaultPlan, getRessourcePlan()); @@ -59,8 +73,9 @@ public int getLoadAt(Instant instant) { // return PlanUtils.minOf(getLoad(), plan1).getLoadAt(instant); } - public int loadForResource(Resource res, Instant instant) { - if (resources2.keySet().contains(res) && instant.compareTo(getStart()) >= 0 && instant.compareTo(getEnd()) <= 0) { + public int loadForResource(Resource res, Wink instant) { + if (resources2.keySet().contains(res) && instant.compareTo(getStart()) >= 0 + && instant.compareTo(getEnd()) <= 0) { if (res.isClosedAt(instant)) { return 0; } @@ -82,7 +97,7 @@ private LoadPlanable getRessourcePlan() { } return new LoadPlanable() { - public int getLoadAt(Instant instant) { + public int getLoadAt(Wink instant) { int result = 0; for (Map.Entry ent : resources2.entrySet()) { final Resource res = ent.getKey(); @@ -132,16 +147,16 @@ public TaskCode getCode() { return code; } - public Instant getStart() { - Instant result = (Instant) solver.getData(TaskAttribute.START); + public Wink getStart() { + Wink result = (Wink) solver.getData(TaskAttribute.START); while (getLoadAt(result) == 0) { result = result.increment(); } return result; } - public Instant getEnd() { - return (Instant) solver.getData(TaskAttribute.END); + public Wink getEnd() { + return (Wink) solver.getData(TaskAttribute.END); } public Load getLoad() { @@ -152,26 +167,14 @@ public void setLoad(Load load) { solver.setData(TaskAttribute.LOAD, load); } - public void setStart(Instant start) { + public void setStart(Wink start) { solver.setData(TaskAttribute.START, start); } - public void setEnd(Instant end) { + public void setEnd(Wink end) { solver.setData(TaskAttribute.END, end); } - private TaskDraw taskDraw; - private ComplementColors colors; - - public void setTaskDraw(TaskDraw taskDraw) { - taskDraw.setColors(colors); - this.taskDraw = taskDraw; - } - - public TaskDraw getTaskDraw() { - return taskDraw; - } - public void setColors(ComplementColors colors) { this.colors = colors; } @@ -188,4 +191,22 @@ public boolean isDiamond() { return this.diamond; } + private int completion = 100; + + public void setCompletion(int completion) { + this.completion = completion; + } + + public final Url getUrl() { + return url; + } + + public final ComplementColors getColors() { + return colors; + } + + public final int getCompletion() { + return completion; + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskInstant.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/TaskInstant.java similarity index 86% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskInstant.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/core/TaskInstant.java index b2f47e225..1dd15e51a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskInstant.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/TaskInstant.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,10 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.core; + +import net.sourceforge.plantuml.project.lang.Complement; +import net.sourceforge.plantuml.project.time.Wink; public class TaskInstant implements Complement { @@ -53,7 +56,7 @@ public TaskInstant withDelta(int newDelta) { return new TaskInstant(task, attribute, newDelta); } - private Instant manageDelta(Instant value) { + private Wink manageDelta(Wink value) { if (delta > 0) { for (int i = 0; i < delta; i++) { value = value.increment(); @@ -67,7 +70,7 @@ private Instant manageDelta(Instant value) { return value; } - public Instant getInstantPrecise() { + public Wink getInstantPrecise() { if (attribute == TaskAttribute.START) { return manageDelta(task.getStart()); } @@ -77,7 +80,7 @@ public Instant getInstantPrecise() { throw new IllegalStateException(); } - public Instant getInstantTheorical() { + public Wink getInstantTheorical() { if (attribute == TaskAttribute.START) { return manageDelta(task.getStart()); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskSeparator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/TaskSeparator.java similarity index 71% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskSeparator.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/core/TaskSeparator.java index 214f6dce2..a1f4a4c2d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskSeparator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/core/TaskSeparator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,17 +28,19 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.core; -public class TaskSeparator implements Task { - // public static final double SPACE = 15; +import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.project.Load; +import net.sourceforge.plantuml.project.lang.ComplementColors; +import net.sourceforge.plantuml.project.time.Wink; + +public class TaskSeparator extends AbstractTask implements Task { - private final TaskCode code; private final String comment; - private TaskDraw taskDraw; public TaskSeparator(String comment, int id) { - this.code = new TaskCode("##" + id); + super(new TaskCode("##" + id)); this.comment = comment; } @@ -46,29 +48,20 @@ public TaskCode getCode() { return code; } - public Instant getStart() { + public Wink getStart() { throw new UnsupportedOperationException(); } - public Instant getEnd() { + public Wink getEnd() { throw new UnsupportedOperationException(); } - public void setStart(Instant start) { + public void setStart(Wink start) { throw new UnsupportedOperationException(); } - public void setEnd(Instant end) { + public void setEnd(Wink end) { throw new UnsupportedOperationException(); - - } - - public void setTaskDraw(TaskDraw taskDraw) { - this.taskDraw = taskDraw; - } - - public TaskDraw getTaskDraw() { - return taskDraw; } public void setColors(ComplementColors colors) { @@ -99,4 +92,12 @@ public boolean isDiamond() { throw new UnsupportedOperationException(); } + public void setCompletion(int completion) { + throw new UnsupportedOperationException(); + } + + public void setUrl(Url url) { + throw new UnsupportedOperationException(); + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/AbstractTaskDraw.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/AbstractTaskDraw.java new file mode 100644 index 000000000..693e7a439 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/AbstractTaskDraw.java @@ -0,0 +1,68 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.draw; + +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.project.core.AbstractTask; +import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.timescale.TimeScale; + +public abstract class AbstractTaskDraw implements TaskDraw { + + protected final TimeScale timeScale; + protected final double y; + protected final String prettyDisplay; + protected final Wink start; + + protected final double margin = 2; + + public AbstractTaskDraw(TimeScale timeScale, double y, String prettyDisplay, Wink start) { + this.y = y; + this.start = start; + this.prettyDisplay = prettyDisplay; + this.timeScale = timeScale; + } + + abstract protected FontConfiguration getFontConfiguration(); + + final protected double getShapeHeight() { + return getHeight() - 2 * margin; + } + + final public double getHeight() { + return AbstractTask.HEIGHT; + } + + final public double getY() { + return y; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/PathUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/PathUtils.java new file mode 100644 index 000000000..994f6b057 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/PathUtils.java @@ -0,0 +1,63 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.draw; + +import java.awt.geom.Point2D; + +import net.sourceforge.plantuml.ugraphic.UPath; + +public class PathUtils { + + private final static double round = 4; + + public static UPath UtoRight(double width, double height) { + final UPath result = new UPath(); + result.moveTo(0, 0); + result.lineTo(width - round, 0); + result.arcTo(new Point2D.Double(width, round), round, 0, 1); + result.lineTo(width, height - round); + result.arcTo(new Point2D.Double(width - round, height), round, 0, 1); + result.lineTo(0, height); + return result; + } + + public static UPath UtoLeft(double width, double height) { + final UPath result = new UPath(); + result.moveTo(width, height); + result.lineTo(round, height); + result.arcTo(new Point2D.Double(0, height - round), round, 0, 1); + result.lineTo(0, round); + result.arcTo(new Point2D.Double(round, 0), round, 0, 1); + result.lineTo(width, 0); + return result; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ResourceDraw.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/ResourceDraw.java similarity index 73% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/ResourceDraw.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/ResourceDraw.java index baa9f7251..dea64303d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ResourceDraw.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/ResourceDraw.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,32 +28,35 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.draw; import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Resource; +import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class ResourceDraw implements UDrawable { private final Resource res; private final TimeScale timeScale; private final double y; - private final Instant min; - private final Instant max; + private final Wink min; + private final Wink max; private final GanttDiagram gantt; - public ResourceDraw(GanttDiagram gantt, Resource res, TimeScale timeScale, double y, Instant min, Instant max) { + public ResourceDraw(GanttDiagram gantt, Resource res, TimeScale timeScale, double y, Wink min, Wink max) { this.res = res; this.timeScale = timeScale; this.y = y; @@ -66,14 +69,14 @@ public void drawU(UGraphic ug) { final TextBlock title = Display.getWithNewlines(res.getName()).create(getFontConfiguration(13), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); title.drawU(ug); - final ULine line = new ULine(timeScale.getEndingPosition(max) - timeScale.getStartingPosition(min), 0); - ug.apply(new UChangeColor(HtmlColorUtils.BLACK)) - .apply(new UTranslate(0, title.calculateDimension(ug.getStringBounder()).getHeight())).draw(line); - for (Instant i = min; i.compareTo(max) <= 0; i = i.increment()) { + final ULine line = ULine.hline(timeScale.getEndingPosition(max) - timeScale.getStartingPosition(min)); + ug.apply(HColorUtils.BLACK) + .apply(UTranslate.dy(title.calculateDimension(ug.getStringBounder()).getHeight())).draw(line); + for (Wink i = min; i.compareTo(max) <= 0; i = i.increment()) { final int load = gantt.getLoadForResource(res, i); if (load > 0) { - final FontConfiguration fontConfiguration = getFontConfiguration(9, load > 100 ? HtmlColorUtils.RED - : HtmlColorUtils.BLACK); + final FontConfiguration fontConfiguration = getFontConfiguration(9, load > 100 ? HColorUtils.RED + : HColorUtils.BLACK); final TextBlock value = Display.getWithNewlines("" + load).create(fontConfiguration, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); final double start = (timeScale.getStartingPosition(i) + timeScale.getEndingPosition(i)) / 2 @@ -86,10 +89,10 @@ public void drawU(UGraphic ug) { } private FontConfiguration getFontConfiguration(int size) { - return getFontConfiguration(size, HtmlColorUtils.BLACK); + return getFontConfiguration(size, HColorUtils.BLACK); } - private FontConfiguration getFontConfiguration(int size, HtmlColor color) { + private FontConfiguration getFontConfiguration(int size, HColor color) { final UFont font = UFont.serif(size); return new FontConfiguration(font, color, color, false); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskDraw.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TaskDraw.java similarity index 77% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskDraw.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TaskDraw.java index f93985e47..d776fc6ad 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskDraw.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TaskDraw.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,20 +28,19 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.draw; -import net.sourceforge.plantuml.Direction; +import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.UDrawable; +import net.sourceforge.plantuml.project.lang.ComplementColors; import net.sourceforge.plantuml.ugraphic.UGraphic; public interface TaskDraw extends UDrawable { - public void setColors(ComplementColors colors); + public void setColorsAndCompletion(ComplementColors colors, int completion, Url url); public double getY(); - public double getY(Direction direction); - public void drawTitle(UGraphic ug); public double getHeight(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TaskDrawDiamond.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TaskDrawDiamond.java new file mode 100644 index 000000000..c1d43f9a7 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TaskDrawDiamond.java @@ -0,0 +1,103 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.draw; + +import net.sourceforge.plantuml.SpriteContainerEmpty; +import net.sourceforge.plantuml.Url; +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.project.lang.ComplementColors; +import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.timescale.TimeScale; +import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UPolygon; +import net.sourceforge.plantuml.ugraphic.UShape; +import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; + +public class TaskDrawDiamond extends AbstractTaskDraw { + + private ComplementColors colors; + + public TaskDrawDiamond(TimeScale timeScale, double y, String prettyDisplay, Wink start) { + super(timeScale, y, prettyDisplay, start); + } + + @Override + protected FontConfiguration getFontConfiguration() { + final UFont font = UFont.serif(11); + return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); + } + + final public void drawTitle(UGraphic ug) { + final TextBlock title = Display.getWithNewlines(prettyDisplay).create(getFontConfiguration(), + HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + final double titleHeight = title.calculateDimension(ug.getStringBounder()).getHeight(); + final double h = (margin + getShapeHeight() - titleHeight) / 2; + final double endingPosition = timeScale.getStartingPosition(start) + getHeight(); + title.drawU(ug.apply(new UTranslate(endingPosition, h))); + } + + public void drawU(UGraphic ug1) { + final double startPos = timeScale.getStartingPosition(start); + ug1 = applyColors(ug1); + UGraphic ug2 = ug1.apply(new UTranslate(startPos + margin, margin)); + drawShape(ug2); + } + + private UGraphic applyColors(UGraphic ug) { + if (colors != null && colors.isOk()) { + return colors.apply(ug); + } + return ug.apply(HColorUtils.BLACK).apply(HColorUtils.BLACK.bg()); + } + + private void drawShape(UGraphic ug) { + ug.draw(getDiamond()); + } + + private UShape getDiamond() { + final double h = getHeight() - 2 * margin; + final UPolygon result = new UPolygon(); + result.addPoint(h / 2, 0); + result.addPoint(h, h / 2); + result.addPoint(h / 2, h); + result.addPoint(0, h / 2); + return result; + } + + public void setColorsAndCompletion(ComplementColors colors, int completion, Url url) { + this.colors = colors; + } +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TaskDrawRegular.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TaskDrawRegular.java new file mode 100644 index 000000000..1dba37e05 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TaskDrawRegular.java @@ -0,0 +1,148 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.draw; + +import net.sourceforge.plantuml.SpriteContainerEmpty; +import net.sourceforge.plantuml.Url; +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.project.lang.ComplementColors; +import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.timescale.TimeScale; +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.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; + +public class TaskDrawRegular extends AbstractTaskDraw { + + private static final HColor defaultColor = HColorSet.instance().getColorIfValid("GreenYellow"); + + private ComplementColors colors; + private int completion = 100; + private Url url; + private final Wink end; + private final boolean oddStart; + private final boolean oddEnd; + + private final double margin = 2; + + public TaskDrawRegular(TimeScale timeScale, double y, String prettyDisplay, Wink start, Wink end, boolean oddStart, + boolean oddEnd) { + super(timeScale, y, prettyDisplay, start); + this.end = end; + this.oddStart = oddStart; + this.oddEnd = oddEnd; + + } + + public void drawTitle(UGraphic ug) { + final TextBlock title = Display.getWithNewlines(prettyDisplay).create(getFontConfiguration(), + HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + final double titleHeight = title.calculateDimension(ug.getStringBounder()).getHeight(); + final double h = (margin + getShapeHeight() - titleHeight) / 2; + final double endingPosition = timeScale.getEndingPosition(start); + title.drawU(ug.apply(new UTranslate(endingPosition, h))); + } + + @Override + protected FontConfiguration getFontConfiguration() { + final UFont font = UFont.serif(11); + return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); + } + + public void drawU(UGraphic ug1) { + final double startPos = timeScale.getStartingPosition(start); + ug1 = applyColors(ug1); + UGraphic ug2 = ug1.apply(new UTranslate(startPos + margin, margin)); + drawShape(ug2); + } + + private UGraphic applyColors(UGraphic ug) { + if (colors != null && colors.isOk()) { + return colors.apply(ug); + } + return ug.apply(HColorUtils.BLUE).apply(defaultColor.bg()); + } + + private void drawShape(UGraphic ug) { + final double startPos = timeScale.getStartingPosition(start); + final double endPos = timeScale.getEndingPosition(end); + + final double fullLength = endPos - startPos - 2 * margin; + if (fullLength < 10) { + return; + } + if (url != null) { + ug.startUrl(url); + } + if (oddStart && !oddEnd) { + ug.draw(PathUtils.UtoRight(fullLength, getShapeHeight())); + return; + } + if (!oddStart && oddEnd) { + ug.draw(PathUtils.UtoLeft(fullLength, getShapeHeight())); + return; + } + final URectangle full = new URectangle(fullLength, getShapeHeight()).rounded(8); + if (completion == 100) { + ug.draw(full); + } else { + final double partialLength = fullLength * completion / 100.; + ug.apply(HColorUtils.WHITE).apply(HColorUtils.WHITE.bg()) + .draw(full); + if (partialLength > 2) { + final URectangle partial = new URectangle(partialLength, getShapeHeight()).rounded(8); + ug.apply(new HColorNone()).draw(partial); + } + if (partialLength > 10 && partialLength < fullLength - 10) { + final URectangle patch = new URectangle(8, getShapeHeight()); + ug.apply(new HColorNone()).apply(UTranslate.dx(partialLength - 8)).draw(patch); + } + ug.apply(new HColorNone().bg()).draw(full); + } + if (url != null) { + ug.closeUrl(); + } + } + + public void setColorsAndCompletion(ComplementColors colors, int completion, Url url) { + this.colors = colors; + this.completion = completion; + this.url = url; + } +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskDrawSeparator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TaskDrawSeparator.java similarity index 67% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskDrawSeparator.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TaskDrawSeparator.java index 55f77597b..1818fc3f3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskDrawSeparator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TaskDrawSeparator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,32 +28,35 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.draw; -import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.SpriteContainerEmpty; +import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; -import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.project.core.AbstractTask; +import net.sourceforge.plantuml.project.lang.ComplementColors; +import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.timescale.TimeScale; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class TaskDrawSeparator implements TaskDraw { private final TimeScale timeScale; private final double y; - private final Instant min; - private final Instant max; + private final Wink min; + private final Wink max; private final String name; - public TaskDrawSeparator(TaskSeparator task, TimeScale timeScale, double y, Instant min, Instant max) { - this.name = task.getName(); + public TaskDrawSeparator(String name, TimeScale timeScale, double y, Wink min, Wink max) { + this.name = name; this.y = y; this.timeScale = timeScale; this.min = min; @@ -61,7 +64,7 @@ public TaskDrawSeparator(TaskSeparator task, TimeScale timeScale, double y, Inst } public void drawTitle(UGraphic ug) { - getTitle().drawU(ug.apply(new UTranslate(MARGIN1, 0))); + getTitle().drawU(ug.apply(UTranslate.dx(MARGIN1))); } private TextBlock getTitle() { @@ -74,7 +77,7 @@ private TextBlock getTitle() { private FontConfiguration getFontConfiguration() { final UFont font = UFont.serif(11); - return new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK, false); + return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); } private final static double MARGIN1 = 10; @@ -85,39 +88,29 @@ public void drawU(UGraphic ug) { final double start = timeScale.getStartingPosition(min) + widthTitle; final double end = timeScale.getEndingPosition(max); - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); - ug = ug.apply(new UTranslate(0, getHeight() / 2)); + ug = ug.apply(HColorUtils.BLACK); + ug = ug.apply(UTranslate.dy(getHeight() / 2)); if (widthTitle == 0) { - final ULine line = new ULine(end - start, 0); + final ULine line = ULine.hline(end - start); ug.draw(line); } else { - final ULine line1 = new ULine(MARGIN1 - MARGIN2, 0); - final ULine line2 = new ULine(end - start - MARGIN1 - MARGIN2, 0); + final ULine line1 = ULine.hline(MARGIN1 - MARGIN2); + final ULine line2 = ULine.hline(end - start - MARGIN1 - MARGIN2); ug.draw(line1); - ug.apply(new UTranslate(widthTitle + MARGIN1 + MARGIN2, 0)).draw(line2); + ug.apply(UTranslate.dx(widthTitle + MARGIN1 + MARGIN2)).draw(line2); } } public double getHeight() { - return 16; + return AbstractTask.HEIGHT; } public double getY() { return y; } - public double getY(Direction direction) { - if (direction == Direction.UP) { - return y; - } - if (direction == Direction.DOWN) { - return y + getHeight(); - } - return y + getHeight() / 2; - } - - public void setColors(ComplementColors colors) { + public void setColorsAndCompletion(ComplementColors colors, int completion, Url url) { } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeader.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeader.java new file mode 100644 index 000000000..135bc6eb5 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeader.java @@ -0,0 +1,110 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.draw; + +import net.sourceforge.plantuml.SpriteContainerEmpty; +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.project.time.Wink; +import net.sourceforge.plantuml.project.timescale.TimeScale; +import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.ULine; +import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; + +public abstract class TimeHeader { + + protected static final int Y_POS_ROW16 = 16; + protected static final int Y_POS_ROW28 = 28; + + + private final TimeScale timeScale; + protected final Wink min; + protected final Wink max; + + public TimeHeader(Wink min, Wink max, TimeScale timeScale) { + this.timeScale = timeScale; + this.min = min; + this.max = max; + } + + public abstract void drawTimeHeader(final UGraphic ug, double totalHeight); + + public abstract double getFullHeaderHeight(); + + protected final void drawHline(UGraphic ug, double y) { + final double xmin = getTimeScale().getStartingPosition(min); + final double xmax = getTimeScale().getEndingPosition(max); + final ULine hline = ULine.hline(xmax - xmin); + ug.apply(HColorUtils.LIGHT_GRAY).apply(UTranslate.dy(y)).draw(hline); + } + + final protected FontConfiguration getFontConfiguration(int size, boolean bold) { + UFont font = UFont.serif(size); + if (bold) { + font = font.bold(); + } + return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); + } + + public final TimeScale getTimeScale() { + return timeScale; + } + + protected final TextBlock getTextBlock(final String text, int size, boolean bold) { + return Display.getWithNewlines(text).create(getFontConfiguration(size, bold), HorizontalAlignment.LEFT, + new SpriteContainerEmpty()); + } + + protected final void printCentered(UGraphic ug, TextBlock text, double start, double end) { + final double width = text.calculateDimension(ug.getStringBounder()).getWidth(); + final double available = end - start; + final double diff = Math.max(0, available - width); + text.drawU(ug.apply(UTranslate.dx(start + diff / 2))); + } + + protected final void printCentered(UGraphic ug, double start, double end, TextBlock... texts) { + final double available = end - start; + for (int i = texts.length - 1; i >= 0; i--) { + final TextBlock text = texts[i]; + final double width = text.calculateDimension(ug.getStringBounder()).getWidth(); + if (i == 0 || width <= available) { + final double diff = Math.max(0, available - width); + text.drawU(ug.apply(UTranslate.dx(start + diff / 2))); + return; + } + } + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java new file mode 100644 index 000000000..5fa1ba2ec --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java @@ -0,0 +1,207 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.draw; + +import java.util.Map; + +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.project.LoadPlanable; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.GCalendar; +import net.sourceforge.plantuml.project.time.MonthYear; +import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.timescale.TimeScaleDaily; +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.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; + +public class TimeHeaderDaily extends TimeHeader { + + private double getTimeHeaderHeight() { + return Y_POS_ROW28 + 13; + } + + private final HColor veryLightGray = HColorSet.instance().getColorIfValid("#E0E8E8"); + + private final GCalendar calendar; + private final LoadPlanable defaultPlan; + private final Map colorDays; + private final Map nameDays; + + public TimeHeaderDaily(GCalendar calendar, Wink min, Wink max, LoadPlanable defaultPlan, + Map colorDays, Map nameDays, Day printStart, Day printEnd) { + super(min, max, new TimeScaleDaily(calendar, printStart)); + this.calendar = calendar; + this.defaultPlan = defaultPlan; + this.colorDays = colorDays; + this.nameDays = nameDays; + } + + @Override + public void drawTimeHeader(final UGraphic ug, double totalHeight) { + drawCalendar(ug, totalHeight); + drawHline(ug, 0); + drawHline(ug, getFullHeaderHeight()); + + } + + private void drawCalendar(final UGraphic ug, double totalHeight) { + drawTexts(ug, totalHeight); + drawMonths(ug); + drawNonWorking(ug, totalHeight); + drawVBars(ug, totalHeight); + drawVbar(ug, getTimeScale().getStartingPosition(max.increment()), Y_POS_ROW16, totalHeight); + printNamedDays(ug); + + } + + private void drawTexts(final UGraphic ug, double totalHeight) { + final double height = totalHeight - getFullHeaderHeight(); + for (Wink wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { + final double x1 = getTimeScale().getStartingPosition(wink); + final double x2 = getTimeScale().getEndingPosition(wink); + final Day day = calendar.toDayAsDate(wink); + if (defaultPlan.getLoadAt(wink) > 0) { + final HColor back = colorDays.get(day); + if (back != null) { + drawRectangle(ug.apply(back.bg()), height, x1, x2); + } + printCentered(ug.apply(UTranslate.dy(Y_POS_ROW16)), + getTextBlock(day.getDayOfWeek().shortName(), 10, false), x1, x2); + printCentered(ug.apply(UTranslate.dy(Y_POS_ROW28)), getTextBlock("" + day.getDayOfMonth(), 10, false), + x1, x2); + } + } + } + + private void drawMonths(final UGraphic ug) { + MonthYear last = null; + double lastChangeMonth = -1; + for (Wink wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { + final double x1 = getTimeScale().getStartingPosition(wink); + final Day day = calendar.toDayAsDate(wink); + if (day.monthYear().equals(last) == false) { + if (last != null) { + printMonth(ug, last, lastChangeMonth, x1); + } + lastChangeMonth = x1; + last = day.monthYear(); + } + } + final double x1 = getTimeScale().getStartingPosition(max.increment()); + if (x1 > lastChangeMonth) { + printMonth(ug, last, lastChangeMonth, x1); + } + } + + private void drawNonWorking(final UGraphic ug, double totalHeight) { + final double height = totalHeight - getFullHeaderHeight(); + for (Wink wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { + final double x1 = getTimeScale().getStartingPosition(wink); + final double x2 = getTimeScale().getEndingPosition(wink); + if (defaultPlan.getLoadAt(wink) == 0) { + drawRectangle(ug.apply(veryLightGray.bg()), height, x1, x2); + } + } + } + + private void drawRectangle(UGraphic ug, double height, double x1, double x2) { + if (height == 0) { + return; + } + ug = ug.apply(new HColorNone()); + ug = ug.apply(new UTranslate(x1 + 1, getFullHeaderHeight())); + ug.draw(new URectangle(x2 - x1 - 1, height)); + } + + private void drawVBars(final UGraphic ug, double totalHeight) { + MonthYear last = null; + for (Wink wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { + double startingY = getFullHeaderHeight(); + final Day day = calendar.toDayAsDate(wink); + if (day.monthYear().equals(last) == false) { + startingY = 0; + last = day.monthYear(); + } + drawVbar(ug, getTimeScale().getStartingPosition(wink), startingY, totalHeight); + } + } + + private void printMonth(UGraphic ug, MonthYear monthYear, double start, double end) { + final TextBlock tiny = getTextBlock(monthYear.shortName(), 12, true); + final TextBlock small = getTextBlock(monthYear.longName(), 12, true); + final TextBlock big = getTextBlock(monthYear.longNameYYYY(), 12, true); + printCentered(ug, start, end, tiny, small, big); + } + + private void drawVbar(UGraphic ug, double x, double y1, double y2) { + final ULine vbar = ULine.vline(y2 - y1); + ug.apply(HColorUtils.LIGHT_GRAY).apply(new UTranslate(x, y1)).draw(vbar); + } + + private void printNamedDays(final UGraphic ug) { + if (nameDays.size() > 0) { + String last = null; + for (Wink wink = min; wink.compareTo(max.increment()) <= 0; wink = wink.increment()) { + final Day tmpday = calendar.toDayAsDate(wink); + final String name = nameDays.get(tmpday); + if (name != null && name.equals(last) == false) { + final double x1 = getTimeScale().getStartingPosition(wink); + final double x2 = getTimeScale().getEndingPosition(wink); + final TextBlock label = getTextBlock(name, 12, false); + final double h = label.calculateDimension(ug.getStringBounder()).getHeight(); + double y1 = getTimeHeaderHeight(); + double y2 = getFullHeaderHeight(); + label.drawU(ug.apply(new UTranslate(x1, Y_POS_ROW28 + 11))); + } + last = name; + } + } + } + + @Override + public double getFullHeaderHeight() { + return getTimeHeaderHeight() + getHeaderNameDayHeight(); + } + + private double getHeaderNameDayHeight() { + if (nameDays.size() > 0) { + return 16; + } + return 0; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java new file mode 100644 index 000000000..00dfb90ac --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java @@ -0,0 +1,144 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.draw; + +import java.util.Map; + +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.project.LoadPlanable; +import net.sourceforge.plantuml.project.core.PrintScale; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.GCalendar; +import net.sourceforge.plantuml.project.time.MonthYear; +import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.timescale.TimeScaleCompressed; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.ULine; +import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; + +public class TimeHeaderMonthly extends TimeHeader { + + private double getTimeHeaderHeight() { + return Y_POS_ROW16 + 13; + } + + private final GCalendar calendar; + + public TimeHeaderMonthly(GCalendar calendar, Wink min, Wink max, LoadPlanable defaultPlan, + Map colorDays, Map nameDays) { + super(min, max, new TimeScaleCompressed(calendar, PrintScale.MONTHLY.getCompress())); + this.calendar = calendar; + } + + @Override + public void drawTimeHeader(final UGraphic ug, double totalHeight) { + drawCalendar(ug, totalHeight); + drawHline(ug, 0); + drawHline(ug, Y_POS_ROW16); + drawHline(ug, getFullHeaderHeight()); + + } + + private void drawCalendar(final UGraphic ug, double totalHeight) { + drawYears(ug); + drawMonths(ug); + } + + private void drawYears(final UGraphic ug) { + MonthYear last = null; + double lastChange = -1; + for (Wink wink = min; wink.compareTo(max) < 0; wink = wink.increment()) { + final Day day = calendar.toDayAsDate(wink); + final double x1 = getTimeScale().getStartingPosition(wink); + if (last == null || day.monthYear().year() != last.year()) { + drawVbar(ug, x1, 0, Y_POS_ROW16); + if (last != null) { + printYear(ug, last, lastChange, x1); + } + lastChange = x1; + last = day.monthYear(); + } + } + final double x1 = getTimeScale().getStartingPosition(max.increment()); + if (x1 > lastChange) { + printYear(ug, last, lastChange, x1); + } + } + + private void drawMonths(final UGraphic ug) { + MonthYear last = null; + double lastChange = -1; + for (Wink wink = min; wink.compareTo(max) < 0; wink = wink.increment()) { + final Day day = calendar.toDayAsDate(wink); + final double x1 = getTimeScale().getStartingPosition(wink); + if (day.monthYear().equals(last) == false) { + drawVbar(ug, x1, Y_POS_ROW16, Y_POS_ROW28); + if (last != null) { + printMonth(ug.apply(UTranslate.dy(Y_POS_ROW16)), last, lastChange, x1); + } + lastChange = x1; + last = day.monthYear(); + } + } + final double x1 = getTimeScale().getStartingPosition(max.increment()); + if (x1 > lastChange) { + printMonth(ug.apply(UTranslate.dy(Y_POS_ROW16)), last, lastChange, x1); + } + } + + private void printYear(UGraphic ug, MonthYear monthYear, double start, double end) { + final TextBlock small = getTextBlock("" + monthYear.year(), 12, true); + printCentered(ug, start, end, small); + } + + private void printMonth(UGraphic ug, MonthYear monthYear, double start, double end) { + final TextBlock small = getTextBlock(monthYear.shortName(), 10, false); + final TextBlock big = getTextBlock(monthYear.longName(), 10, false); + printCentered(ug, start, end, small, big); + } + + private void drawVbar(UGraphic ug, double x, double y1, double y2) { + final ULine vbar = ULine.vline(y2 - y1); + ug.apply(HColorUtils.LIGHT_GRAY).apply(new UTranslate(x, y1)).draw(vbar); + } + + private void printLeft(UGraphic ug, TextBlock text, double start) { + text.drawU(ug.apply(UTranslate.dx(start))); + } + + @Override + public double getFullHeaderHeight() { + return getTimeHeaderHeight(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java new file mode 100644 index 000000000..b4e7de7e9 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java @@ -0,0 +1,91 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.draw; + +import net.sourceforge.plantuml.SpriteContainerEmpty; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.timescale.TimeScale; +import net.sourceforge.plantuml.project.timescale.TimeScaleWink; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.ULine; +import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; + +public class TimeHeaderSimple extends TimeHeader { + + @Override + public double getFullHeaderHeight() { + return getTimeHeaderHeight() + getHeaderNameDayHeight(); + } + + private double getTimeHeaderHeight() { + return 16; + } + + private double getHeaderNameDayHeight() { + return 0; + } + + public TimeHeaderSimple(Wink min, Wink max) { + super(min, max, new TimeScaleWink()); + } + + @Override + public void drawTimeHeader(final UGraphic ug, double totalHeight) { + final double xmin = getTimeScale().getStartingPosition(min); + final double xmax = getTimeScale().getEndingPosition(max); + drawSimpleDayCounter(ug, getTimeScale(), totalHeight); + ug.apply(HColorUtils.LIGHT_GRAY).draw(ULine.hline(xmax - xmin)); + ug.apply(HColorUtils.LIGHT_GRAY).apply(UTranslate.dy(getFullHeaderHeight() - 3)) + .draw(ULine.hline(xmax - xmin)); + + } + + private void drawSimpleDayCounter(final UGraphic ug, TimeScale timeScale, double totalHeight) { + final ULine vbar = ULine.vline(totalHeight); + for (Wink i = min; i.compareTo(max.increment()) <= 0; i = i.increment()) { + final TextBlock num = Display.getWithNewlines(i.toShortString()).create(getFontConfiguration(10, false), + HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + final double x1 = timeScale.getStartingPosition(i); + final double x2 = timeScale.getEndingPosition(i); + final double width = num.calculateDimension(ug.getStringBounder()).getWidth(); + final double delta = (x2 - x1) - width; + if (i.compareTo(max.increment()) < 0) { + num.drawU(ug.apply(UTranslate.dx(x1 + delta / 2))); + } + ug.apply(HColorUtils.LIGHT_GRAY).apply(UTranslate.dx(x1)).draw(vbar); + } + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java new file mode 100644 index 000000000..9d42b1f24 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java @@ -0,0 +1,138 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.draw; + +import java.util.Map; + +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.project.LoadPlanable; +import net.sourceforge.plantuml.project.core.PrintScale; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.DayOfWeek; +import net.sourceforge.plantuml.project.time.GCalendar; +import net.sourceforge.plantuml.project.time.MonthYear; +import net.sourceforge.plantuml.project.time.Wink; +import net.sourceforge.plantuml.project.timescale.TimeScaleCompressed; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.ULine; +import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; + +public class TimeHeaderWeekly extends TimeHeader { + + private double getTimeHeaderHeight() { + return Y_POS_ROW16 + 13; + } + + private final GCalendar calendar; + + public TimeHeaderWeekly(GCalendar calendar, Wink min, Wink max, LoadPlanable defaultPlan, + Map colorDays, Map nameDays) { + super(min, max, new TimeScaleCompressed(calendar, PrintScale.WEEKLY.getCompress())); + this.calendar = calendar; + } + + @Override + public void drawTimeHeader(final UGraphic ug, double totalHeight) { + drawCalendar(ug, totalHeight); + drawHline(ug, 0); + drawHline(ug, Y_POS_ROW16); + drawHline(ug, getFullHeaderHeight()); + + } + + private void drawCalendar(final UGraphic ug, double totalHeight) { + printDaysOfMonth(ug); + printSmallVbars(ug, totalHeight); + printMonths(ug); + } + + private void printMonths(final UGraphic ug) { + MonthYear last = null; + double lastChangeMonth = -1; + for (Wink wink = min; wink.compareTo(max) < 0; wink = wink.increment()) { + final Day day = calendar.toDayAsDate(wink); + final double x1 = getTimeScale().getStartingPosition(wink); + if (day.monthYear().equals(last) == false) { + drawVbar(ug, x1, 0, Y_POS_ROW16); + if (last != null) { + printMonth(ug, last, lastChangeMonth, x1); + } + lastChangeMonth = x1; + last = day.monthYear(); + } + } + final double x1 = getTimeScale().getStartingPosition(max.increment()); + if (x1 > lastChangeMonth) { + printMonth(ug, last, lastChangeMonth, x1); + } + } + + private void printSmallVbars(final UGraphic ug, double totalHeight) { + for (Wink wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) { + if (calendar.toDayAsDate(wink).getDayOfWeek() == DayOfWeek.MONDAY) { + drawVbar(ug, getTimeScale().getStartingPosition(wink), Y_POS_ROW16, totalHeight); + } + } + } + + private void printDaysOfMonth(final UGraphic ug) { + for (Wink wink = min; wink.compareTo(max) < 0; wink = wink.increment()) { + final Day day = calendar.toDayAsDate(wink); + if (day.getDayOfWeek() == DayOfWeek.MONDAY) { + printLeft(ug.apply(UTranslate.dy(Y_POS_ROW16)), getTextBlock("" + day.getDayOfMonth(), 10, false), + getTimeScale().getStartingPosition(wink) + 5); + } + } + } + + private void printMonth(UGraphic ug, MonthYear monthYear, double start, double end) { + final TextBlock small = getTextBlock(monthYear.shortName(), 12, true); + final TextBlock big = getTextBlock(monthYear.shortNameYYYY(), 12, true); + printCentered(ug, start, end, small, big); + } + + private void drawVbar(UGraphic ug, double x, double y1, double y2) { + final ULine vbar = ULine.vline(y2 - y1); + ug.apply(HColorUtils.LIGHT_GRAY).apply(new UTranslate(x, y1)).draw(vbar); + } + + private void printLeft(UGraphic ug, TextBlock text, double start) { + text.drawU(ug.apply(UTranslate.dx(start))); + } + + @Override + public double getFullHeaderHeight() { + return getTimeHeaderHeight(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Complement.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/Complement.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/Complement.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/Complement.java index 04573d22f..c3d068672 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Complement.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/Complement.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; public interface Complement { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementBeforeOrAfterOrAtTaskStartOrEnd.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementBeforeOrAfterOrAtTaskStartOrEnd.java new file mode 100644 index 000000000..6655857d8 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementBeforeOrAfterOrAtTaskStartOrEnd.java @@ -0,0 +1,90 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.lang; + +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.Failable; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Moment; +import net.sourceforge.plantuml.project.core.TaskAttribute; +import net.sourceforge.plantuml.project.core.TaskInstant; + +public class ComplementBeforeOrAfterOrAtTaskStartOrEnd implements ComplementPattern { + + private static final int POS_NB1 = 0; + private static final int POS_DAY_OR_WEEK1 = 1; + private static final int POS_NB2 = 2; + private static final int POS_DAY_OR_WEEK2 = 3; + private static final int POS_BEFORE_OR_AFTER = 4; + private static final int POS_CODE_OTHER = 5; + private static final int POS_START_OR_END = 6; + + public IRegex toRegex(String suffix) { // "+" + return new RegexLeaf("COMPLEMENT" + suffix, "(?:at|with|after|" + // + "(\\d+)[%s]+(day|week)s?" + // + "(?:[%s]+and[%s]+(\\d+)[%s]+(day|week)s?)?" + // + "[%s]+(before|after))[%s]+\\[([^\\[\\]]+?)\\].?s[%s]+(start|end)"); + } + + public Failable getComplement(GanttDiagram system, RegexResult arg, String suffix) { + final String code = arg.get("COMPLEMENT" + suffix, POS_CODE_OTHER); + final String startOrEnd = arg.get("COMPLEMENT" + suffix, POS_START_OR_END); + final Moment task = system.getExistingMoment(code); + if (task == null) { + return Failable.error("No such task " + code); + } + TaskInstant result = new TaskInstant(task, TaskAttribute.fromString(startOrEnd)); + final String nb1 = arg.get("COMPLEMENT" + suffix, POS_NB1); + if (nb1 != null) { + final int factor1 = arg.get("COMPLEMENT" + suffix, POS_DAY_OR_WEEK1).startsWith("w") ? system.daysInWeek() + : 1; + final int days1 = Integer.parseInt(nb1) * factor1; + + final String nb2 = arg.get("COMPLEMENT" + suffix, POS_NB2); + int days2 = 0; + if (nb2 != null) { + final int factor2 = arg.get("COMPLEMENT" + suffix, POS_DAY_OR_WEEK2).startsWith("w") + ? system.daysInWeek() + : 1; + days2 = Integer.parseInt(nb2) * factor2; + } + + int delta = days1 + days2; + if ("before".equalsIgnoreCase(arg.get("COMPLEMENT" + suffix, POS_BEFORE_OR_AFTER))) { + delta = -delta; + } + result = result.withDelta(delta); + } + return Failable.ok(result); + } +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementClose.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementClose.java similarity index 84% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementClose.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementClose.java index 9eba806da..ceee31884 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementClose.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementClose.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,11 +28,13 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.Failable; +import net.sourceforge.plantuml.project.GanttDiagram; public class ComplementClose implements ComplementPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementColors.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementColors.java similarity index 68% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementColors.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementColors.java index 2aca197c8..a4f78edfe 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementColors.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementColors.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,19 +28,17 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComplementColors implements Complement { - private final HtmlColor center; - private final HtmlColor border; + private final HColor center; + private final HColor border; - public ComplementColors(HtmlColor center, HtmlColor border) { + public ComplementColors(HColor center, HColor border) { this.center = center; this.border = border; } @@ -49,11 +47,11 @@ public UGraphic apply(UGraphic ug) { if (isOk() == false) { throw new IllegalStateException(); } - ug = ug.apply(new UChangeBackColor(center)); + ug = ug.apply(center.bg()); if (border == null) { - ug = ug.apply(new UChangeColor(center)); + ug = ug.apply(center); } else { - ug = ug.apply(new UChangeColor(border)); + ug = ug.apply(border); } return ug; } @@ -62,7 +60,7 @@ public boolean isOk() { return center != null; } - public HtmlColor getCenter() { + public HColor getCenter() { return center; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementBeforeOrAfterOrAtTaskStartOrEnd.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementCompleted.java similarity index 55% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementBeforeOrAfterOrAtTaskStartOrEnd.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementCompleted.java index 4e1fea24b..264706e72 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementBeforeOrAfterOrAtTaskStartOrEnd.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementCompleted.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,35 +28,23 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.Completion; +import net.sourceforge.plantuml.project.Failable; +import net.sourceforge.plantuml.project.GanttDiagram; -public class ComplementBeforeOrAfterOrAtTaskStartOrEnd implements ComplementPattern { +public class ComplementCompleted implements ComplementPattern { public IRegex toRegex(String suffix) { - return new RegexLeaf("COMPLEMENT" + suffix, - "(?:at|(\\d+)[%s]+days?[%s]+(before|after))[%s]+\\[([^\\[\\]]+?)\\].?s[%s]+(start|end)"); + return new RegexLeaf("COMPLEMENT" + suffix, "(\\d+).*completed?"); } public Failable getComplement(GanttDiagram system, RegexResult arg, String suffix) { - final String code = arg.get("COMPLEMENT" + suffix, 2); - final String position = arg.get("COMPLEMENT" + suffix, 3); - final Moment task = system.getExistingMoment(code); - if (task == null) { - return Failable. error("No such task " + code); - } - final String days = arg.get("COMPLEMENT" + suffix, 0); - TaskInstant result = new TaskInstant(task, TaskAttribute.fromString(position)); - if (days != null) { - int delta = Integer.parseInt(days); - if ("before".equalsIgnoreCase(arg.get("COMPLEMENT" + suffix, 1))) { - delta = -delta; - } - result = result.withDelta(delta); - } - return Failable. ok(result); + final String value = arg.get("COMPLEMENT" + suffix, 0); + return Failable.ok(new Completion(Integer.parseInt(value))); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementDate.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementDate.java similarity index 89% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementDate.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementDate.java index 1bf86a4c4..6217bbd40 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementDate.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementDate.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,13 +28,17 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.Failable; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.Month; public class ComplementDate implements ComplementPattern { @@ -106,20 +110,20 @@ private Complement resultA(RegexResult arg, String suffix) { final int day = Integer.parseInt(arg.get("ADAY" + suffix, 0)); final String month = arg.get("AMONTH" + suffix, 0); final int year = Integer.parseInt(arg.get("AYEAR" + suffix, 0)); - return DayAsDate.create(year, month, day); + return Day.create(year, month, day); } private Complement resultB(RegexResult arg, String suffix) { final int day = Integer.parseInt(arg.get("BDAY" + suffix, 0)); final int month = Integer.parseInt(arg.get("BMONTH" + suffix, 0)); final int year = Integer.parseInt(arg.get("BYEAR" + suffix, 0)); - return DayAsDate.create(year, month, day); + return Day.create(year, month, day); } private Complement resultC(RegexResult arg, String suffix) { final int day = Integer.parseInt(arg.get("CDAY" + suffix, 0)); final String month = arg.get("CMONTH" + suffix, 0); final int year = Integer.parseInt(arg.get("CYEAR" + suffix, 0)); - return DayAsDate.create(year, month, day); + return Day.create(year, month, day); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementDates.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementDates.java similarity index 80% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementDates.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementDates.java index 97e8b2d85..0cb703a6b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementDates.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementDates.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,12 +28,16 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.DaysAsDates; +import net.sourceforge.plantuml.project.Failable; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.Day; public class ComplementDates implements ComplementPattern { @@ -57,16 +61,16 @@ public IRegex toRegex(String suffix) { } public Subject getSubject(GanttDiagram project, RegexResult arg) { - final DayAsDate date1 = getDate(arg, "1"); - final DayAsDate date2 = getDate(arg, "2"); + final Day date1 = getDate(arg, "1"); + final Day date2 = getDate(arg, "2"); return new DaysAsDates(date1, date2); } - private DayAsDate getDate(RegexResult arg, String suffix) { + private Day getDate(RegexResult arg, String suffix) { final int day = Integer.parseInt(arg.get("DAY" + suffix, 0)); final int month = Integer.parseInt(arg.get("MONTH" + suffix, 0)); final int year = Integer.parseInt(arg.get("YEAR" + suffix, 0)); - return DayAsDate.create(year, month, day); + return Day.create(year, month, day); } public Failable getComplement(GanttDiagram system, RegexResult arg, String suffix) { @@ -74,12 +78,12 @@ public Failable getComplement(GanttDiagram system, RegexResult arg, final int day1 = Integer.parseInt(arg.get("DAY1" + suffix, 0)); final int month1 = Integer.parseInt(arg.get("MONTH1" + suffix, 0)); final int year1 = Integer.parseInt(arg.get("YEAR1" + suffix, 0)); - final DayAsDate date1 = DayAsDate.create(year1, month1, day1); + final Day date1 = Day.create(year1, month1, day1); final int day2 = Integer.parseInt(arg.get("DAY2" + suffix, 0)); final int month2 = Integer.parseInt(arg.get("MONTH2" + suffix, 0)); final int year2 = Integer.parseInt(arg.get("YEAR2" + suffix, 0)); - final DayAsDate date2 = DayAsDate.create(year2, month2, day2); + final Day date2 = Day.create(year2, month2, day2); return Failable. ok(new DaysAsDates(date1, date2)); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementSeveralDays.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementDayOfWeek.java similarity index 61% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementSeveralDays.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementDayOfWeek.java index 4bdb9fa90..9fe0bdcef 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementSeveralDays.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementDayOfWeek.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,31 +28,26 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.Failable; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.DayOfWeek; -public class ComplementSeveralDays implements ComplementPattern { +public class ComplementDayOfWeek implements ComplementPattern { public IRegex toRegex(String suffix) { return new RegexConcat( // - new RegexLeaf("COMPLEMENT" + suffix, "(\\d+)[%s]+(days?|weeks?)")); // - // new RegexLeaf("LOAD" + suffix, "([%s]+at[%s]+(\\d+)%)?")); + new RegexLeaf("COMPLEMENT" + suffix, "(" + DayOfWeek.getRegexString() + ")")); // } public Failable getComplement(GanttDiagram system, RegexResult arg, String suffix) { - final String number = arg.get("COMPLEMENT" + suffix, 0); - final boolean inWeeks = arg.get("COMPLEMENT" + suffix, 1).startsWith("w"); - final int factor = inWeeks ? system.daysInWeek() : 1; - // final String load = arg.get("LOAD" + suffix, 1); - final int days = Integer.parseInt(number) * factor; - // if (load == null) { - return Failable. ok(LoadInDays.inDay(days)); - // } - // return Failable. ok(LoadInDays.inDayWithLoad(days, Integer.parseInt(load))); + final String s = arg.get("COMPLEMENT" + suffix, 0); + return Failable. ok(DayOfWeek.fromString(s)); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementEmpty.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementEmpty.java similarity index 83% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementEmpty.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementEmpty.java index 00f5f85f6..c055356da 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementEmpty.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementEmpty.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,11 +28,13 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.Failable; +import net.sourceforge.plantuml.project.GanttDiagram; public class ComplementEmpty implements ComplementPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementInColors.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementInColors.java similarity index 77% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementInColors.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementInColors.java index 95f630583..dd5005ab8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementInColors.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementInColors.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,12 +28,14 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.project.Failable; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComplementInColors implements ComplementPattern { @@ -44,8 +46,8 @@ public IRegex toRegex(String suffix) { public Failable getComplement(GanttDiagram system, RegexResult arg, String suffix) { final String color1 = arg.get("COMPLEMENT" + suffix, 0); final String color2 = arg.get("COMPLEMENT" + suffix, 1); - final HtmlColor col1 = system.getIHtmlColorSet().getColorIfValid(color1); - final HtmlColor col2 = system.getIHtmlColorSet().getColorIfValid(color2); + final HColor col1 = system.getIHtmlColorSet().getColorIfValid(color1); + final HColor col2 = system.getIHtmlColorSet().getColorIfValid(color2); return Failable. ok(new ComplementColors(col1, col2)); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementInColors2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementInColors2.java similarity index 77% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementInColors2.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementInColors2.java index d55ec7e19..bea40c25c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementInColors2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementInColors2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,12 +28,14 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.project.Failable; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComplementInColors2 implements ComplementPattern { @@ -44,8 +46,8 @@ public IRegex toRegex(String suffix) { public Failable getComplement(GanttDiagram system, RegexResult arg, String suffix) { final String color1 = arg.get("COMPLEMENT" + suffix, 0); final String color2 = arg.get("COMPLEMENT" + suffix, 1); - final HtmlColor col1 = system.getIHtmlColorSet().getColorIfValid(color1); - final HtmlColor col2 = system.getIHtmlColorSet().getColorIfValid(color2); + final HColor col1 = system.getIHtmlColorSet().getColorIfValid(color1); + final HColor col2 = system.getIHtmlColorSet().getColorIfValid(color2); return Failable. ok(new ComplementColors(col1, col2)); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementName.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementName.java similarity index 87% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementName.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementName.java index a4af40147..f4a0917e4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementName.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementName.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; public class ComplementName implements Complement { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementNamed.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementNamed.java similarity index 84% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementNamed.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementNamed.java index 1ef3d7ef0..1ab28d602 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementNamed.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementNamed.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,11 +28,13 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.Failable; +import net.sourceforge.plantuml.project.GanttDiagram; public class ComplementNamed implements ComplementPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementOpen.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementOpen.java similarity index 84% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementOpen.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementOpen.java index a7cab4507..4514b426d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementOpen.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementOpen.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,11 +28,13 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.Failable; +import net.sourceforge.plantuml.project.GanttDiagram; public class ComplementOpen implements ComplementPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementPattern.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementPattern.java similarity index 82% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementPattern.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementPattern.java index 724935042..9d7da7106 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/ComplementPattern.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementPattern.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,10 +28,12 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.Failable; +import net.sourceforge.plantuml.project.GanttDiagram; public interface ComplementPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementSeveralDays.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementSeveralDays.java new file mode 100644 index 000000000..ac27309e1 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementSeveralDays.java @@ -0,0 +1,65 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.lang; + +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.Failable; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.Load; + +public class ComplementSeveralDays implements ComplementPattern { + + public IRegex toRegex(String suffix) { + return new RegexConcat( // + new RegexLeaf("COMPLEMENT" + suffix, "(\\d+)[%s]+(day|week)s?" + // + "(?:[%s]+and[%s]+(\\d+)[%s]+(day|week)s?)?" // + )); // + } + + public Failable getComplement(GanttDiagram system, RegexResult arg, String suffix) { + final String nb1 = arg.get("COMPLEMENT" + suffix, 0); + final int factor1 = arg.get("COMPLEMENT" + suffix, 1).startsWith("w") ? system.daysInWeek() : 1; + final int days1 = Integer.parseInt(nb1) * factor1; + + final String nb2 = arg.get("COMPLEMENT" + suffix, 2); + int days2 = 0; + if (nb2 != null) { + final int factor2 = arg.get("COMPLEMENT" + suffix, 3).startsWith("w") ? system.daysInWeek() : 1; + days2 = Integer.parseInt(nb2) * factor2; + } + + return Failable.ok(Load.inWinks(days1 + days2)); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementUrl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementUrl.java new file mode 100644 index 000000000..521b84ef9 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/ComplementUrl.java @@ -0,0 +1,57 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.lang; + +import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.UrlBuilder; +import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.Failable; +import net.sourceforge.plantuml.project.GanttDiagram; + +public class ComplementUrl implements ComplementPattern { + + public IRegex toRegex(String suffix) { + return new RegexConcat( // + new RegexLeaf("COMPLEMENT" + suffix, "(" + UrlBuilder.getRegexp() + ")")); // + } + + public Failable getComplement(GanttDiagram diagram, RegexResult arg, String suffix) { + final String urlString = arg.get("COMPLEMENT" + suffix, 0); + final UrlBuilder urlBuilder = new UrlBuilder("", ModeUrl.STRICT); + final Url url = urlBuilder.getUrl(urlString); + return Failable.ok(url); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Subject.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/Subject.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/Subject.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/Subject.java index ab9856b9f..63e6b86d6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Subject.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/Subject.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; public interface Subject { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectDayAsDate.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectDayAsDate.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectDayAsDate.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectDayAsDate.java index 104af4447..d225c8a90 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectDayAsDate.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectDayAsDate.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,6 +37,8 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.Day; public class SubjectDayAsDate implements SubjectPattern { @@ -57,7 +59,7 @@ public Subject getSubject(GanttDiagram project, RegexResult arg) { final int day = Integer.parseInt(arg.get("DAY", 0)); final int month = Integer.parseInt(arg.get("MONTH", 0)); final int year = Integer.parseInt(arg.get("YEAR", 0)); - return DayAsDate.create(year, month, day); + return Day.create(year, month, day); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectDayOfWeek.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectDayOfWeek.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectDayOfWeek.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectDayOfWeek.java index 452673c89..8cf789e2d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectDayOfWeek.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectDayOfWeek.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -36,6 +36,8 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.DayOfWeek; public class SubjectDayOfWeek implements SubjectPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectDaysAsDates.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectDaysAsDates.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectDaysAsDates.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectDaysAsDates.java index 7bd6b350d..5cb4aebc1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectDaysAsDates.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectDaysAsDates.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -38,6 +38,9 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.DaysAsDates; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.Day; public class SubjectDaysAsDates implements SubjectPattern { @@ -99,26 +102,26 @@ private IRegex regexThen() { public Subject getSubject(GanttDiagram project, RegexResult arg) { final String countAnd = arg.get("COUNT_AND", 0); if (countAnd != null) { - final DayAsDate date3 = getDate(arg, "3"); + final Day date3 = getDate(arg, "3"); final int nb = Integer.parseInt(countAnd); return new DaysAsDates(project, date3, nb); } final String countThen = arg.get("COUNT_THEN", 0); if (countThen != null) { - final DayAsDate date3 = project.getThenDate(); + final Day date3 = project.getThenDate(); final int nb = Integer.parseInt(countThen); return new DaysAsDates(project, date3, nb); } - final DayAsDate date1 = getDate(arg, "1"); - final DayAsDate date2 = getDate(arg, "2"); + final Day date1 = getDate(arg, "1"); + final Day date2 = getDate(arg, "2"); return new DaysAsDates(date1, date2); } - private DayAsDate getDate(RegexResult arg, String suffix) { + private Day getDate(RegexResult arg, String suffix) { final int day = Integer.parseInt(arg.get("DAY" + suffix, 0)); final int month = Integer.parseInt(arg.get("MONTH" + suffix, 0)); final int year = Integer.parseInt(arg.get("YEAR" + suffix, 0)); - return DayAsDate.create(year, month, day); + return Day.create(year, month, day); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectPattern.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectPattern.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectPattern.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectPattern.java index d4a4f35e1..e8aeb6992 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectPattern.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectPattern.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,12 +28,13 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Collection; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; public interface SubjectPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectProject.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectProject.java similarity index 87% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectProject.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectProject.java index 175ab8b0a..796f221ef 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectProject.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectProject.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -36,6 +36,7 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; public class SubjectProject implements SubjectPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectResource.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectResource.java similarity index 84% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectResource.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectResource.java index 3a340cfa5..b25d4761c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectResource.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectResource.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,11 +37,12 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; public class SubjectResource implements SubjectPattern { public Collection getVerbs() { - return Arrays. asList(new VerbIsOff()); + return Arrays. asList(new VerbIsOff(), new VerbIsOn()); } public IRegex toRegex() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectTask.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectTask.java similarity index 82% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectTask.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectTask.java index 43acd72df..71f25a363 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectTask.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectTask.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -39,14 +39,15 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Task; public class SubjectTask implements SubjectPattern { public Collection getVerbs() { - return Arrays - . asList(new VerbLasts(), new VerbTaskStarts(), new VerbTaskStartsAbsolute(), - new VerbHappens(), new VerbEnds(), new VerbTaskEndsAbsolute(), new VerbIsColored(), - new VerbIsDeleted()); + return Arrays.asList(new VerbLasts(), new VerbTaskStarts(), new VerbTaskStartsAbsolute(), + new VerbHappens(), new VerbEnds(), new VerbTaskEndsAbsolute(), new VerbIsColored(), new VerbIsDeleted(), + new VerbIsForTask(), new VerbLinksTo()); } public IRegex toRegex() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectToday.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectToday.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectToday.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectToday.java index fd80da40a..f8e9a9ea8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/SubjectToday.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/SubjectToday.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,6 +37,8 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.Today; public class SubjectToday implements SubjectPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Verb.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/Verb.java similarity index 87% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/Verb.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/Verb.java index bcebd088b..44e344bde 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Verb.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/Verb.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import net.sourceforge.plantuml.command.CommandExecutionResult; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbAre.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbAre.java similarity index 86% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbAre.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbAre.java index 3994ea461..17844c792 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbAre.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbAre.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,6 +37,8 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.DayOfWeek; public class VerbAre implements VerbPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbEnds.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbEnds.java similarity index 81% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbEnds.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbEnds.java index fbe29e13b..0b5823488 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbEnds.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbEnds.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,6 +37,11 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttConstraint; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Task; +import net.sourceforge.plantuml.project.core.TaskAttribute; +import net.sourceforge.plantuml.project.core.TaskInstant; public class VerbEnds implements VerbPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbHappens.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbHappens.java similarity index 78% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbHappens.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbHappens.java index 382c287d9..b58f5da12 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbHappens.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbHappens.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,6 +37,11 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.Load; +import net.sourceforge.plantuml.project.core.Task; +import net.sourceforge.plantuml.project.core.TaskInstant; +import net.sourceforge.plantuml.project.time.Day; public class VerbHappens implements VerbPattern { @@ -52,10 +57,10 @@ public Verb getVerb(final GanttDiagram project, RegexResult arg) { return new Verb() { public CommandExecutionResult execute(Subject subject, Complement complement) { final Task task = (Task) subject; - task.setLoad(LoadInDays.inDay(1)); - if (complement instanceof DayAsDate) { - final DayAsDate start = (DayAsDate) complement; - final DayAsDate startingDate = project.getStartingDate(); + task.setLoad(Load.inWinks(1)); + if (complement instanceof Day) { + final Day start = (Day) complement; + final Day startingDate = project.getStartingDate(); if (startingDate == null) { return CommandExecutionResult.error("No starting date for the project"); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsColored.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsColored.java similarity index 87% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsColored.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsColored.java index 49b283f8f..0841cbca9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsColored.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsColored.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,6 +37,8 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Task; public class VerbIsColored implements VerbPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsColoredForToday.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsColoredForToday.java similarity index 87% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsColoredForToday.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsColoredForToday.java index 50149f87d..213be9b94 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsColoredForToday.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsColoredForToday.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,6 +37,8 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.Today; public class VerbIsColoredForToday implements VerbPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsDeleted.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsDeleted.java similarity index 86% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsDeleted.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsDeleted.java index f4411a949..4b4f61daa 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsDeleted.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsDeleted.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,6 +37,8 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Task; public class VerbIsDeleted implements VerbPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbProjectStarts.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsForTask.java similarity index 71% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbProjectStarts.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsForTask.java index 8592f17fc..960f1932f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbProjectStarts.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsForTask.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,23 +37,26 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.Completion; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Task; -public class VerbProjectStarts implements VerbPattern { +public class VerbIsForTask implements VerbPattern { public Collection getComplements() { - return Arrays. asList(new ComplementDate()); + return Arrays.asList(new ComplementCompleted()); } public IRegex toRegex() { - return new RegexLeaf("starts[%s]*(the[%s]*|on[%s]*)*"); + return new RegexLeaf("is"); } public Verb getVerb(final GanttDiagram project, RegexResult arg) { return new Verb() { public CommandExecutionResult execute(Subject subject, Complement complement) { - final DayAsDate start = (DayAsDate) complement; - assert project == subject; - project.setStartingDate(start); + final Task task = (Task) subject; + final Completion completed = (Completion) complement; + task.setCompletion(completed.getCompletion()); return CommandExecutionResult.ok(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsForToday.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsForToday.java similarity index 83% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsForToday.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsForToday.java index 6dda0267a..3fd5fb8b1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsForToday.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsForToday.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,6 +37,8 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.Day; public class VerbIsForToday implements VerbPattern { @@ -51,8 +53,8 @@ public IRegex toRegex() { public Verb getVerb(final GanttDiagram project, RegexResult arg) { return new Verb() { public CommandExecutionResult execute(Subject subject, Complement complement) { - final Today task = (Today) subject; - final DayAsDate date = (DayAsDate) complement; + // final Today task = (Today) subject; + final Day date = (Day) complement; return project.setToday(date); } }; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsOff.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsOff.java new file mode 100644 index 000000000..b678b7ec6 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsOff.java @@ -0,0 +1,87 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.lang; + +import java.util.Arrays; +import java.util.Collection; + +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexOr; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.DaysAsDates; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Resource; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.DayOfWeek; + +public class VerbIsOff implements VerbPattern { + + public Collection getComplements() { + return Arrays + . asList(new ComplementDate(), new ComplementDates(), new ComplementDayOfWeek()); + } + + public IRegex toRegex() { + return new RegexConcat(new RegexLeaf("is"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("off"), // + RegexLeaf.spaceOneOrMore(), // + new RegexOr(// + new RegexLeaf("on"),// + new RegexLeaf("for"),// + new RegexLeaf("the"),// + new RegexLeaf("at") // + )); + } + + public Verb getVerb(final GanttDiagram project, RegexResult arg) { + return new Verb() { + public CommandExecutionResult execute(Subject subject, Complement complement) { + final Resource resource = (Resource) subject; + if (complement instanceof DayOfWeek) { + resource.addCloseDay(((DayOfWeek) complement)); + } else if (complement instanceof DaysAsDates) { + for (Day when : (DaysAsDates) complement) { + resource.addCloseDay(project.convert(when)); + } + } else { + final Day when = (Day) complement; + resource.addCloseDay(project.convert(when)); + } + return CommandExecutionResult.ok(); + } + + }; + } +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsOff.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsOn.java similarity index 69% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsOff.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsOn.java index 0fc83058c..8c3c3bd10 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsOff.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsOn.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,9 +37,14 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.DaysAsDates; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Resource; +import net.sourceforge.plantuml.project.time.Day; -public class VerbIsOff implements VerbPattern { +public class VerbIsOn implements VerbPattern { public Collection getComplements() { return Arrays. asList(new ComplementDate(), new ComplementDates()); @@ -48,9 +53,15 @@ public Collection getComplements() { public IRegex toRegex() { return new RegexConcat(new RegexLeaf("is"), // RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("off"), // + new RegexLeaf("on"), // RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("on")); + new RegexOr(// + new RegexLeaf("on"),// + new RegexLeaf("for"),// + new RegexLeaf("the"),// + new RegexLeaf("at") // + ) // + ); } public Verb getVerb(final GanttDiagram project, RegexResult arg) { @@ -58,17 +69,16 @@ public Verb getVerb(final GanttDiagram project, RegexResult arg) { public CommandExecutionResult execute(Subject subject, Complement complement) { final Resource resource = (Resource) subject; if (complement instanceof DaysAsDates) { - for (DayAsDate when : (DaysAsDates) complement) { - resource.addCloseDay(project.convert(when)); + for (Day when : (DaysAsDates) complement) { + resource.addForceOnDay(project.convert(when)); } } else { - final DayAsDate when = (DayAsDate) complement; - resource.addCloseDay(project.convert(when)); + final Day when = (Day) complement; + resource.addForceOnDay(project.convert(when)); } return CommandExecutionResult.ok(); } }; } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsOrAre.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsOrAre.java similarity index 79% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsOrAre.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsOrAre.java index b48dbb1d0..c5be1485c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsOrAre.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsOrAre.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,7 +37,10 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.project.DaysAsDates; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class VerbIsOrAre implements VerbPattern { @@ -54,7 +57,7 @@ public Verb getVerb(final GanttDiagram project, final RegexResult arg) { return new Verb() { public CommandExecutionResult execute(Subject subject, Complement complement) { if (complement instanceof ComplementColors) { - final HtmlColor color = ((ComplementColors) complement).getCenter(); + final HColor color = ((ComplementColors) complement).getCenter(); return manageColor(project, subject, color); } if (complement == ComplementClose.CLOSE) { @@ -68,14 +71,14 @@ public CommandExecutionResult execute(Subject subject, Complement complement) { }; } - private CommandExecutionResult manageColor(final GanttDiagram project, Subject subject, HtmlColor color) { - if (subject instanceof DayAsDate) { - final DayAsDate day = (DayAsDate) subject; + private CommandExecutionResult manageColor(final GanttDiagram project, Subject subject, HColor color) { + if (subject instanceof Day) { + final Day day = (Day) subject; project.colorDay(day, color); } if (subject instanceof DaysAsDates) { final DaysAsDates days = (DaysAsDates) subject; - for (DayAsDate d : days) { + for (Day d : days) { project.colorDay(d, color); } } @@ -83,13 +86,13 @@ private CommandExecutionResult manageColor(final GanttDiagram project, Subject s } private CommandExecutionResult manageClose(final GanttDiagram project, Subject subject) { - if (subject instanceof DayAsDate) { - final DayAsDate day = (DayAsDate) subject; + if (subject instanceof Day) { + final Day day = (Day) subject; project.closeDayAsDate(day); } if (subject instanceof DaysAsDates) { final DaysAsDates days = (DaysAsDates) subject; - for (DayAsDate d : days) { + for (Day d : days) { project.closeDayAsDate(d); } } @@ -97,13 +100,13 @@ private CommandExecutionResult manageClose(final GanttDiagram project, Subject s } private CommandExecutionResult manageOpen(final GanttDiagram project, Subject subject) { - if (subject instanceof DayAsDate) { - final DayAsDate day = (DayAsDate) subject; + if (subject instanceof Day) { + final Day day = (Day) subject; project.openDayAsDate(day); } if (subject instanceof DaysAsDates) { final DaysAsDates days = (DaysAsDates) subject; - for (DayAsDate d : days) { + for (Day d : days) { project.openDayAsDate(d); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsOrAreNamed.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsOrAreNamed.java similarity index 84% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsOrAreNamed.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsOrAreNamed.java index 34859e4bf..864677800 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbIsOrAreNamed.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbIsOrAreNamed.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,6 +37,9 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.DaysAsDates; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.Day; public class VerbIsOrAreNamed implements VerbPattern { @@ -54,7 +57,7 @@ public CommandExecutionResult execute(Subject subject, Complement complement) { final ComplementName named = (ComplementName) complement; final String name = named.getName(); final DaysAsDates days = (DaysAsDates) subject; - for (DayAsDate d : days) { + for (Day d : days) { project.nameDay(d, name); } return CommandExecutionResult.ok(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbLasts.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbLasts.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbLasts.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbLasts.java index 8c10a6f0c..50d965c29 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbLasts.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbLasts.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,6 +37,9 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.Load; +import net.sourceforge.plantuml.project.core.Task; public class VerbLasts implements VerbPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbLinksTo.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbLinksTo.java new file mode 100644 index 000000000..adf8a636b --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbLinksTo.java @@ -0,0 +1,65 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.lang; + +import java.util.Arrays; +import java.util.Collection; + +import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Task; + +public class VerbLinksTo implements VerbPattern { + + public Collection getComplements() { + return Arrays.asList(new ComplementUrl()); + } + + public IRegex toRegex() { + return new RegexLeaf("links to"); + } + + public Verb getVerb(GanttDiagram project, RegexResult arg) { + return new Verb() { + public CommandExecutionResult execute(Subject subject, Complement complement) { + final Task task = (Task) subject; + final Url url = (Url) complement; + task.setUrl(url); + return CommandExecutionResult.ok(); + } + + }; + } +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbPattern.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbPattern.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbPattern.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbPattern.java index 27a5a851d..877d17339 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbPattern.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbPattern.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,12 +28,13 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Collection; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; public interface VerbPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbProjectStarts.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbProjectStarts.java new file mode 100644 index 000000000..46013f80d --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbProjectStarts.java @@ -0,0 +1,80 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.lang; + +import java.util.Arrays; +import java.util.Collection; + +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexOptional; +import net.sourceforge.plantuml.command.regex.RegexOr; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.time.Day; + +public class VerbProjectStarts implements VerbPattern { + + public Collection getComplements() { + return Arrays. asList(new ComplementDate()); + } + + public IRegex toRegexOld() { + return new RegexLeaf("starts[%s]*(the[%s]*|on[%s]*)*"); + } + + public IRegex toRegex() { + return new RegexConcat(new RegexLeaf("start"), // + new RegexOptional(new RegexLeaf("s")), // + RegexLeaf.spaceZeroOrMore(), // + new RegexOptional(new RegexOr(// + new RegexLeaf("on"),// + new RegexLeaf("for"),// + new RegexLeaf("the"),// + new RegexLeaf("at") // + )) // + ); + } + + public Verb getVerb(final GanttDiagram project, RegexResult arg) { + return new Verb() { + public CommandExecutionResult execute(Subject subject, Complement complement) { + final Day start = (Day) complement; + assert project == subject; + project.setStartingDate(start); + return CommandExecutionResult.ok(); + } + + }; + } +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbTaskEndsAbsolute.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbTaskEndsAbsolute.java similarity index 82% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbTaskEndsAbsolute.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbTaskEndsAbsolute.java index 282747720..48dd32440 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbTaskEndsAbsolute.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbTaskEndsAbsolute.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,6 +37,9 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Task; +import net.sourceforge.plantuml.project.time.Day; public class VerbTaskEndsAbsolute implements VerbPattern { @@ -52,8 +55,8 @@ public Verb getVerb(final GanttDiagram project, RegexResult arg) { return new Verb() { public CommandExecutionResult execute(Subject subject, Complement complement) { final Task task = (Task) subject; - final DayAsDate end = (DayAsDate) complement; - final DayAsDate startingDate = project.getStartingDate(); + final Day end = (Day) complement; + final Day startingDate = project.getStartingDate(); if (startingDate == null) { return CommandExecutionResult.error("No starting date for the project"); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbTaskStarts.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbTaskStarts.java similarity index 81% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbTaskStarts.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbTaskStarts.java index 2d09badcf..e8aee6588 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbTaskStarts.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbTaskStarts.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,6 +37,11 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttConstraint; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Task; +import net.sourceforge.plantuml.project.core.TaskAttribute; +import net.sourceforge.plantuml.project.core.TaskInstant; public class VerbTaskStarts implements VerbPattern { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbTaskStartsAbsolute.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbTaskStartsAbsolute.java similarity index 82% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbTaskStartsAbsolute.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbTaskStartsAbsolute.java index f50599eee..f75cf2eed 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/VerbTaskStartsAbsolute.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/lang/VerbTaskStartsAbsolute.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.lang; import java.util.Arrays; import java.util.Collection; @@ -37,6 +37,9 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.project.GanttDiagram; +import net.sourceforge.plantuml.project.core.Task; +import net.sourceforge.plantuml.project.time.Day; public class VerbTaskStartsAbsolute implements VerbPattern { @@ -52,8 +55,8 @@ public Verb getVerb(final GanttDiagram project, RegexResult arg) { return new Verb() { public CommandExecutionResult execute(Subject subject, Complement complement) { final Task task = (Task) subject; - final DayAsDate start = (DayAsDate) complement; - final DayAsDate startingDate = project.getStartingDate(); + final Day start = (Day) complement; + final Day startingDate = project.getStartingDate(); if (startingDate == null) { return CommandExecutionResult.error("No starting date for the project"); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/time/Day.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/time/Day.java new file mode 100644 index 000000000..a88e0fcb9 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/time/Day.java @@ -0,0 +1,184 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.time; + +import java.util.Date; + +import net.sourceforge.plantuml.project.lang.Complement; +import net.sourceforge.plantuml.project.lang.Subject; + +public class Day implements Complement, Comparable, Subject { + + private final int dayOfMonth; + private final MonthYear monthYear; + + public static Day create(int year, String month, int dayOfMonth) { + return new Day(year, Month.fromString(month), dayOfMonth); + } + + public static Day create(int year, int month, int dayOfMonth) { + return new Day(year, Month.values()[month - 1], dayOfMonth); + } + + public static Day today() { + final Date now = new Date(); + final int year = now.getYear() + 1900; + final int month = now.getMonth() + 1; + final int dayOfMonth = now.getDate(); + return create(year, month, dayOfMonth); + } + + private Day(int year, Month month, int dayOfMonth) { + this(MonthYear.create(year, month), dayOfMonth); + } + + private Day(MonthYear monthYear, int dayOfMonth) { + this.dayOfMonth = dayOfMonth; + this.monthYear = monthYear; + } + + public int year() { + return monthYear.year(); + } + + private int internalNumber() { + return year() * 100 * 100 + month().ordinal() * 100 + dayOfMonth; + } + + @Override + public String toString() { + return monthYear.toString() + "/" + dayOfMonth; + } + + @Override + public int hashCode() { + return monthYear.hashCode() + dayOfMonth * 17; + } + + @Override + public boolean equals(Object obj) { + final Day other = (Day) obj; + return other.internalNumber() == this.internalNumber(); + } + + public final int getDayOfMonth() { + return dayOfMonth; + } + + private int daysPerMonth() { + return month().getDaysPerMonth(year()); + } + + public Day next() { + int newDayOfMonth = dayOfMonth + 1; + if (newDayOfMonth <= daysPerMonth()) { + return new Day(year(), month(), newDayOfMonth); + } + assert newDayOfMonth > daysPerMonth(); + return new Day(monthYear.next(), 1); + } + + public Month month() { + return monthYear.month(); + } + + public MonthYear monthYear() { + return monthYear; + } + + // https://en.wikipedia.org/wiki/Zeller%27s_congruence + public DayOfWeek getDayOfWeek() { + final int q = dayOfMonth; + final int m = month().m(); + final int y = m >= 13 ? year() - 1 : year(); + final int k = y % 100; + final int j = y / 100; + final int h = ((q + 13 * (m + 1) / 5) + k + k / 4 + j / 4 + 5 * j) % 7; + return DayOfWeek.fromH(h); + } + + public static int DOW(int y_, int m_, int d_) { + final int q = d_; + final int m = 3 + (m_ - 1 + 10) % 12; + final int y = m >= 13 ? y_ - 1 : y_; + final int k = y % 100; + final int j = y / 100; + final int h = ((q + 13 * (m + 1) / 5) + k + k / 4 + j / 4 + 5 * j) % 7; + return h; + } + + public Wink asInstantDay(Day reference) { + // if (this.compareTo(reference) < 0) { + // throw new IllegalArgumentException(); + // } + int cmp = 0; + Day current = reference; + while (current.compareTo(this) < 0) { + current = current.next(); + cmp++; + } + return new Wink(cmp); + } + + // https://www.staff.science.uu.nl/~gent0113/calendar/isocalendar_text_5.htm + // https://en.wikipedia.org/wiki/ISO_week_date + // http://www.proesite.com/timex/wkcalc.htm + public int ISO_WN() { + final int y = year(); + int m = month().ordinal() + 1; + int d = dayOfMonth; + int dow = DOW(y, m, d); + int dow0101 = DOW(y, 1, 1); + + if (m == 1 && 3 < dow0101 && dow0101 < 7 - (d - 1)) { + // days before week 1 of the current year have the same week number as + // the last day of the last week of the previous year + + dow = dow0101 - 1; + dow0101 = DOW(y - 1, 1, 1); + m = 12; + d = 31; + } else if (m == 12 && 30 - (d - 1) < DOW(y + 1, 1, 1) && DOW(y + 1, 1, 1) < 4) { + // days after the last week of the current year have the same week number as + // the first day of the next year, (i.e. 1) + + return 1; + } + + return (DOW(y, 1, 1) < 4) ? 1 : 0 + 4 * (m - 1) + (2 * (m - 1) + (d - 1) + dow0101 - dow + 6) * 36 / 256; + + } + + public int compareTo(Day other) { + return this.internalNumber() - other.internalNumber(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/DayOfWeek.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/time/DayOfWeek.java similarity index 84% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/DayOfWeek.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/time/DayOfWeek.java index 5e1f6c723..0206effe6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/DayOfWeek.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/time/DayOfWeek.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,11 +28,13 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.time; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.project.lang.Complement; +import net.sourceforge.plantuml.project.lang.Subject; -public enum DayOfWeek implements Subject { +public enum DayOfWeek implements Subject, Complement { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/GCalendarSimple.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/time/GCalendar.java similarity index 71% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/GCalendarSimple.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/time/GCalendar.java index 37923b8f4..7d23b94f8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/GCalendarSimple.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/time/GCalendar.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,19 +28,19 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.time; -public class GCalendarSimple implements GCalendar { +public class GCalendar { - private final DayAsDate start; + private final Day start; - public GCalendarSimple(DayAsDate start) { + public GCalendar(Day start) { this.start = start; } - public DayAsDate toDayAsDate(InstantDay day) { - DayAsDate result = start; - final int target = day.getNumDay(); + public Day toDayAsDate(Wink day) { + Day result = start; + final int target = day.getWink(); int work = 0; while (work < target) { result = result.next(); @@ -49,18 +49,18 @@ public DayAsDate toDayAsDate(InstantDay day) { return result; } - public InstantDay fromDayAsDate(DayAsDate day) { + public Wink fromDayAsDate(Day day) { if (day.compareTo(start) < 0) { throw new IllegalArgumentException(); } - InstantDay result = new InstantDay(0); + Wink result = new Wink(0); while (toDayAsDate(result).equals(day) == false) { result = result.increment(); } return result; } - public DayAsDate getStartingDate() { + public Day getStartingDate() { return start; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Month.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/time/Month.java similarity index 86% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/Month.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/time/Month.java index f897ac28c..47a9627e0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/Month.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/time/Month.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.time; import net.sourceforge.plantuml.StringUtils; @@ -43,6 +43,14 @@ private Month(int daysPerMonth) { this.daysPerMonth = daysPerMonth; } + public String shortName() { + return longName().substring(0, 3); + } + + public String longName() { + return StringUtils.capitalize(name()); + } + static public String getRegexString() { final StringBuilder sb = new StringBuilder(); for (Month month : Month.values()) { @@ -78,4 +86,5 @@ public Month next() { public int m() { return 3 + (ordinal() + 10) % 12; } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/time/MonthYear.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/time/MonthYear.java new file mode 100644 index 000000000..c4a42c923 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/time/MonthYear.java @@ -0,0 +1,104 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.time; + +public class MonthYear implements Comparable { + + private final int year; + private final Month month; + + public static MonthYear create(int year, Month month) { + return new MonthYear(year, month); + } + + public String shortName() { + return month.shortName(); + } + + public String shortNameYYYY() { + return month.shortName() + " " + year; + } + + public String longName() { + return month.longName(); + } + + public String longNameYYYY() { + return month.longName() + " " + year; + } + + private MonthYear(int year, Month month) { + this.year = year; + this.month = month; + } + + public int year() { + return year; + } + + public MonthYear next() { + final Month newMonth = month.next(); + final int newYear = newMonth == Month.JANUARY ? year + 1 : year; + return new MonthYear(newYear, newMonth); + } + + public Month month() { + return month; + } + + private int internalNumber() { + return year * 100 + month.ordinal(); + } + + @Override + public String toString() { + return "" + year + "/" + month; + } + + @Override + public int hashCode() { + return year * 113 + month.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + final MonthYear other = (MonthYear) obj; + return other.internalNumber() == this.internalNumber(); + } + + public int compareTo(MonthYear other) { + return this.internalNumber() - other.internalNumber(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/time/Wink.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/time/Wink.java new file mode 100644 index 000000000..e9a52554e --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/time/Wink.java @@ -0,0 +1,82 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.time; + +import net.sourceforge.plantuml.project.Value; + +public class Wink implements Value, Comparable { + + private final int wink; + + public Wink(int wink) { + this.wink = wink; + } + + @Override + public String toString() { + return "(Wink +" + wink + ")"; + } + + public Wink increment() { + return new Wink(wink + 1); + } + + public Wink decrement() { + return new Wink(wink - 1); + } + + public final int getWink() { + return wink; + } + + public int compareTo(Wink other) { + return this.wink - other.wink; + } + + public String toShortString() { + return "" + (wink + 1); + } + + public static Wink min(Wink wink1, Wink wink2) { + if (wink2.wink < wink1.wink) { + return wink2; + } + return wink1; + } + + public static Wink max(Wink wink1, Wink wink2) { + if (wink2.wink > wink1.wink) { + return wink2; + } + return wink1; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TimeScale.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/TimeScale.java similarity index 73% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/TimeScale.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/TimeScale.java index 3b181c741..4b75742c3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TimeScale.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/TimeScale.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,14 +28,16 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.timescale; + +import net.sourceforge.plantuml.project.time.Wink; public interface TimeScale { - public double getStartingPosition(Instant instant); + public double getStartingPosition(Wink instant); - public double getEndingPosition(Instant instant); + public double getEndingPosition(Wink instant); - public double getWidth(Instant instant); + public double getWidth(Wink instant); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/TimeScaleCompressed.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/TimeScaleCompressed.java new file mode 100644 index 000000000..b2b2e5c8c --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/TimeScaleCompressed.java @@ -0,0 +1,58 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.timescale; + +import net.sourceforge.plantuml.project.time.GCalendar; +import net.sourceforge.plantuml.project.time.Wink; + +public class TimeScaleCompressed implements TimeScale { + + private final int compress; + private final TimeScale daily; + + public TimeScaleCompressed(GCalendar calendar, int compress) { + this.daily = new TimeScaleDaily(calendar, null); + this.compress = compress; + } + + public double getStartingPosition(Wink instant) { + return daily.getStartingPosition(instant) / compress; + } + + public double getEndingPosition(Wink instant) { + return daily.getEndingPosition(instant) / compress; + } + + public double getWidth(Wink instant) { + return daily.getWidth(instant) / compress; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/TimeScaleDaily.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/TimeScaleDaily.java new file mode 100644 index 000000000..a84e86d83 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/TimeScaleDaily.java @@ -0,0 +1,64 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.project.timescale; + +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.GCalendar; +import net.sourceforge.plantuml.project.time.Wink; + +public final class TimeScaleDaily implements TimeScale { + + private final TimeScaleWink basic; + private final double delta; + + public TimeScaleDaily(GCalendar calendar, Day zeroDay) { + this.basic = new TimeScaleWink(); + if (zeroDay == null) { + this.delta = 0; + } else { + this.delta = basic.getStartingPosition(calendar.fromDayAsDate(zeroDay)); + } + + } + + public double getStartingPosition(Wink instant) { + return basic.getStartingPosition(instant) - delta; + } + + public double getEndingPosition(Wink instant) { + return basic.getEndingPosition(instant) - delta; + } + + public double getWidth(Wink instant) { + return basic.getWidth(instant); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TimeScaleBasic.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/TimeScaleWink.java similarity index 69% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/TimeScaleBasic.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/TimeScaleWink.java index 1da5e5c10..ece0abba4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TimeScaleBasic.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/TimeScaleWink.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,22 +28,24 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.timescale; -public class TimeScaleBasic implements TimeScale { +import net.sourceforge.plantuml.project.time.Wink; + +public class TimeScaleWink implements TimeScale { private final double scale = 16.0; - public double getStartingPosition(Instant instant) { - final int day = ((InstantDay) instant).getNumDay(); - return day * scale; + public double getStartingPosition(Wink instant) { + final int wink = instant.getWink(); + return wink * scale; } - public double getEndingPosition(Instant instant) { + public double getEndingPosition(Wink instant) { return getStartingPosition(instant) + getWidth(instant); } - public double getWidth(Instant instant) { + public double getWidth(Wink instant) { return scale; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TimeScaleWithoutWeekEnd.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/UnusedTimeScaleWithoutWeekEnd.java similarity index 65% rename from src/plantuml-asl/src/net/sourceforge/plantuml/project3/TimeScaleWithoutWeekEnd.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/UnusedTimeScaleWithoutWeekEnd.java index fd5215831..2970cf8a4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TimeScaleWithoutWeekEnd.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/project/timescale/UnusedTimeScaleWithoutWeekEnd.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,32 +28,37 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.project3; +package net.sourceforge.plantuml.project.timescale; -public class TimeScaleWithoutWeekEnd implements TimeScale { +import net.sourceforge.plantuml.project.time.Day; +import net.sourceforge.plantuml.project.time.DayOfWeek; +import net.sourceforge.plantuml.project.time.GCalendar; +import net.sourceforge.plantuml.project.time.Wink; + +public class UnusedTimeScaleWithoutWeekEnd implements TimeScale { private final double scale = 16.0; private final GCalendar calendar; - public TimeScaleWithoutWeekEnd(GCalendar calendar) { + public UnusedTimeScaleWithoutWeekEnd(GCalendar calendar) { if (calendar == null) { throw new IllegalArgumentException(); } this.calendar = calendar; } - public double getStartingPosition(Instant instant) { + public double getStartingPosition(Wink instant) { double result = 0; - InstantDay current = (InstantDay) instant; - while (current.getNumDay() > 0) { + Wink current = (Wink) instant; + while (current.getWink() > 0) { current = current.decrement(); result += getWidth(current); } return result; } - public double getWidth(Instant instant) { - final DayAsDate day = calendar.toDayAsDate((InstantDay) instant); + public double getWidth(Wink instant) { + final Day day = calendar.toDayAsDate((Wink) instant); final DayOfWeek dayOfWeek = day.getDayOfWeek(); if (dayOfWeek == DayOfWeek.SATURDAY || dayOfWeek == DayOfWeek.SUNDAY) { return 1; @@ -61,7 +66,7 @@ public double getWidth(Instant instant) { return scale; } - public double getEndingPosition(Instant instant) { + public double getEndingPosition(Wink instant) { throw new UnsupportedOperationException(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/DayAsDate.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project3/DayAsDate.java deleted file mode 100644 index 485fa81ca..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/DayAsDate.java +++ /dev/null @@ -1,135 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.project3; - -import java.util.Date; - -public class DayAsDate implements Complement, Comparable, Subject { - - private final int year; - private final int dayOfMonth; - private final Month month; - - public static DayAsDate create(int year, String month, int dayOfMonth) { - return new DayAsDate(year, Month.fromString(month), dayOfMonth); - } - - public static DayAsDate create(int year, int month, int dayOfMonth) { - return new DayAsDate(year, Month.values()[month - 1], dayOfMonth); - } - - public static DayAsDate today() { - final Date now = new Date(); - final int year = now.getYear() + 1900; - final int month = now.getMonth() + 1; - final int dayOfMonth = now.getDate(); - return create(year, month, dayOfMonth); - } - - private DayAsDate(int year, Month month, int dayOfMonth) { - this.year = year; - this.dayOfMonth = dayOfMonth; - this.month = month; - } - - private int internalNumber() { - return year * 100 * 100 + month.ordinal() * 100 + dayOfMonth; - } - - @Override - public String toString() { - return "" + year + "/" + month + "/" + dayOfMonth; - } - - @Override - public int hashCode() { - return year * 113 + dayOfMonth * 17 + month.hashCode(); - } - - @Override - public boolean equals(Object obj) { - final DayAsDate other = (DayAsDate) obj; - return other.internalNumber() == this.internalNumber(); - } - - public final int getDayOfMonth() { - return dayOfMonth; - } - - private int daysPerMonth() { - return month.getDaysPerMonth(year); - } - - public DayAsDate next() { - int newDayOfMonth = dayOfMonth + 1; - if (newDayOfMonth <= daysPerMonth()) { - return new DayAsDate(year, month, newDayOfMonth); - } - assert newDayOfMonth > daysPerMonth(); - newDayOfMonth = 1; - final Month newMonth = month.next(); - final int newYear = newMonth == Month.JANUARY ? year + 1 : year; - return new DayAsDate(newYear, newMonth, newDayOfMonth); - } - - public Month getMonth() { - return month; - } - - // https://en.wikipedia.org/wiki/Zeller%27s_congruence - public DayOfWeek getDayOfWeek() { - final int q = dayOfMonth; - final int m = month.m(); - final int y = m >= 13 ? year - 1 : year; - final int k = y % 100; - final int j = y / 100; - final int h = ((q + 13 * (m + 1) / 5) + k + k / 4 + j / 4 + 5 * j) % 7; - return DayOfWeek.fromH(h); - } - - public InstantDay asInstantDay(DayAsDate reference) { - // if (this.compareTo(reference) < 0) { - // throw new IllegalArgumentException(); - // } - int cmp = 0; - DayAsDate current = reference; - while (current.compareTo(this) < 0) { - current = current.next(); - cmp++; - } - return new InstantDay(cmp); - } - - public int compareTo(DayAsDate other) { - return this.internalNumber() - other.internalNumber(); - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/GCalendar.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project3/GCalendar.java deleted file mode 100644 index 1104eedca..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/GCalendar.java +++ /dev/null @@ -1,41 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.project3; - -public interface GCalendar { - - public DayAsDate toDayAsDate(InstantDay day); - - public DayAsDate getStartingDate(); - - public InstantDay fromDayAsDate(DayAsDate day); - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskDrawRegular.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskDrawRegular.java deleted file mode 100644 index e9498af0a..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TaskDrawRegular.java +++ /dev/null @@ -1,159 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.project3; - -import net.sourceforge.plantuml.Direction; -import net.sourceforge.plantuml.SpriteContainerEmpty; -import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; -import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UPolygon; -import net.sourceforge.plantuml.ugraphic.URectangle; -import net.sourceforge.plantuml.ugraphic.UShape; -import net.sourceforge.plantuml.ugraphic.UTranslate; - -public class TaskDrawRegular implements TaskDraw { - - // private static final HtmlColor defaultColor = HtmlColorUtils.COL_84BE84; - private static final HtmlColor defaultColor = new HtmlColorSetSimple().getColorIfValid("GreenYellow"); - private final TaskImpl task; - private final TimeScale timeScale; - private final double y; - private ComplementColors colors; - - private final double margin = 2; - - public TaskDrawRegular(TaskImpl task, TimeScale timeScale, double y) { - this.y = y; - this.task = task; - this.timeScale = timeScale; - } - - public void drawTitle(UGraphic ug) { - final TextBlock title = Display.getWithNewlines(task.getPrettyDisplay()).create(getFontConfiguration(), - HorizontalAlignment.LEFT, new SpriteContainerEmpty()); - final double shapeHeight = getShapeHeight(100); - final double titleHeight = title.calculateDimension(ug.getStringBounder()).getHeight(); - final double h = (margin + shapeHeight - titleHeight) / 2; - title.drawU(ug.apply(new UTranslate(timeScale.getEndingPosition(task.getStart()), h))); - } - - private FontConfiguration getFontConfiguration() { - final UFont font = UFont.serif(11); - return new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK, false); - } - - public void drawU(UGraphic ug1) { - final double start = timeScale.getStartingPosition(task.getStart()); - ug1 = applyColors(ug1); - UGraphic ug2 = ug1.apply(new UTranslate(start + margin, margin)); - final UShape shapeFull = getShape(100); - if (shapeFull instanceof UPolygon) { - ug2.draw(shapeFull); - } else { - ug2.draw(shapeFull); - } - } - - private UGraphic applyColors(UGraphic ug) { - if (colors != null && colors.isOk()) { - return colors.apply(ug); - } - if (isDiamond()) { - return ug.apply(new UChangeColor(HtmlColorUtils.BLACK)).apply(new UChangeBackColor(HtmlColorUtils.BLACK)); - } - return ug.apply(new UChangeColor(HtmlColorUtils.BLUE)).apply(new UChangeBackColor(defaultColor)); - } - - private UShape getShape(int load) { - if (isDiamond()) { - return getDiamond(); - } - final Instant instantStart = task.getStart(); - final Instant instantEnd = task.getEnd(); - final double start = timeScale.getStartingPosition(instantStart); - final double end = timeScale.getEndingPosition(instantEnd); - return new URectangle(end - start - 2 * margin, getShapeHeight(load), 8, 8); - } - - private double getShapeHeight(int load) { - return (getHeight() - 2 * margin) * load / 100.0; - } - - private boolean isDiamond() { - if (task.isDiamond()) { - final Instant instantStart = task.getStart(); - final Instant instantEnd = task.getEnd(); - return instantStart.compareTo(instantEnd) == 0; - } - return false; - } - - private UShape getDiamond() { - final double h = getHeight() - 2 * margin; - final UPolygon result = new UPolygon(); - result.addPoint(h / 2, 0); - result.addPoint(h, h / 2); - result.addPoint(h / 2, h); - result.addPoint(0, h / 2); - return result; - } - - public double getHeight() { - return 16; - } - - public double getY() { - return y; - } - - public double getY(Direction direction) { - if (direction == Direction.UP) { - return y; - } - if (direction == Direction.DOWN) { - return y + getHeight(); - } - return y + getHeight() / 2; - } - - public void setColors(ComplementColors colors) { - this.colors = colors; - } -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TimeScaleBasic2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TimeScaleBasic2.java deleted file mode 100644 index 07729b160..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/project3/TimeScaleBasic2.java +++ /dev/null @@ -1,74 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.project3; - -import java.util.Map; -import java.util.TreeMap; - -public class TimeScaleBasic2 implements TimeScale { - - private final GCalendar calendar; - private final GCalendar calendarAllOpen; - private final TimeScaleBasic basic = new TimeScaleBasic(); - private final Map cache = new TreeMap(); - - public TimeScaleBasic2(GCalendarSimple calendar) { - this.calendar = calendar; - this.calendarAllOpen = calendar; - } - - private Instant changeInstantSlow(Instant instant) { - final DayAsDate day = calendar.toDayAsDate((InstantDay) instant); - return calendarAllOpen.fromDayAsDate(day); - } - - private Instant changeInstant(Instant instant) { - Instant result = cache.get(instant); - if (result == null) { - result = changeInstantSlow(instant); - cache.put(instant, result); - } - return result; - } - - public double getStartingPosition(Instant instant) { - return basic.getStartingPosition(changeInstant(instant)); - } - - public double getEndingPosition(Instant instant) { - return basic.getEndingPosition(changeInstant(instant)); - } - - public double getWidth(Instant instant) { - return basic.getWidth(changeInstant(instant)); - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/real/AbstractReal.java b/src/plantuml-asl/src/net/sourceforge/plantuml/real/AbstractReal.java index be66a4184..674dbd95b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/real/AbstractReal.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/real/AbstractReal.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/real/PositiveForce.java b/src/plantuml-asl/src/net/sourceforge/plantuml/real/PositiveForce.java index 7095e1b2a..816f50292 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/real/PositiveForce.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/real/PositiveForce.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/real/Real.java b/src/plantuml-asl/src/net/sourceforge/plantuml/real/Real.java index 989f29c71..ccb9b74fe 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/real/Real.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/real/Real.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealDelta.java b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealDelta.java index c3fe3600d..8c6bac9d1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealDelta.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealDelta.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealImpl.java index 759a8dfc4..0dec33839 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealLine.java index e4e4fcf74..a43950f28 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMax.java b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMax.java index 11a09455f..eaa682212 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMax.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMax.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMiddle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMiddle.java index b1fc1b0b0..8a773653a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMiddle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMiddle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMiddle2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMiddle2.java index 9b9a36aa3..08ab7f813 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMiddle2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMiddle2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMin.java b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMin.java index f16d320c8..7cca017e8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMin.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMin.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMoveable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMoveable.java index 4dfd465d6..bf4895576 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMoveable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealMoveable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealOrigin.java b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealOrigin.java index a29d4ef40..0ba7cc0e4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealOrigin.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealOrigin.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealUtils.java index 3689e2af6..d4af8a75c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/real/RealUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Cell.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Cell.java index 0db85e96d..f40cc5d5e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Cell.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Cell.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/DataSource.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/DataSource.java index 53b2908f8..47a0cd48d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/DataSource.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/DataSource.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/DataSourceImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/DataSourceImpl.java index 3898b4f5a..94e68b4bb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/DataSourceImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/DataSourceImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Dictionary.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Dictionary.java index d3e19a7e4..b390a01e0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Dictionary.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Dictionary.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,14 +37,13 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.SpriteContainer; -import net.sourceforge.plantuml.creole.CommandCreoleMonospaced; -import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.salt.element.Element; import net.sourceforge.plantuml.salt.element.WrappedElement; -import net.sourceforge.plantuml.ugraphic.ColorMapper; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; +import net.sourceforge.plantuml.sprite.Sprite; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class Dictionary implements SpriteContainer, ISkinSimple { @@ -79,15 +78,15 @@ public Guillemet guillemet() { } public String getMonospacedFamily() { - return CommandCreoleMonospaced.MONOSPACED; + return Parser.MONOSPACED; } public int getTabSize() { return 8; } - public IHtmlColorSet getIHtmlColorSet() { - return new HtmlColorSetSimple(); + public HColorSet getIHtmlColorSet() { + return HColorSet.instance(); } public int getDpi() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/PSystemSalt.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/PSystemSalt.java index 120e7510a..809842aba 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/PSystemSalt.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/PSystemSalt.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,16 +43,16 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.ScaleSimple; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.WithSprite; import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandExecutionResult; -import net.sourceforge.plantuml.command.FactorySpriteCommand; +import net.sourceforge.plantuml.command.CommandFactorySprite; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.salt.element.Element; import net.sourceforge.plantuml.salt.factory.AbstractElementFactoryComplex; @@ -74,11 +74,12 @@ import net.sourceforge.plantuml.salt.factory.ElementFactoryText; import net.sourceforge.plantuml.salt.factory.ElementFactoryTextField; import net.sourceforge.plantuml.salt.factory.ElementFactoryTree; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.sprite.Sprite; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.ugraphic.ImageBuilder; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemSalt extends AbstractPSystem implements WithSprite { @@ -110,12 +111,24 @@ final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatO if (getScale() != null) { scale = getScale().getScale(size.getWidth(), size.getHeight()); } - final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), scale, HtmlColorUtils.WHITE, null, - null, 5, 5, null, false); + + final int margin1; + final int margin2; + if (SkinParam.USE_STYLES()) { + margin1 = SkinParam.zeroMargin(5); + margin2 = SkinParam.zeroMargin(5); + } else { + margin1 = 5; + margin2 = 5; + } + + final ImageBuilder builder = ImageBuilder.buildB(new ColorMapperIdentity(), false, + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), null, getMetadata(), null, scale, + HColorUtils.WHITE); builder.setUDrawable(new UDrawable() { public void drawU(UGraphic ug) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK)); + ug = ug.apply(HColorUtils.BLACK); salt.drawU(ug, 0, new Dimension2DDouble(size.getWidth(), size.getHeight())); salt.drawU(ug, 1, new Dimension2DDouble(size.getWidth(), size.getHeight())); } @@ -138,8 +151,7 @@ public void addSprite(String name, Sprite sprite) { private List manageSprite() { - final FactorySpriteCommand factorySpriteCommand = new FactorySpriteCommand(); - Command cmd = factorySpriteCommand.createMultiLine(false); + final Command cmd = new CommandFactorySprite().createMultiLine(false); final List result = new ArrayList(); for (Iterator it = data.iterator(); it.hasNext();) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/PSystemSaltFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/PSystemSaltFactory.java index 7d196de50..9aae90d61 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/PSystemSaltFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/PSystemSaltFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Position.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Position.java index 2203e60e7..4448ad768 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Position.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Position.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Positionner2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Positionner2.java index 10bc8eb79..58bd84221 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Positionner2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Positionner2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Terminated.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Terminated.java index 6f8c160a1..be6364374 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Terminated.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Terminated.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Terminator.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Terminator.java index 9543c9c89..183061173 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Terminator.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/Terminator.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/AbstractElement.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/AbstractElement.java index 1d1d0d192..078b6fed5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/AbstractElement.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/AbstractElement.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/AbstractElementText.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/AbstractElementText.java index f6a6d613a..496cfbd6a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/AbstractElementText.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/AbstractElementText.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Element.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Element.java index f24d544d6..ce6664430 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Element.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Element.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementBorder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementBorder.java index 679aae143..f1b68d8be 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementBorder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementBorder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -80,8 +80,8 @@ public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { // - dimSouth.getHeight()); north.drawU(ug, zIndex, dimToUse); - south.drawU(ug.apply(new UTranslate(0, pC.getY())), zIndex, dimToUse); - west.drawU(ug.apply(new UTranslate(0, pA.getY())), zIndex, dimToUse); + south.drawU(ug.apply(UTranslate.dy(pC.getY())), zIndex, dimToUse); + west.drawU(ug.apply(UTranslate.dy(pA.getY())), zIndex, dimToUse); east.drawU(ug.apply(new UTranslate(pB.getX(), pB.getY())), zIndex, dimToUse); center.drawU(ug.apply(new UTranslate(pA.getX(), pA.getY())), zIndex, dimToUse); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementButton.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementButton.java index 96b4a1ddf..a1ea4aee5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementButton.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementButton.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,14 +34,13 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinSimple; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; 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.HColorSet; public class ElementButton extends AbstractElementText implements Element { @@ -65,9 +64,9 @@ public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { } final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0); ug = ug.apply(new UStroke(stroke)); - ug = ug.apply(new UChangeBackColor(HtmlColorSet.getInstance().getColorIfValid("#EEEEEE"))); + ug = ug.apply(HColorSet.instance().getColorIfValid("#EEEEEE").bg()); ug.apply(new UTranslate(stroke, stroke)).draw( - new URectangle(dim.getWidth() - 2 * stroke, dim.getHeight() - 2 * stroke, 10, 10)); + 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/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java index aed7d7293..f898dcd90 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,16 +39,16 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; 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 { @@ -88,11 +88,11 @@ public Dimension2D getPreferredDimension(StringBounder stringBounder, double x, public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0); if (zIndex == 0) { - ug.apply(new UChangeBackColor(HtmlColorSet.getInstance().getColorIfValid("#EEEEEE"))).draw( - new URectangle(dim.getWidth() - 1, dim.getHeight() - 1)); + ug.apply(HColorSet.instance().getColorIfValid("#EEEEEE").bg()) + .draw(new URectangle(dim.getWidth() - 1, dim.getHeight() - 1)); drawText(ug, 2, 2); final double xline = dim.getWidth() - box; - ug.apply(new UTranslate(xline, 0)).draw(new ULine(0, dim.getHeight() - 1)); + ug.apply(UTranslate.dx(xline)).draw(ULine.vline(dim.getHeight() - 1)); final UPolygon poly = new UPolygon(); poly.addPoint(0, 0); @@ -100,16 +100,16 @@ public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { final Dimension2D dimText = getPureTextDimension(ug.getStringBounder()); poly.addPoint((box - 6) / 2, dimText.getHeight() - 8); - ug.apply(new UChangeBackColor(ug.getParam().getColor())).apply(new UTranslate(xline + 3, 6)).draw(poly); + ug.apply(HColorUtils.changeBack(ug)).apply(new UTranslate(xline + 3, 6)).draw(poly); } if (openDrop != null) { final Dimension2D dimOpen = Dimension2DDouble.atLeast(openDrop.calculateDimension(ug.getStringBounder()), dim.getWidth() - 1, 0); - ug.apply(new UChangeBackColor(HtmlColorSet.getInstance().getColorIfValid("#EEEEEE"))) - .apply(new UTranslate(0, dim.getHeight() - 1)) + ug = ug.apply(UTranslate.dy(dim.getHeight() - 1)); + ug.apply(HColorSet.instance().getColorIfValid("#EEEEEE").bg()) .draw(new URectangle(dimOpen.getWidth() - 1, dimOpen.getHeight() - 1)); - openDrop.drawU(ug.apply(new UTranslate(0, dim.getHeight() - 1))); + openDrop.drawU(ug); } } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementEmpty.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementEmpty.java index 5d98f8b7b..e664df2d4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementEmpty.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementEmpty.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementImage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementImage.java index 6b8e7b9a0..4c9d77660 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementImage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementImage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementLine.java index 20982bc46..b8e51e7fd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,13 +33,12 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.UChangeColor; 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 { @@ -57,7 +56,7 @@ public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { if (zIndex != 0) { return; } - ug = ug.apply(new UChangeColor(HtmlColorSet.getInstance().getColorIfValid("#AAAAAA"))); + ug = ug.apply(HColorSet.instance().getColorIfValid("#AAAAAA")); double y2 = dimToUse.getHeight() / 2; if (separator == '=') { y2 = y2 - 1; @@ -67,14 +66,14 @@ public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { private static void drawLine(UGraphic ug, double x, double y, double widthToUse, char separator) { if (separator == '=') { - ug.apply(new UStroke()).apply(new UTranslate(x, y)).draw(new ULine(widthToUse, 0)); - ug.apply(new UStroke()).apply(new UTranslate(x, y + 2)).draw(new ULine(widthToUse, 0)); + ug.apply(new UStroke()).apply(new UTranslate(x, y)).draw(ULine.hline(widthToUse)); + ug.apply(new UStroke()).apply(new UTranslate(x, y + 2)).draw(ULine.hline(widthToUse)); } else if (separator == '.') { - ug.apply(new UStroke(1, 2, 1)).apply(new UTranslate(x, y)).draw(new ULine(widthToUse, 0)); + ug.apply(new UStroke(1, 2, 1)).apply(new UTranslate(x, y)).draw(ULine.hline(widthToUse)); } else if (separator == '-') { - ug.apply(new UStroke()).apply(new UTranslate(x, y)).draw(new ULine(widthToUse, 0)); + ug.apply(new UStroke()).apply(new UTranslate(x, y)).draw(ULine.hline(widthToUse)); } else { - ug.apply(new UStroke(1.5)).apply(new UTranslate(x, y)).draw(new ULine(widthToUse, 0)); + ug.apply(new UStroke(1.5)).apply(new UTranslate(x, y)).draw(ULine.hline(widthToUse)); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementMenuBar.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementMenuBar.java index 6999120a6..6f70ce9b9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementMenuBar.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementMenuBar.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,13 +38,12 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinSimple; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; 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 { @@ -101,10 +100,10 @@ public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { double x1 = 0; if (zIndex == 0) { - ug.apply(new UChangeBackColor(HtmlColorSet.getInstance().getColorIfValid("#DDDDDD"))).draw( + ug.apply(HColorSet.instance().getColorIfValid("#DDDDDD").bg()).draw( new URectangle(dimToUse.getWidth(), dimToUse.getHeight())); for (ElementMenuEntry entry : entries) { - entry.drawU(ug.apply(new UTranslate(x1, 0)), zIndex, dimToUse); + entry.drawU(ug.apply(UTranslate.dx(x1)), zIndex, dimToUse); final double w = entry.getPreferredDimension(ug.getStringBounder(), x1, 0).getWidth(); entry.setX(x1); x1 += w + 10; @@ -114,7 +113,7 @@ public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { if (zIndex == 1) { for (ElementMenuEntry entry : popups.keySet()) { - entry.setBackground(HtmlColorSet.getInstance().getColorIfValid("#BBBBBB")); + entry.setBackground(HColorSet.instance().getColorIfValid("#BBBBBB")); } final double y1 = preferred.getHeight(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementMenuEntry.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementMenuEntry.java index 65b592f3f..82a47359f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementMenuEntry.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementMenuEntry.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,19 +37,18 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ElementMenuEntry extends AbstractElement { private final TextBlock block; private final String text; - private HtmlColor background; + private HColor background; private double xxx; public ElementMenuEntry(String text, UFont font, ISkinSimple spriteContainer) { @@ -68,7 +67,7 @@ public Dimension2D getPreferredDimension(StringBounder stringBounder, double x, public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { if (background != null) { final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0); - ug.apply(new UChangeBackColor(background)).draw(new URectangle(dim.getWidth(), dim.getHeight())); + ug.apply(background.bg()).draw(new URectangle(dim.getWidth(), dim.getHeight())); } block.drawU(ug); } @@ -85,11 +84,11 @@ public String getText() { return text; } - public HtmlColor getBackground() { + public HColor getBackground() { return background; } - public void setBackground(HtmlColor background) { + public void setBackground(HColor background) { this.background = background; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementMenuPopup.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementMenuPopup.java index 18905753d..e12cbe642 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementMenuPopup.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementMenuPopup.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,14 +36,13 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinSimple; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UFont; 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 { @@ -75,16 +74,16 @@ public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { if (zIndex != 1) { return; } - ug.apply(new UChangeBackColor(HtmlColorSet.getInstance().getColorIfValid("#DDDDDD"))).draw( + ug.apply(HColorSet.instance().getColorIfValid("#DDDDDD").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("-")) { - ug.apply(new UTranslate(0, y1 + h / 2)).draw(new ULine(dimToUse.getWidth(), 0)); + ug.apply(UTranslate.dy(y1 + h / 2)).draw(ULine.hline(dimToUse.getWidth())); } else { - entry.drawU(ug.apply(new UTranslate(0, y1)), zIndex, dimToUse); + entry.drawU(ug.apply(UTranslate.dy(y1)), zIndex, dimToUse); } y1 += h; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementPyramid.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementPyramid.java index 09fc1d1f9..57ee47bc9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementPyramid.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementPyramid.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementPyramidScrolled.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementPyramidScrolled.java index a529417a4..ad5d8aa07 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementPyramidScrolled.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementPyramidScrolled.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,16 +34,15 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.salt.Positionner2; import net.sourceforge.plantuml.salt.factory.ScrollStrategy; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UGraphic; 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 { @@ -73,10 +72,10 @@ public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { super.drawU(ug, zIndex, dimToUse); final Dimension2D dim = super.getPreferredDimension(ug.getStringBounder(), 0, 0); if (scrollStrategy == ScrollStrategy.BOTH || scrollStrategy == ScrollStrategy.VERTICAL_ONLY) { - drawV(ug.apply(new UTranslate(dim.getWidth() + 4, 0)), v1, dim.getHeight()); + drawV(ug.apply(UTranslate.dx(dim.getWidth() + 4)), v1, dim.getHeight()); } if (scrollStrategy == ScrollStrategy.BOTH || scrollStrategy == ScrollStrategy.HORIZONTAL_ONLY) { - drawH(ug.apply(new UTranslate(0, dim.getHeight() + 4)), dim.getWidth(), v1); + drawH(ug.apply(UTranslate.dy(dim.getHeight() + 4)), dim.getWidth(), v1); } } @@ -122,18 +121,18 @@ private UPath getTr270() { private void drawV(UGraphic ug, double width, double height) { ug.draw(new URectangle(width, height)); - ug.apply(new UTranslate(0, v2)).draw(new ULine(width, 0)); - ug.apply(new UTranslate(0, height - v2)).draw(new ULine(width, 0)); - ug.apply(new UTranslate(4, 4)).apply(new UChangeBackColor(HtmlColorUtils.BLACK)).draw(getTr0()); - ug.apply(new UTranslate(4, height - v2 + 4)).apply(new UChangeBackColor(HtmlColorUtils.BLACK)).draw(getTr180()); + 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()); } private void drawH(UGraphic ug, double width, double height) { ug.draw(new URectangle(width, height)); - ug.apply(new UTranslate(v2, 0)).draw(new ULine(0, height)); - ug.apply(new UTranslate(width - v2, 0)).draw(new ULine(0, height)); - ug.apply(new UTranslate(4, 4)).apply(new UChangeBackColor(HtmlColorUtils.BLACK)).draw(getTr90()); - ug.apply(new UTranslate(width - v2 + 4, 4)).apply(new UChangeBackColor(HtmlColorUtils.BLACK)).draw(getTr270()); + 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()); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementRadioCheckbox.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementRadioCheckbox.java index 76cb03360..768e84dad 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementRadioCheckbox.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementRadioCheckbox.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,7 +40,6 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -48,6 +47,7 @@ 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; public class ElementRadioCheckbox extends AbstractElement { @@ -77,29 +77,39 @@ public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { if (zIndex != 0) { return; } - block.drawU(ug.apply(new UTranslate(margin, 0))); + block.drawU(ug.apply(UTranslate.dx(margin))); final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0); final double height = dim.getHeight(); ug = ug.apply(new UStroke(stroke)); if (radio) { - ug.apply(new UTranslate(2, (height - ELLIPSE) / 2)).draw(new UEllipse(ELLIPSE, ELLIPSE)); - if (checked) { - ug.apply(new UChangeBackColor(ug.getParam().getColor())) - .apply(new UTranslate(2 + (ELLIPSE - ELLIPSE2) / 2, (height - ELLIPSE2) / 2)) - .draw(new UEllipse(ELLIPSE2, ELLIPSE2)); - } + drawRadio(ug, height); } else { - ug.apply(new UTranslate(2, (height - RECTANGLE) / 2)).draw(new URectangle(RECTANGLE, RECTANGLE)); - if (checked) { - final UPolygon poly = new UPolygon(); - poly.addPoint(0, 0); - poly.addPoint(3, 3); - poly.addPoint(10, -6); - poly.addPoint(3, 1); - ug.apply(new UChangeBackColor(ug.getParam().getColor())).apply(new UTranslate(3, 6)).draw(poly); - } + drawOther(ug, height); + } + } + + private void drawOther(UGraphic ug, final double height) { + ug.apply(new UTranslate(2, (height - RECTANGLE) / 2)).draw(new URectangle(RECTANGLE, RECTANGLE)); + if (checked) { + final UPolygon poly = new UPolygon(); + poly.addPoint(0, 0); + poly.addPoint(3, 3); + poly.addPoint(10, -6); + poly.addPoint(3, 1); + ug = ug.apply(HColorUtils.changeBack(ug)); + ug = ug.apply(new UTranslate(3, 6)); + ug.draw(poly); + } + } + + private void drawRadio(UGraphic ug, final double height) { + ug.apply(new UTranslate(2, (height - ELLIPSE) / 2)).draw(new UEllipse(ELLIPSE, ELLIPSE)); + if (checked) { + ug = ug.apply(HColorUtils.changeBack(ug)); + ug = ug.apply(new UTranslate(2 + (ELLIPSE - ELLIPSE2) / 2, (height - ELLIPSE2) / 2)); + ug.draw(new UEllipse(ELLIPSE2, ELLIPSE2)); } } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementTabBar.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementTabBar.java index dddaeb1eb..a0a854950 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementTabBar.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementTabBar.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -101,10 +101,10 @@ private void drawUHorizontal(UGraphic ug, final double x, final double y, int zI elt.drawU(ug.apply(new UTranslate(x1 + margin1, y)), zIndex, dimToUse); final Dimension2D dimText = elt.getPreferredDimension(ug.getStringBounder(), x1, y); final double w = dimText.getWidth(); - ug.apply(new UTranslate(x1, y)).draw(new ULine(0, dimText.getHeight())); - ug.apply(new UTranslate(x1, y)).draw(new ULine(w + margin1 + margin2, 0)); - ug.apply(new UTranslate(x1 + w + margin1 + margin2, y)).draw(new ULine(0, dimText.getHeight())); - ug.apply(new UTranslate(x1 + w + margin1 + margin2, y + dimText.getHeight())).draw(new ULine(margin3, 0)); + ug.apply(new UTranslate(x1, y)).draw(ULine.vline(dimText.getHeight())); + ug.apply(new UTranslate(x1, y)).draw(ULine.hline(w + margin1 + margin2)); + ug.apply(new UTranslate(x1 + w + margin1 + margin2, y)).draw(ULine.vline(dimText.getHeight())); + ug.apply(new UTranslate(x1 + w + margin1 + margin2, y + dimText.getHeight())).draw(ULine.hline(margin3)); x1 += w + margin1 + margin2 + margin3; } } @@ -125,13 +125,13 @@ private void drawUVertical(UGraphic ug, final double x, final double y, int zInd ug = ug.apply(new UTranslate(x, y)); double y1 = x; for (Element elt : tabs) { - elt.drawU(ug.apply(new UTranslate(0, y1 + margin1)), zIndex, dimToUse); + elt.drawU(ug.apply(UTranslate.dy(y1 + margin1)), zIndex, dimToUse); final Dimension2D dimText = elt.getPreferredDimension(ug.getStringBounder(), x, y1); final double h = dimText.getHeight(); - ug.apply(new UTranslate(0, y1)).draw(new ULine(preferred.getWidth(), 0)); - ug.apply(new UTranslate(0, y1)).draw(new ULine(0, h + margin1 + margin2)); - ug.apply(new UTranslate(0, y1 + h + margin1 + margin2)).draw(new ULine(preferred.getWidth(), 0)); - ug.apply(new UTranslate(preferred.getWidth(), y1 + h + margin1 + margin2)).draw(new ULine(0, margin3)); + ug.apply(UTranslate.dy(y1)).draw(ULine.hline(preferred.getWidth())); + ug.apply(UTranslate.dy(y1)).draw(ULine.vline(h + margin1 + margin2)); + ug.apply(UTranslate.dy(y1 + h + margin1 + margin2)).draw(ULine.hline(preferred.getWidth())); + ug.apply(new UTranslate(preferred.getWidth(), y1 + h + margin1 + margin2)).draw(ULine.vline(margin3)); y1 += h + margin1 + margin2 + margin3; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementText.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementText.java index e1868824b..38a2f150c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementText.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementText.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementTextField.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementTextField.java index 16a00566e..a43202e76 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementTextField.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementTextField.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -58,10 +58,10 @@ public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { drawText(ug, 3, 0); final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0); final Dimension2D textDim = getTextDimensionAt(ug.getStringBounder(), 0); - ug.apply(new UTranslate(1, textDim.getHeight())).draw(new ULine(dim.getWidth() - 3, 0)); + ug.apply(new UTranslate(1, textDim.getHeight())).draw(ULine.hline(dim.getWidth() - 3)); final double y3 = textDim.getHeight() - 3; - ug.apply(new UTranslate(1, y3)).draw(new ULine(0, 2)); - ug.apply(new UTranslate(3 + textDim.getWidth() + 1, y3)).draw(new ULine(0, 2)); + ug.apply(new UTranslate(1, y3)).draw(ULine.vline(2)); + ug.apply(new UTranslate(3 + textDim.getWidth() + 1, y3)).draw(ULine.vline(2)); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementTree.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementTree.java index 568b64e0f..6ccfd1c36 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementTree.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementTree.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,11 +39,10 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ElementTree extends AbstractElement { @@ -140,7 +139,7 @@ public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { yvar += h; rows.add(yvar); } - ug = ug.apply(new UChangeColor(HtmlColorSet.getInstance().getColorIfValid("#888888"))); + ug = ug.apply(HColorSet.instance().getColorIfValid("#888888")); skeleton.draw(ug, 0, 0); if (strategy != TableStrategy.DRAW_NONE) { final Grid2 grid = new Grid2(rows, cols, strategy); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementTreeEntry.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementTreeEntry.java index ea2be219d..a260eec83 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementTreeEntry.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ElementTreeEntry.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Grid.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Grid.java index c3dd0f86c..35079baac 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Grid.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Grid.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,15 +34,13 @@ import java.util.HashSet; import java.util.Set; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.salt.Cell; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; 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; public class Grid { @@ -85,21 +83,21 @@ public void drawU(UGraphic ug, double x, double y) { final int row1 = seg.getRow(); final int col1 = seg.getCol(); final double width = colsStart[col1 + 1] - colsStart[col1]; - ug.apply(new UTranslate(x + colsStart[col1], y + rowsStart[row1])).draw(new ULine(width, 0)); + ug.apply(new UTranslate(x + colsStart[col1], y + rowsStart[row1])).draw(ULine.hline(width)); } // Vlines for (Segment seg : verticals) { final int row1 = seg.getRow(); final int col1 = seg.getCol(); final double height = rowsStart[row1 + 1] - rowsStart[row1]; - ug.apply(new UTranslate(x + colsStart[col1], y + rowsStart[row1])).draw(new ULine(0, height)); + ug.apply(new UTranslate(x + colsStart[col1], y + rowsStart[row1])).draw(ULine.vline(height)); } final Dimension2D dim = title.calculateDimension(ug.getStringBounder()); if (dim.getWidth() > 0 && dim.getHeight() > 0) { final UGraphic ug2 = ug.apply(new UTranslate(x + 6, y - dim.getHeight() * 0)); - ug2.apply(new UChangeBackColor(HtmlColorUtils.WHITE)).apply(new UChangeColor(HtmlColorUtils.WHITE)) + ug2.apply(HColorUtils.WHITE.bg()).apply(HColorUtils.WHITE) .draw(new URectangle(dim)); title.drawU(ug2); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Grid2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Grid2.java index 85d835142..659337d9e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Grid2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Grid2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -54,19 +54,19 @@ public void drawU(UGraphic ug) { final double ymin = rowsStart.get(0); final double ymax = rowsStart.get(rowsStart.size() - 1); if (strategy == TableStrategy.DRAW_OUTSIDE || strategy == TableStrategy.DRAW_OUTSIDE_WITH_TITLE) { - ug.apply(new UTranslate(xmin, ymin)).draw(new ULine(xmax - xmin, 0)); - ug.apply(new UTranslate(xmin, ymax)).draw(new ULine(xmax - xmin, 0)); - ug.apply(new UTranslate(xmin, ymin)).draw(new ULine(0, ymax - ymin)); - ug.apply(new UTranslate(xmax, ymin)).draw(new ULine(0, ymax - ymin)); + ug.apply(new UTranslate(xmin, ymin)).draw(ULine.hline(xmax - xmin)); + ug.apply(new UTranslate(xmin, ymax)).draw(ULine.hline(xmax - xmin)); + ug.apply(new UTranslate(xmin, ymin)).draw(ULine.vline(ymax - ymin)); + ug.apply(new UTranslate(xmax, ymin)).draw(ULine.vline(ymax - ymin)); } if (drawHorizontal()) { for (Double y : rowsStart) { - ug.apply(new UTranslate(xmin, y)).draw(new ULine(xmax - xmin, 0)); + ug.apply(new UTranslate(xmin, y)).draw(ULine.hline(xmax - xmin)); } } if (drawVertical()) { for (Double x : colsStart) { - ug.apply(new UTranslate(x, ymin)).draw(new ULine(0, ymax - ymin)); + ug.apply(new UTranslate(x, ymin)).draw(ULine.vline(ymax - ymin)); } } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/LeftFirst.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/LeftFirst.java index 46455987f..ae33ff187 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/LeftFirst.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/LeftFirst.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ListWidth.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ListWidth.java index c2eac31cb..21f6e08a7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ListWidth.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/ListWidth.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Segment.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Segment.java index e540be8f8..c88245e09 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Segment.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Segment.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Skeleton.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Skeleton.java index d58022961..3d1c2d15c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Skeleton.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Skeleton.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -81,10 +81,10 @@ public void draw(UGraphic ug, double x, double y) { private void drawChild(UGraphic ug, Entry parent, Entry child) { final double dy = child.ypos - parent.ypos - 2; - ug.apply(new UTranslate(parent.xpos + 1, parent.ypos + 3)).draw(new ULine(0, dy)); + ug.apply(new UTranslate(parent.xpos + 1, parent.ypos + 3)).draw(ULine.vline(dy)); final double dx = child.xpos - parent.xpos - 2; - ug.apply(new UTranslate(parent.xpos + 1, child.ypos + 1)).draw(new ULine(dx, 0)); + ug.apply(new UTranslate(parent.xpos + 1, child.ypos + 1)).draw(ULine.hline(dx)); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Skeleton2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Skeleton2.java index a91e82c86..9e86c0280 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Skeleton2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/Skeleton2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -56,13 +56,13 @@ static class Entry { void drawHline(UGraphic ug) { final double xpos = getXStartForLevel(level); ug.apply(new UTranslate(xpos + sizeX - 1, ypos - 1)).draw(new URectangle(2, 2)); - ug.apply(new UTranslate(xpos, ypos)).draw(new ULine(sizeX, 0)); + ug.apply(new UTranslate(xpos, ypos)).draw(ULine.hline(sizeX)); } public void drawVline(UGraphic ug, double lastY) { // System.err.println("ypos=" + ypos); final double xpos = getXStartForLevel(level); - ug.apply(new UTranslate(xpos, lastY)).draw(new ULine(0, ypos - lastY)); + ug.apply(new UTranslate(xpos, lastY)).draw(ULine.vline(ypos - lastY)); } } @@ -119,7 +119,7 @@ public double getXEndForLevel(int level) { // // private void drawChild(UGraphic ug, Entry parent, Entry child) { // final double dy = child.ypos - parent.ypos - 2; - // ug.apply(new UTranslate(parent.xpos + 1, parent.ypos + 3)).draw(new ULine(0, dy)); + // ug.apply(new UTranslate(parent.xpos + 1, parent.ypos + 3)).draw(ULine.dy(dy)); // // final double dx = child.xpos - parent.xpos - 2; // ug.apply(new UTranslate(parent.xpos + 1, child.ypos + 1)).draw(new ULine(dx, 0)); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/TableStrategy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/TableStrategy.java index 50784ea25..8967f0078 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/TableStrategy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/TableStrategy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/TopFirst.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/TopFirst.java index d9d49a2f8..e1e76c496 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/TopFirst.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/TopFirst.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/WrappedElement.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/WrappedElement.java index bdf9dc1fa..fd1816483 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/WrappedElement.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/element/WrappedElement.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/AbstractElementFactoryComplex.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/AbstractElementFactoryComplex.java index 720875482..d377e748c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/AbstractElementFactoryComplex.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/AbstractElementFactoryComplex.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactory.java index d55043479..aa9fd4bc1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryBorder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryBorder.java index e07e1dc7b..390b8de35 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryBorder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryBorder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryButton.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryButton.java index b806e9c3d..98fb0071a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryButton.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryButton.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryCheckboxOff.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryCheckboxOff.java index da99b538b..2dca271e9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryCheckboxOff.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryCheckboxOff.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryCheckboxOn.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryCheckboxOn.java index 1bde3fc30..e5ed3d252 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryCheckboxOn.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryCheckboxOn.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryDroplist.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryDroplist.java index 8d1b688de..0b93f2a72 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryDroplist.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryDroplist.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryImage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryImage.java index 7df281cba..ce9601bf3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryImage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryImage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryLine.java index 5c1f0ae46..2ac943cbd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryMenu.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryMenu.java index 61ea2f785..ab5e2dca1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryMenu.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryMenu.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryPyramid.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryPyramid.java index bef0663fd..3afbf51af 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryPyramid.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryPyramid.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryRadioOff.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryRadioOff.java index a07299eeb..d50edabb3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryRadioOff.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryRadioOff.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryRadioOn.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryRadioOn.java index e484c44c8..d1b14d02b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryRadioOn.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryRadioOn.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryRetrieveFromDictonnary.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryRetrieveFromDictonnary.java index 51d8d2434..ec30f8cf9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryRetrieveFromDictonnary.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryRetrieveFromDictonnary.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryScroll.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryScroll.java index 7ec8e5936..3187ce90d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryScroll.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryScroll.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryTab.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryTab.java index 536134e36..0d221a4f7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryTab.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryTab.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryText.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryText.java index e5698b856..2fca1deed 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryText.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryText.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryTextField.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryTextField.java index 24dcd02c6..054028adf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryTextField.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryTextField.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryTree.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryTree.java index b20c8efaa..5160001e8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryTree.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ElementFactoryTree.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ScrollStrategy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ScrollStrategy.java index 8efeb13a7..64ac7351d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ScrollStrategy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/salt/factory/ScrollStrategy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/security/ImageIO.java b/src/plantuml-asl/src/net/sourceforge/plantuml/security/ImageIO.java new file mode 100644 index 000000000..2ea20c544 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/security/ImageIO.java @@ -0,0 +1,102 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.security; + +import java.awt.image.BufferedImage; +import java.awt.image.RenderedImage; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Iterator; + +import javax.imageio.ImageReader; +import javax.imageio.ImageWriter; +import javax.imageio.stream.ImageInputStream; +import javax.imageio.stream.ImageOutputStream; + +public class ImageIO { + + public static ImageOutputStream createImageOutputStream(OutputStream os) throws IOException { + return javax.imageio.ImageIO.createImageOutputStream(os); + } + + public static void write(RenderedImage image, String format, OutputStream os) throws IOException { + javax.imageio.ImageIO.write(image, format, os); + } + + public static void write(RenderedImage image, String format, java.io.File file) throws IOException { + javax.imageio.ImageIO.write(image, format, file); + } + + public static void write(RenderedImage image, String format, SFile file) throws IOException { + javax.imageio.ImageIO.write(image, format, file.conv()); + } + + public static BufferedImage read(java.io.File file) throws IOException { + return javax.imageio.ImageIO.read(file); + } + + public static BufferedImage read(SFile file) throws IOException { + return javax.imageio.ImageIO.read(file.conv()); + } + + public static BufferedImage read(InputStream is) throws IOException { + return javax.imageio.ImageIO.read(is); + } + + public static ImageInputStream createImageInputStream(java.io.File file) throws IOException { + return javax.imageio.ImageIO.createImageInputStream(file); + } + + public static ImageInputStream createImageInputStream(SFile file) throws IOException { + return javax.imageio.ImageIO.createImageInputStream(file.conv()); + } + + public static ImageInputStream createImageInputStream(Object obj) throws IOException { + if (obj instanceof SFile) { + obj = ((SFile) obj).conv(); + } + return javax.imageio.ImageIO.createImageInputStream(obj); + } + + public static ImageInputStream createImageInputStream(InputStream is) throws IOException { + return javax.imageio.ImageIO.createImageInputStream(is); + } + + public static Iterator getImageReaders(ImageInputStream iis) { + return javax.imageio.ImageIO.getImageReaders(iis); + } + + public static Iterator getImageWritersBySuffix(String string) { + return javax.imageio.ImageIO.getImageWritersBySuffix(string); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/security/SFile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/security/SFile.java new file mode 100644 index 000000000..64d465322 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/security/SFile.java @@ -0,0 +1,356 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.security; + +import java.awt.image.BufferedImage; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import javax.swing.ImageIcon; + +/** + * Secure replacement for java.io.File. + *

    + * This class should be used instead of java.io.File. There are few exceptions + * (mainly in the Swing part and in the ANT task) + *

    + * This class does some control access and in secure mode hide the real path of + * file, so that it cannot be printed to end users. + * + */ +public class SFile implements Comparable { + + public static String separator = File.separator; + + public static String pathSeparator = File.pathSeparator; + + public static char separatorChar = File.separatorChar; + + public final File internal; + + @Override + public String toString() { + return "Image42"; + } + + public SFile(String nameOrPath) { + this(new File(nameOrPath)); + } + + public SFile(String dirname, String name) { + this(new File(dirname, name)); + } + + public SFile(SFile basedir, String name) { + this(new File(basedir.internal, name)); + } + + public SFile(URI uri) { + this(new File(uri)); + } + + private SFile(File internal) { + this.internal = internal; + } + + public static SFile fromFile(File internal) { + if (internal == null) { + return null; + } + return new SFile(internal); + } + + public SFile file(String name) { + return new SFile(this, name); + } + + public boolean exists() { + if (isFileOk()) + return internal.exists(); + return false; + } + + public SFile getCanonicalFile() throws IOException { + return new SFile(internal.getCanonicalFile()); + } + + public boolean isAbsolute() { + return internal.isAbsolute(); + } + + public boolean isDirectory() { + return internal.exists() && internal.isDirectory(); + } + + public String getName() { + return internal.getName(); + } + + public boolean isFile() { + return internal.isFile(); + } + + public long lastModified() { + return internal.lastModified(); + } + + public int compareTo(SFile other) { + return this.internal.compareTo(other.internal); + } + + public String getPath() { + return internal.getPath(); + } + + public long length() { + return internal.length(); + } + + public boolean canWrite() { + return internal.canWrite(); + } + + public void setWritable(boolean b) { + internal.setWritable(b); + } + + public void delete() { + internal.delete(); + } + + public Collection listFiles() { + final File[] tmp = internal.listFiles(); + final List result = new ArrayList(tmp.length); + for (File f : tmp) { + result.add(new SFile(f)); + } + return Collections.unmodifiableCollection(result); + } + + public String[] list() { + return internal.list(); + } + + public SFile getAbsoluteFile() { + return new SFile(internal.getAbsoluteFile()); + } + + public SFile getParentFile() { + return new SFile(internal.getParentFile()); + } + + @Override + public int hashCode() { + return internal.hashCode(); + } + + @Override + public boolean equals(Object obj) { + return internal.equals(((SFile) obj).internal); + } + + public String getAbsolutePath() { + return internal.getAbsolutePath(); + } + + public String getPrintablePath() { + if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) { + try { + return internal.getCanonicalPath(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return ""; + } + + public boolean canRead() { + return internal.canRead(); + } + + public void deleteOnExit() { + internal.deleteOnExit(); + } + + public void mkdirs() { + internal.mkdirs(); + } + + public static SFile createTempFile(String prefix, String suffix) throws IOException { + return new SFile(File.createTempFile(prefix, suffix)); + } + + public URI toURI() { + return internal.toURI(); + } + + public boolean renameTo(SFile dest) { + return internal.renameTo(dest.internal); + } + + /** + * Check SecurityProfile to see if this file can be open. + */ + private boolean isFileOk() { + if (SecurityUtils.getSecurityProfile() == SecurityProfile.SANDBOX) { + // In SANDBOX, we cannot read any files + return false; + } + // Files in "plantuml.include.path" and "plantuml.allowlist.path" are ok. + if (isInAllowList(SecurityUtils.getPath("plantuml.include.path"))) { + return true; + } + if (isInAllowList(SecurityUtils.getPath("plantuml.allowlist.path"))) { + return true; + } + if (SecurityUtils.getSecurityProfile() == SecurityProfile.INTERNET) { + return false; + } + if (SecurityUtils.getSecurityProfile() == SecurityProfile.ALLOWLIST) { + return false; + } + if (SecurityUtils.getSecurityProfile() != SecurityProfile.UNSECURE) { + // For UNSECURE, we did not do those checks + final String path = getCleanPathSecure(); + if (path.startsWith("/etc/") || path.startsWith("/dev/") || path.startsWith("/boot/") + || path.startsWith("/proc/") || path.startsWith("/sys/")) { + return false; + } + if (path.startsWith("//")) { + return false; + } + } + return true; + } + + private boolean isInAllowList(List allowlist) { + final String path = getCleanPathSecure(); + for (SFile allow : allowlist) { + if (path.startsWith(allow.getCleanPathSecure())) { + // File directory is in the allowlist + return true; + } + } + return false; + } + + private String getCleanPathSecure() { + String result = internal.getAbsolutePath(); + result = result.replace("\0", ""); + result = result.replace("\\\\", "/"); + return result; + } + + // Reading + // http://forum.plantuml.net/9048/img-tag-for-sequence-diagram-participants-does-always-render + public BufferedImage readRasterImageFromFile() { + // https://www.experts-exchange.com/questions/26171948/Why-are-ImageIO-read-images-losing-their-transparency.html + // https://stackoverflow.com/questions/18743790/can-java-load-images-with-transparency + if (isFileOk()) + try { + return SecurityUtils.readRasterImage(new ImageIcon(this.getAbsolutePath())); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public BufferedReader openBufferedReader() { + if (isFileOk()) { + try { + return new BufferedReader(new FileReader(internal)); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + return null; + } + + public File conv() throws FileNotFoundException { + return internal; + } + + public InputStream openFile() { + if (isFileOk()) + try { + return new BufferedInputStream(new FileInputStream(internal)); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + return null; + } + + // Writing + public BufferedOutputStream createBufferedOutputStream() throws FileNotFoundException { + return new BufferedOutputStream(new FileOutputStream(internal)); + } + + public PrintWriter createPrintWriter() throws FileNotFoundException { + return new PrintWriter(internal); + } + + public PrintWriter createPrintWriter(String charset) throws FileNotFoundException, UnsupportedEncodingException { + return new PrintWriter(internal, charset); + } + + public FileOutputStream createFileOutputStream() throws FileNotFoundException { + return new FileOutputStream(internal); + } + + public FileOutputStream createFileOutputStream(boolean append) throws FileNotFoundException { + return new FileOutputStream(internal, append); + } + + public PrintStream createPrintStream() throws FileNotFoundException { + return new PrintStream(internal); + } + + public PrintStream createPrintStream(String charset) throws FileNotFoundException, UnsupportedEncodingException { + return new PrintStream(internal, charset); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/security/SURL.java b/src/plantuml-asl/src/net/sourceforge/plantuml/security/SURL.java new file mode 100644 index 000000000..bbdd0ad28 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/security/SURL.java @@ -0,0 +1,243 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.security; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.concurrent.Callable; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; + +import javax.swing.ImageIcon; + +import net.sourceforge.plantuml.StringUtils; + +/** + * Secure replacement for java.net.URL. + *

    + * This class should be used instead of java.net.URL. + *

    + * This class does some control access. + * + */ +public class SURL { + + private final URL internal; + + private SURL(String src) throws MalformedURLException { + this(new URL(src)); + } + + private SURL(URL url) { + this.internal = url; + } + + public static SURL create(String url) { + if (url == null) { + return null; + } + if (url.startsWith("http://") || url.startsWith("https://")) + try { + return new SURL(url); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + return null; + } + + public static SURL create(URL url) { + if (url == null) { + return null; + } + return new SURL(url); + } + + @Override + public String toString() { + return internal.toString(); + } + + /** + * Check SecurityProfile to see if this URL can be open. + */ + private boolean isUrlOk() { + if (SecurityUtils.getSecurityProfile() == SecurityProfile.SANDBOX) { + // In SANDBOX, we cannot read any URL + return false; + } + if (SecurityUtils.getSecurityProfile() == SecurityProfile.LEGACY) { + return true; + } + if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) { + // We are UNSECURE anyway + return true; + } + if (isInAllowList()) { + return true; + } + if (SecurityUtils.getSecurityProfile() == SecurityProfile.INTERNET) { + if (pureIP(cleanPath(internal.toString()))) { + return false; + } + final int port = internal.getPort(); + // Using INTERNET profile, port 80 and 443 are ok + if (port == 80 || port == 443 || port == -1) { + return true; + } + } + return false; + } + + private boolean pureIP(String full) { + if (full.matches("^https?://\\d+\\.\\d+\\.\\d+\\.\\d+.*")) { + return true; + } + return false; + } + + private boolean isInAllowList() { + final String full = cleanPath(internal.toString()); + for (String allow : getAllowList()) { + if (full.startsWith(cleanPath(allow))) { + return true; + } + } + return false; + } + + private String cleanPath(String path) { + path = path.trim().toLowerCase(Locale.US); + // We simplify/normalize the url, removing default ports + path = path.replace(":80/", ""); + path = path.replace(":443/", ""); + return path; + } + + private List getAllowList() { + final String env = SecurityUtils.getenv("plantuml.allowlist.url"); + if (env == null) { + return Collections.emptyList(); + } + return Arrays.asList(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(env).split(";")); + } + + private final static ExecutorService exe = Executors.newCachedThreadPool(); + private final static Map badHosts = new ConcurrentHashMap(); + + // Added by Alain Corbiere + public byte[] getBytes() { + if (isUrlOk() == false) { + return null; + } + final String host = internal.getHost(); + final Long bad = badHosts.get(host); + if (bad != null) { + final long duration = System.currentTimeMillis() - bad; + if (duration < 1000L * 60) { + // System.err.println("BAD HOST!" + host); + return null; + } + // System.err.println("cleaning " + host); + badHosts.remove(host); + } + final Future result = exe.submit(new Callable() { + public byte[] call() throws IOException { + InputStream input = null; + try { + final URLConnection connection = internal.openConnection(); + if (connection == null) { + return null; + } + input = connection.getInputStream(); + final ByteArrayOutputStream image = new ByteArrayOutputStream(); + final byte[] buffer = new byte[1024]; + int read; + while ((read = input.read(buffer)) > 0) { + image.write(buffer, 0, read); + } + image.close(); + return image.toByteArray(); + } finally { + if (input != null) { + input.close(); + } + } + } + }); + + try { + byte data[] = result.get(SecurityUtils.getSecurityProfile().getTimeout(), TimeUnit.MILLISECONDS); + if (data != null) { + return data; + } + } catch (Exception e) { + System.err.println("issue " + host + " " + e); + } + badHosts.put(host, System.currentTimeMillis()); + return null; + } + + public InputStream openStream() { + if (isUrlOk()) { + final byte data[] = getBytes(); + if (data != null) { + return new ByteArrayInputStream(data); + } + } + return null; + } + + public BufferedImage readRasterImageFromURL() { + if (isUrlOk()) + try { + final ImageIcon tmp = new ImageIcon(internal); + return SecurityUtils.readRasterImage(tmp); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/security/SecurityProfile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/security/SecurityProfile.java new file mode 100644 index 000000000..b1c6cb88e --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/security/SecurityProfile.java @@ -0,0 +1,154 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.security; + +/** + * There are 4 different security profile defined. + *

    + * The security profile to be used is set at the launch of PlantUML and cannot + * be changed by users. The security profile defines what an instance of + * PlantUML is allowed to do:
    + * - access some local file
    + * - connection to some remote URL
    + * - print some technical information to the users. + *

    + *

    + * The security profile is defined:
    + * - either by an environment variable
    + * - or an option at command line + *

    + * There is also a default value, which is LEGACY in this current + * implementation. + * + */ +public enum SecurityProfile { + + /** + * Running in SANDBOX mode is completely secure. No local file can be read + * (except dot executable) No remote URL access can be used No technical + * information are print to users. + *

    + * This mode is defined for test and debug, since it's not very useful for + * users. However, you can use it if you need to. + */ + SANDBOX, + + /** + * + */ + ALLOWLIST, + + /** + * This mode is designed for PlantUML running in a web server. + * + */ + INTERNET, + + /** + * This mode reproduce old PlantUML version behaviour. + *

    + * Right now, this is the default Security Profile but this will be removed from + * future version because it is now full secure, especially on Internet server. + */ + LEGACY, + + /** + * Running in UNSECURE mode means that PlantUML can access to any local file and + * can connect to any URL. + *

    + * Some technical information (file path, Java version) are also printed in some + * error messages. This is not an issue if you are running PlantUML locally. But + * you should not use this mode if PlantUML is running on some server, + * especially if the server is accessible from Internet. + */ + UNSECURE; + + /** + * Initialize the default value. + *

    + * It search in some config variable if the user has defined a some default + * value. + * + * @return the value + */ + static SecurityProfile init() { + final String env = SecurityUtils.getenv("PLANTUML_SECURITY_PROFILE"); + if ("SANDBOX".equalsIgnoreCase(env)) { + return SANDBOX; + } else if ("ALLOWLIST".equalsIgnoreCase(env)) { + return ALLOWLIST; + } else if ("INTERNET".equalsIgnoreCase(env)) { + return INTERNET; + } else if ("UNSECURE".equalsIgnoreCase(env)) { + return UNSECURE; + } + return LEGACY; + } + + /** + * A Human understandable description. + */ + public String longDescription() { + switch (this) { + case SANDBOX: + return "This is completely safe: no access to local files or to distant URL."; + case ALLOWLIST: + return "Some local ressource may be accessible."; + case INTERNET: + return "Mode designed for server connected to Internet."; + case LEGACY: + return "Warning: this mode will be removed in future version"; + case UNSECURE: + return "Make sure that this server is not accessible from Internet"; + } + return "This is completely safe: no access on local files or on distant URL."; + } + + /** + * Retrieve the timeout for URL. + */ + public long getTimeout() { + switch (this) { + case SANDBOX: + return 1000L; + case ALLOWLIST: + return 1000L * 60 * 5; + case INTERNET: + return 1000L * 10; + case LEGACY: + return 1000L * 60; + case UNSECURE: + return 1000L * 60 * 5; + } + throw new AssertionError(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/security/SecurityUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/security/SecurityUtils.java new file mode 100644 index 000000000..59c62e1fc --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/security/SecurityUtils.java @@ -0,0 +1,147 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.security; + +import java.awt.Image; +import java.awt.image.BufferedImage; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.StringTokenizer; + +import javax.swing.ImageIcon; + +import net.sourceforge.plantuml.OptionFlags; +import net.sourceforge.plantuml.StringUtils; + +public class SecurityUtils { + + static private SecurityProfile current = null; + + public static synchronized SecurityProfile getSecurityProfile() { + if (current == null) { + current = SecurityProfile.init(); + } + return current; + } + + public static boolean getJavascriptUnsecure() { + final String env = getenv("PLANTUML_JAVASCRIPT_UNSECURE"); + if ("true".equalsIgnoreCase(env)) { + return true; + } + return OptionFlags.ALLOW_INCLUDE; + } + + public static String getenv(String name) { + final String env = System.getProperty(name); + if (StringUtils.isNotEmpty(env)) { + return env; + } + return System.getenv(name); + } + + public static List getPath(String prop) { + final List result = new ArrayList(); + String paths = getenv(prop); + if (paths == null) { + return Collections.unmodifiableList(result); + } + paths = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(paths); + final StringTokenizer st = new StringTokenizer(paths, System.getProperty("path.separator")); + while (st.hasMoreTokens()) { + try { + final SFile f = new SFile(st.nextToken()).getCanonicalFile(); + if (f.isDirectory()) { + result.add(f); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + return Collections.unmodifiableList(result); + } + + public static boolean allowSvgText() { + return true; + } + + public static java.io.PrintWriter createPrintWriter(OutputStream os) { + return new PrintWriter(os); + } + + public static java.io.PrintWriter createPrintWriter(OutputStream os, boolean append) { + return new PrintWriter(os, append); + } + + public static PrintStream createPrintStream(OutputStream os) { + return new PrintStream(os); + } + + public static PrintStream createPrintStream(OutputStream os, boolean autoFlush, String charset) + throws UnsupportedEncodingException { + return new PrintStream(os, autoFlush, charset); + } + + public synchronized static BufferedImage readRasterImage(final ImageIcon imageIcon) { + final Image tmpImage = imageIcon.getImage(); + if (imageIcon.getIconWidth() == -1) { + return null; + } + final BufferedImage image = new BufferedImage(imageIcon.getIconWidth(), imageIcon.getIconHeight(), + BufferedImage.TYPE_INT_ARGB); + image.getGraphics().drawImage(tmpImage, 0, 0, null); + tmpImage.flush(); + return image; + } + + // ---- + public static FileReader createFileReader(String path) throws FileNotFoundException { + return new FileReader(path); + } + + public static java.io.PrintWriter createPrintWriter(String path) throws FileNotFoundException { + return new PrintWriter(path); + } + + public static FileOutputStream createFileOutputStream(String path) throws FileNotFoundException { + return new FileOutputStream(path); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/AbstractEvent.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/AbstractEvent.java index ce0f70502..d93886ec4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/AbstractEvent.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/AbstractEvent.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java index 343ad67d2..7f6b3e51d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,25 +36,28 @@ import java.util.List; import java.util.Set; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.skin.ArrowConfiguration; +import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; -import net.sourceforge.plantuml.style.StyleDefinition; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.WithStyle; public abstract class AbstractMessage implements EventWithDeactivate, WithStyle { public Style[] getUsedStyles() { - return new Style[] { getDefaultStyleDefinition().getMergedStyle(styleBuilder) }; + Style style = getDefaultStyleDefinition().getMergedStyle(styleBuilder); + if (style != null && arrowConfiguration.getColor() != null) { + style = style.eventuallyOverride(PName.LineColor, arrowConfiguration.getColor()); + } + return new Style[] { style }; } - public StyleDefinition getDefaultStyleDefinition() { - return StyleDefinition.of(SName.root, SName.element, SName.sequenceDiagram, - SName.message); + public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, SName.arrow); } private final Display label; @@ -177,7 +180,8 @@ public final List getNoteOnMessages() { } public final void setNote(Note note) { - if (note.getPosition() != NotePosition.LEFT && note.getPosition() != NotePosition.RIGHT) { + if (note.getPosition() != NotePosition.LEFT && note.getPosition() != NotePosition.RIGHT + && note.getPosition() != NotePosition.BOTTOM && note.getPosition() != NotePosition.TOP) { throw new IllegalArgumentException(); } note = note.withPosition(overideNotePosition(note.getPosition())); @@ -246,4 +250,7 @@ public String getPart2Anchor() { return this.anchor2; } + public abstract Participant getParticipant1(); + + public abstract Participant getParticipant2(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/AutoNumber.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/AutoNumber.java index 814fa2621..644082c03 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/AutoNumber.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/AutoNumber.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Delay.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Delay.java index ac9f2a635..2411b42d1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Delay.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Delay.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,7 +34,7 @@ import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; -import net.sourceforge.plantuml.style.StyleDefinition; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.WithStyle; public class Delay extends AbstractEvent implements Event, WithStyle { @@ -43,7 +43,7 @@ public class Delay extends AbstractEvent implements Event, WithStyle { final private Style style; - public StyleDefinition getDefaultStyleDefinition() { + public StyleSignature getDefaultStyleDefinition() { return ComponentType.DELAY_TEXT.getDefaultStyleDefinition(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Divider.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Divider.java index 91c7fa07c..ca00798c0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Divider.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Divider.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,7 +34,7 @@ import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; -import net.sourceforge.plantuml.style.StyleDefinition; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.WithStyle; public class Divider extends AbstractEvent implements Event, WithStyle { @@ -43,7 +43,7 @@ public class Divider extends AbstractEvent implements Event, WithStyle { final private Style style; - public StyleDefinition getDefaultStyleDefinition() { + public StyleSignature getDefaultStyleDefinition() { return ComponentType.DIVIDER.getDefaultStyleDefinition(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/DottedNumber.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/DottedNumber.java index 4d628d298..37e940eb5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/DottedNumber.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/DottedNumber.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Englober.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Englober.java index 398945bf4..473565e51 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Englober.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Englober.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,7 +37,6 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.PaddingParam; import net.sourceforge.plantuml.SkinParamBackcolored; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.real.RealUtils; @@ -51,11 +50,11 @@ import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; -import net.sourceforge.plantuml.style.StyleDefinition; -import net.sourceforge.plantuml.style.ValueImpl; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.WithStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Englober implements WithStyle { @@ -68,13 +67,13 @@ public class Englober implements WithStyle { final private boolean isTeoz; private double marginX = 0; - public StyleDefinition getDefaultStyleDefinition() { + public StyleSignature getDefaultStyleDefinition() { return ComponentType.ENGLOBER.getDefaultStyleDefinition(); } public Style[] getUsedStyles() { - Style tmp = getDefaultStyleDefinition().getMergedStyle(styleBuilder); - final HtmlColor backColor = participantEnglober.getBoxColor(); + Style tmp = getDefaultStyleDefinition().with(participantEnglober.getStereotype()).getMergedStyle(styleBuilder); + final HColor backColor = participantEnglober.getBoxColor(); if (tmp != null) { tmp = tmp.eventuallyOverride(PName.BackGroundColor, backColor); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Event.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Event.java index bd9d46e9d..cc59d3ddb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Event.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Event.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/EventWithDeactivate.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/EventWithDeactivate.java index 42becd8ed..0cc1d415a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/EventWithDeactivate.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/EventWithDeactivate.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Grouping.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Grouping.java index 1dd4549b0..d9a8a4f9b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Grouping.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Grouping.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,32 +30,32 @@ */ package net.sourceforge.plantuml.sequencediagram; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; -import net.sourceforge.plantuml.style.StyleDefinition; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.WithStyle; +import net.sourceforge.plantuml.ugraphic.color.HColor; public abstract class Grouping implements Event, WithStyle { private final String title; private final GroupingType type; private final String comment; - private final HtmlColor backColorElement; + private final HColor backColorElement; // private final StyleBuilder styleBuilder; final private Style style; final private Style styleHeader; - public StyleDefinition getDefaultStyleDefinition() { - return StyleDefinition.of(SName.root, SName.element, SName.sequenceDiagram, SName.group); + public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, SName.group); } - private StyleDefinition getHeaderStyleDefinition() { - return StyleDefinition.of(SName.root, SName.element, SName.sequenceDiagram, SName.groupHeader); + private StyleSignature getHeaderStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, SName.groupHeader); } public Style[] getUsedStyles() { @@ -65,7 +65,7 @@ public Style[] getUsedStyles() { backColorElement) }; } - public Grouping(String title, String comment, GroupingType type, HtmlColor backColorElement, + public Grouping(String title, String comment, GroupingType type, HColor backColorElement, StyleBuilder styleBuilder) { this.title = title; // this.styleBuilder = styleBuilder; @@ -91,13 +91,13 @@ final public GroupingType getType() { public abstract int getLevel(); - public abstract HtmlColor getBackColorGeneral(); + public abstract HColor getBackColorGeneral(); final public String getComment() { return comment; } - public final HtmlColor getBackColorElement() { + public final HColor getBackColorElement() { return backColorElement; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/GroupingLeaf.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/GroupingLeaf.java index ce2e7e479..468f0159a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/GroupingLeaf.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/GroupingLeaf.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,16 +34,16 @@ import java.util.List; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.style.StyleBuilder; +import net.sourceforge.plantuml.ugraphic.color.HColor; final public class GroupingLeaf extends Grouping implements EventWithDeactivate { private final GroupingStart start; - private final HtmlColor backColorGeneral; + private final HColor backColorGeneral; - public GroupingLeaf(String title, String comment, GroupingType type, HtmlColor backColorGeneral, - HtmlColor backColorElement, GroupingStart start, StyleBuilder styleBuilder) { + public GroupingLeaf(String title, String comment, GroupingType type, HColor backColorGeneral, + HColor backColorElement, GroupingStart start, StyleBuilder styleBuilder) { super(title, comment, type, backColorElement, styleBuilder); if (start == null) { throw new IllegalArgumentException(); @@ -74,7 +74,7 @@ public int getLevel() { } @Override - public final HtmlColor getBackColorGeneral() { + public final HColor getBackColorGeneral() { if (backColorGeneral == null) { return start.getBackColorGeneral(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/GroupingStart.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/GroupingStart.java index 2135294b6..413f1c2e3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/GroupingStart.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/GroupingStart.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,20 +35,20 @@ import java.util.List; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class GroupingStart extends Grouping { private final List children = new ArrayList(); - private final HtmlColor backColorGeneral; + private final HColor backColorGeneral; final private GroupingStart parent; private boolean parallel = false; - public GroupingStart(String title, String comment, HtmlColor backColorGeneral, HtmlColor backColorElement, + public GroupingStart(String title, String comment, HColor backColorGeneral, HColor backColorElement, GroupingStart parent, StyleBuilder styleBuilder) { super(title, comment, GroupingType.START, backColorElement, styleBuilder); this.backColorGeneral = backColorGeneral; @@ -79,7 +79,7 @@ public int getLevel() { } @Override - public HtmlColor getBackColorGeneral() { + public HColor getBackColorGeneral() { return backColorGeneral; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/GroupingType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/GroupingType.java index 2ea761f2d..cbbbeffa7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/GroupingType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/GroupingType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/HSpace.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/HSpace.java index e2900b20a..8caafe083 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/HSpace.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/HSpace.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/InGroupable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/InGroupable.java index c03d9e065..c646d2bc7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/InGroupable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/InGroupable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/InGroupableList.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/InGroupableList.java index c21fe4362..4a4ab53b1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/InGroupableList.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/InGroupableList.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/LifeEvent.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/LifeEvent.java index 221cfe215..87a573199 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/LifeEvent.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/LifeEvent.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/LifeEventType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/LifeEventType.java index 97c3ed7fa..b34fcee60 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/LifeEventType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/LifeEventType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java index 8a94f27d6..9c507408b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,14 +38,13 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.sequencediagram.teoz.YPositionedTile; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class LinkAnchor { @@ -87,8 +86,8 @@ public void drawAnchor(UGraphic ug, YPositionedTile tile1, YPositionedTile tile2 final double ymin = Math.min(y1, y2); final double ymax = Math.max(y1, y2); - final HtmlColor color = new Rose().getHtmlColor(param, ColorParam.arrow); - final Rainbow rainbow = HtmlColorAndStyle.fromColor(color); + final HColor color = new Rose().getHtmlColor(param, ColorParam.arrow); + final Rainbow rainbow = Rainbow.fromColor(color, null); final Snake snake = new Snake(Arrows.asToUp(), HorizontalAlignment.CENTER, rainbow, Arrows.asToDown()); final Display display = Display.getWithNewlines(message); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Message.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Message.java index e717ccc2e..70506b0e6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Message.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Message.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -51,10 +51,12 @@ public String toString() { return super.toString() + " " + p1 + "->" + p2 + " " + getLabel(); } + @Override public Participant getParticipant1() { return p1; } + @Override public Participant getParticipant2() { return p2; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/MessageExo.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/MessageExo.java index dc6bea489..05013d8b1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/MessageExo.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/MessageExo.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,9 +32,7 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.skin.ArrowConfiguration; -import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; -import net.sourceforge.plantuml.style.StyleDefinition; public class MessageExo extends AbstractMessage { @@ -65,6 +63,16 @@ protected NotePosition overideNotePosition(NotePosition notePosition) { throw new IllegalStateException(); } + @Override + public Participant getParticipant1() { + return participant; + } + + @Override + public Participant getParticipant2() { + return participant; + } + public Participant getParticipant() { return participant; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/MessageExoType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/MessageExoType.java index d1bd92693..dca455eff 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/MessageExoType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/MessageExoType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,16 +34,14 @@ public enum MessageExoType { FROM_LEFT, TO_LEFT, FROM_RIGHT, TO_RIGHT; public int getDirection() { - if (this == MessageExoType.FROM_LEFT) { + switch (this) { + case FROM_LEFT: return 1; - } - if (this == MessageExoType.TO_LEFT) { + case TO_LEFT: return -1; - } - if (this == MessageExoType.TO_RIGHT) { + case TO_RIGHT: return 1; - } - if (this == MessageExoType.FROM_RIGHT) { + case FROM_RIGHT: return -1; } throw new IllegalStateException(); @@ -57,4 +55,18 @@ public boolean isRightBorder() { return this == MessageExoType.FROM_RIGHT || this == MessageExoType.TO_RIGHT; } + public MessageExoType reverse() { + switch (this) { + case FROM_LEFT: + return TO_LEFT; + case TO_RIGHT: + return FROM_RIGHT; + case FROM_RIGHT: + return TO_RIGHT; + case TO_LEFT: + return FROM_LEFT; + } + throw new IllegalStateException(); + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/MessageNumber.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/MessageNumber.java index 95c1a0d16..1eb908b97 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/MessageNumber.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/MessageNumber.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Newpage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Newpage.java index e4422c087..1680b3779 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Newpage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Newpage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Note.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Note.java index ba4e4ff23..9255d5632 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Note.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Note.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,7 +33,6 @@ import java.util.List; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SpecificBackcolorable; import net.sourceforge.plantuml.Url; @@ -42,17 +41,24 @@ import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; -import net.sourceforge.plantuml.style.StyleDefinition; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.WithStyle; -public class Note extends AbstractEvent implements Event, SpecificBackcolorable, WithStyle { +final public class Note extends AbstractEvent implements Event, SpecificBackcolorable, WithStyle { private final Participant p; private final Participant p2; private final Display strings; - private final NotePosition position; + private/* final */NotePosition position; + + public void temporaryProtectedUntilTeozIsStandard() { + if (position == NotePosition.BOTTOM || position == NotePosition.TOP) { + position = NotePosition.LEFT; + } + } + private final StyleBuilder styleBuilder; private NoteStyle noteStyle = NoteStyle.NORMAL; private Colors colors = Colors.empty(); @@ -61,7 +67,7 @@ public class Note extends AbstractEvent implements Event, SpecificBackcolorable, private Style style; - public StyleDefinition getDefaultStyleDefinition() { + public StyleSignature getDefaultStyleDefinition() { return noteStyle.getDefaultStyleDefinition(); } @@ -182,14 +188,4 @@ public boolean isParallel() { return parallel; } -// public Style[] applyStyle2(Style[] usedStyles) { -// if (usedStyles.length != 1) { -// throw new IllegalArgumentException(); -// } -// Style tmp = usedStyles[0]; -// if (tmp != null) { -// tmp = tmp.eventuallyOverride(colors); -// } -// return new Style[] { tmp }; -// } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/NotePosition.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/NotePosition.java index 1c7863f43..59aac9fab 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/NotePosition.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/NotePosition.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,7 +33,7 @@ import net.sourceforge.plantuml.StringUtils; public enum NotePosition { - LEFT, RIGHT, OVER, OVER_SEVERAL; + LEFT, RIGHT, OVER, OVER_SEVERAL, BOTTOM, TOP; public static NotePosition defaultLeft(String s) { if (s == null) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/NoteStyle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/NoteStyle.java index 763dd75ab..05609e93e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/NoteStyle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/NoteStyle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,7 +32,7 @@ import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.style.SName; -import net.sourceforge.plantuml.style.StyleDefinition; +import net.sourceforge.plantuml.style.StyleSignature; public enum NoteStyle { @@ -57,8 +57,8 @@ public ComponentType getNoteComponentType() { return ComponentType.NOTE; } - public StyleDefinition getDefaultStyleDefinition() { - return StyleDefinition.of(SName.root, SName.element, SName.sequenceDiagram, + public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, SName.note); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/NoteType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/NoteType.java index 17a6f6889..976fa6602 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/NoteType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/NoteType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Notes.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Notes.java index 77dcf8dac..165476541 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Notes.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Notes.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Participant.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Participant.java index 53c2d8af5..567f51454 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Participant.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/Participant.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,15 +41,15 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; -import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; -import net.sourceforge.plantuml.style.StyleDefinition; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.WithStyle; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Participant implements SpecificBackcolorable, WithStyle { @@ -65,26 +65,28 @@ public class Participant implements SpecificBackcolorable, WithStyle { private final int order; private final StyleBuilder styleBuilder; - private Style style; + // private Style style; - public StyleDefinition getDefaultStyleDefinition() { - return type.getDefaultStyleDefinition(); + public StyleSignature getDefaultStyleDefinition() { + return type.getDefaultStyleDefinition().addClickable(getUrl()); } public Style[] getUsedStyles() { - Style tmp = style; - if (tmp != null) { - tmp = tmp.eventuallyOverride(getColors(null)); + if (SkinParam.USE_STYLES() == false) { + return null; } - Style stereo = getDefaultStyleDefinition().with(stereotype).getMergedStyle(styleBuilder); + final StyleSignature signature = getDefaultStyleDefinition().with(stereotype); + Style tmp = signature.getMergedStyle(styleBuilder); + tmp = tmp.eventuallyOverride(getColors(null)); + Style stereo = getDefaultStyleDefinition().withStereotype(stereotype).getMergedStyle(styleBuilder); if (tmp != null) { stereo = tmp.mergeWith(stereo); } return new Style[] { tmp, stereo }; } - public Participant(ParticipantType type, String code, Display display, Set hiddenPortions, - int order, StyleBuilder styleBuilder) { + public Participant(ParticipantType type, String code, Display display, Set hiddenPortions, int order, + StyleBuilder styleBuilder) { this.hiddenPortions = hiddenPortions; this.styleBuilder = styleBuilder; this.order = order; @@ -100,9 +102,9 @@ public Participant(ParticipantType type, String code, Display display, Set participants; private final Url url; - private final HtmlColor backColorGeneral; - private final HtmlColor backColorElement; + private final HColor backColorGeneral; + private final HColor backColorElement; private final Display strings; final private Style style; + final private Style styleHeader; - public StyleDefinition getDefaultStyleDefinition() { - return ComponentType.REFERENCE.getDefaultStyleDefinition(); + public StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, SName.reference); + } + + private StyleSignature getHeaderStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, SName.referenceHeader); } public Style[] getUsedStyles() { - return new Style[] { style }; + return new Style[] { + style, + styleHeader == null ? styleHeader : styleHeader.eventuallyOverride(PName.BackGroundColor, + backColorElement) }; } - public Reference(List participants, Url url, Display strings, HtmlColor backColorGeneral, - HtmlColor backColorElement, StyleBuilder styleBuilder) { + public Reference(List participants, Url url, Display strings, HColor backColorGeneral, + HColor backColorElement, StyleBuilder styleBuilder) { this.participants = participants; this.url = url; this.strings = strings; this.backColorGeneral = backColorGeneral; this.backColorElement = backColorElement; this.style = getDefaultStyleDefinition().getMergedStyle(styleBuilder); + this.styleHeader = getHeaderStyleDefinition().getMergedStyle(styleBuilder); } public List getParticipant() { @@ -104,11 +114,11 @@ public String toString() { return sb.toString(); } - public final HtmlColor getBackColorGeneral() { + public final HColor getBackColorGeneral() { return backColorGeneral; } - public final HtmlColor getBackColorElement() { + public final HColor getBackColorElement() { return backColorElement; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java index 6ec15e954..aeb8fe3ce 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -57,13 +57,14 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.EntityPortion; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.sequencediagram.graphic.FileMaker; import net.sourceforge.plantuml.sequencediagram.graphic.SequenceDiagramFileMakerPuma2; import net.sourceforge.plantuml.sequencediagram.graphic.SequenceDiagramTxtMaker; import net.sourceforge.plantuml.sequencediagram.teoz.SequenceDiagramFileMakerTeoz; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SequenceDiagram extends UmlDiagram { @@ -87,8 +88,8 @@ public Participant getOrCreateParticipant(String code) { public Participant getOrCreateParticipant(String code, Display display) { Participant result = participantsget(code); if (result == null) { - result = new Participant(ParticipantType.PARTICIPANT, code, display, hiddenPortions, 0, getSkinParam() - .getCurrentStyleBuilder()); + result = new Participant(ParticipantType.PARTICIPANT, code, display, hiddenPortions, 0, + getSkinParam().getCurrentStyleBuilder()); addWithOrder(result); participantEnglobers2.put(result, participantEnglober); } @@ -118,8 +119,8 @@ public Participant createNewParticipant(ParticipantType type, String code, Displ // display = Arrays.asList(code); display = Display.getWithNewlines(code); } - final Participant result = new Participant(type, code, display, hiddenPortions, order, getSkinParam() - .getCurrentStyleBuilder()); + final Participant result = new Participant(type, code, display, hiddenPortions, order, + getSkinParam().getCurrentStyleBuilder()); addWithOrder(result); participantEnglobers2.put(result, participantEnglober); return result; @@ -221,7 +222,7 @@ public List events() { return Collections.unmodifiableList(events); } - private FileMaker getSequenceDiagramPngMaker(FileFormatOption fileFormatOption) { + private FileMaker getSequenceDiagramPngMaker(int index, FileFormatOption fileFormatOption) { final FileFormat fileFormat = fileFormatOption.getFileFormat(); @@ -230,7 +231,7 @@ private FileMaker getSequenceDiagramPngMaker(FileFormatOption fileFormatOption) } if (modeTeoz()) { - return new SequenceDiagramFileMakerTeoz(this, skin2, fileFormatOption); + return new SequenceDiagramFileMakerTeoz(this, skin2, fileFormatOption, index); } return new SequenceDiagramFileMakerPuma2(this, skin2, fileFormatOption); @@ -243,14 +244,14 @@ private boolean modeTeoz() { @Override protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormat) throws IOException { - final FileMaker sequenceDiagramPngMaker = getSequenceDiagramPngMaker(fileFormat); + final FileMaker sequenceDiagramPngMaker = getSequenceDiagramPngMaker(index, fileFormat); return sequenceDiagramPngMaker.createOne(os, index, fileFormat.isWithMetadata()); } // support for CommandReturn - private final Stack activationState = new Stack(); + private final Stack activationState = new Stack(); - public Message getActivatingMessage() { + public AbstractMessage getActivatingMessage() { if (activationState.empty()) { return null; } @@ -259,11 +260,11 @@ public Message getActivatingMessage() { private LifeEvent pendingCreate = null; - public String activate(Participant p, LifeEventType lifeEventType, HtmlColor backcolor) { + public String activate(Participant p, LifeEventType lifeEventType, HColor backcolor) { return activate(p, lifeEventType, backcolor, null); } - public String activate(Participant p, LifeEventType lifeEventType, HtmlColor backcolor, HtmlColor linecolor) { + public String activate(Participant p, LifeEventType lifeEventType, HColor backcolor, HColor linecolor) { if (lastDelay != null) { return "You cannot Activate/Deactivate just after a ..."; } @@ -283,8 +284,8 @@ public String activate(Participant p, LifeEventType lifeEventType, HtmlColor bac } return null; } - if (lifeEventType == LifeEventType.ACTIVATE && lastEventWithDeactivate instanceof Message) { - activationState.push((Message) lastEventWithDeactivate); + if (lifeEventType == LifeEventType.ACTIVATE && lastEventWithDeactivate instanceof AbstractMessage) { + activationState.push((AbstractMessage) lastEventWithDeactivate); } else if (lifeEventType == LifeEventType.DEACTIVATE && activationState.empty() == false) { activationState.pop(); } @@ -300,8 +301,8 @@ public String activate(Participant p, LifeEventType lifeEventType, HtmlColor bac private final List openGroupings = new ArrayList(); - public boolean grouping(String title, String comment, GroupingType type, HtmlColor backColorGeneral, - HtmlColor backColorElement, boolean parallel) { + public boolean grouping(String title, String comment, GroupingType type, HColor backColorGeneral, + HColor backColorElement, boolean parallel) { if (type != GroupingType.START && openGroupings.size() == 0) { return false; } @@ -311,9 +312,11 @@ public boolean grouping(String title, String comment, GroupingType type, HtmlCol final GroupingStart top = openGroupings.size() > 0 ? openGroupings.get(0) : null; - final Grouping g = type == GroupingType.START ? new GroupingStart(title, comment, backColorGeneral, - backColorElement, top, getSkinParam().getCurrentStyleBuilder()) : new GroupingLeaf(title, comment, - type, backColorGeneral, backColorElement, top, getSkinParam().getCurrentStyleBuilder()); + final Grouping g = type == GroupingType.START + ? new GroupingStart(title, comment, backColorGeneral, backColorElement, top, + getSkinParam().getCurrentStyleBuilder()) + : new GroupingLeaf(title, comment, type, backColorGeneral, backColorElement, top, + getSkinParam().getCurrentStyleBuilder()); events.add(g); if (type == GroupingType.START) { @@ -351,7 +354,8 @@ public final AutoNumber getAutoNumber() { // autoNumber.resume(decimalFormat); // } // - // public final void autonumberResume(int increment, DecimalFormat decimalFormat) { + // public final void autonumberResume(int increment, DecimalFormat + // decimalFormat) { // autoNumber.resume(increment, decimalFormat); // } @@ -387,11 +391,11 @@ public UmlDiagramType getUmlDiagramType() { private ParticipantEnglober participantEnglober; - public void boxStart(Display comment, HtmlColor color) { + public void boxStart(Display comment, HColor color, Stereotype stereotype) { if (participantEnglober != null) { throw new IllegalStateException(); } - this.participantEnglober = new ParticipantEnglober(comment, color); + this.participantEnglober = new ParticipantEnglober(comment, color, stereotype); } public void endBox() { @@ -408,7 +412,7 @@ public boolean isBoxPending() { @Override public int getNbImages() { try { - return getSequenceDiagramPngMaker(new FileFormatOption(FileFormat.PNG)).getNbPages(); + return getSequenceDiagramPngMaker(1, new FileFormatOption(FileFormat.PNG)).getNbPages(); } catch (Throwable t) { t.printStackTrace(); return 1; @@ -513,7 +517,7 @@ public String checkFinalError() { return super.checkFinalError(); } - private final Set hiddenPortions = EnumSet. noneOf(EntityPortion.class); + private final Set hiddenPortions = EnumSet.noneOf(EntityPortion.class); public void hideOrShow(Set portions, boolean show) { if (show) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java index 395ff94e5..a531730bf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -70,7 +70,6 @@ import net.sourceforge.plantuml.sequencediagram.command.CommandReferenceMultilinesOverSeveral; import net.sourceforge.plantuml.sequencediagram.command.CommandReferenceOverSeveral; import net.sourceforge.plantuml.sequencediagram.command.CommandReturn; -import net.sourceforge.plantuml.sequencediagram.command.CommandSkin; import net.sourceforge.plantuml.sequencediagram.command.CommandUrl; public class SequenceDiagramFactory extends UmlDiagramFactory { @@ -110,8 +109,8 @@ protected List createCommands() { final FactorySequenceNoteOverSeveralCommand factorySequenceNoteOverSeveralCommand = new FactorySequenceNoteOverSeveralCommand(); cmds.add(factorySequenceNoteOverSeveralCommand.createSingleLine()); - final FactorySequenceNoteAcrossCommand factorySequenceNoteAccrossCommand = new FactorySequenceNoteAcrossCommand(); - cmds.add(factorySequenceNoteAccrossCommand.createSingleLine()); + final FactorySequenceNoteAcrossCommand factorySequenceNoteAcrossCommand = new FactorySequenceNoteAcrossCommand(); + cmds.add(factorySequenceNoteAcrossCommand.createSingleLine()); cmds.add(new CommandBoxStart()); cmds.add(new CommandBoxEnd()); @@ -126,7 +125,7 @@ protected List createCommands() { cmds.add(factorySequenceNoteCommand.createMultiLine(false)); cmds.add(factorySequenceNoteOverSeveralCommand.createMultiLine(false)); cmds.add(factorySequenceNoteOnArrowCommand.createMultiLine(false)); - cmds.add(factorySequenceNoteAccrossCommand.createMultiLine(false)); + cmds.add(factorySequenceNoteAcrossCommand.createMultiLine(false)); cmds.add(new CommandNewpage()); cmds.add(new CommandIgnoreNewpage()); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate.java index 34e8625f1..add81bf0b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,10 +39,10 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.sequencediagram.LifeEventType; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandActivate extends SingleLineCommand2 { @@ -69,8 +69,8 @@ protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocatio final LifeEventType type = LifeEventType.valueOf(StringUtils.goUpperCase(arg.get("TYPE", 0))); final Participant p = diagram.getOrCreateParticipant(StringUtils .eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("WHO", 0))); - final HtmlColor backColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("BACK", 0)); - final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINE", 0)); + final HColor backColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("BACK", 0)); + final HColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINE", 0)); final String error = diagram.activate(p, type, backColor, lineColor); if (error == null) { return CommandExecutionResult.ok(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate2.java index 63980d488..dee650ac6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java index 3a74ff022..fc1cecdc5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -47,8 +47,6 @@ import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.sequencediagram.LifeEventType; import net.sourceforge.plantuml.sequencediagram.Message; import net.sourceforge.plantuml.sequencediagram.Participant; @@ -58,10 +56,12 @@ import net.sourceforge.plantuml.skin.ArrowDecoration; import net.sourceforge.plantuml.skin.ArrowHead; import net.sourceforge.plantuml.skin.ArrowPart; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class CommandArrow extends SingleLineCommand2 { - private static final String ANCHOR = "(\\{([\\p{L}0-9_]+)\\}[%s]+)?"; + static final String ANCHOR = "(\\{([\\p{L}0-9_]+)\\}[%s]+)?"; public CommandArrow() { super(getRegexConcat()); @@ -72,44 +72,42 @@ public static String getColorOrStylePattern() { } static IRegex getRegexConcat() { - return RegexConcat - .build(CommandArrow.class.getName(), - RegexLeaf.start(), // - new RegexLeaf("PARALLEL", "(&[%s]*)?"), // - new RegexLeaf("ANCHOR", ANCHOR), // - new RegexOr("PART1", // - new RegexLeaf("PART1CODE", "([\\p{L}0-9_.@]+)"), // - new RegexLeaf("PART1LONG", "[%g]([^%g]+)[%g]"), // - new RegexLeaf("PART1LONGCODE", "[%g]([^%g]+)[%g][%s]*as[%s]+([\\p{L}0-9_.@]+)"), // - new RegexLeaf("PART1CODELONG", "([\\p{L}0-9_.@]+)[%s]+as[%s]*[%g]([^%g]+)[%g]")), // - new RegexLeaf("PART1ANCHOR", ANCHOR), // - RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("ARROW_DRESSING1", - "([%s][ox]|(?:[%s][ox])?<>?(?:[ox][%s])?|//?(?:[ox][%s])?|\\\\\\\\?(?:[ox][%s])?|[ox][%s])?"), // - RegexLeaf.spaceZeroOrMore(), // - new RegexOr("PART2", // - new RegexLeaf("PART2CODE", "([\\p{L}0-9_.@]+)"), // - new RegexLeaf("PART2LONG", "[%g]([^%g]+)[%g]"), // - new RegexLeaf("PART2LONGCODE", "[%g]([^%g]+)[%g][%s]*as[%s]+([\\p{L}0-9_.@]+)"), // - new RegexLeaf("PART2CODELONG", "([\\p{L}0-9_.@]+)[%s]+as[%s]*[%g]([^%g]+)[%g]")), // - new RegexLeaf("PART2ANCHOR", ANCHOR), // - RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("ACTIVATION", "(?:([+*!-]+)?)"), // - RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("LIFECOLOR", "(?:(#\\w+)?)"), // - RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // - RegexLeaf.spaceZeroOrMore(), new RegexLeaf("MESSAGE", "(?::[%s]*(.*))?"), RegexLeaf.end()); + return RegexConcat.build(CommandArrow.class.getName(), RegexLeaf.start(), // + new RegexLeaf("PARALLEL", "(&[%s]*)?"), // + new RegexLeaf("ANCHOR", ANCHOR), // + new RegexOr("PART1", // + new RegexLeaf("PART1CODE", "([\\p{L}0-9_.@]+)"), // + new RegexLeaf("PART1LONG", "[%g]([^%g]+)[%g]"), // + new RegexLeaf("PART1LONGCODE", "[%g]([^%g]+)[%g][%s]*as[%s]+([\\p{L}0-9_.@]+)"), // + new RegexLeaf("PART1CODELONG", "([\\p{L}0-9_.@]+)[%s]+as[%s]*[%g]([^%g]+)[%g]")), // + new RegexLeaf("PART1ANCHOR", ANCHOR), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("ARROW_DRESSING1", + "([%s][ox]|(?:[%s][ox])?<>?(?:[ox][%s])?|//?(?:[ox][%s])?|\\\\\\\\?(?:[ox][%s])?|[ox][%s])?"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexOr("PART2", // + new RegexLeaf("PART2CODE", "([\\p{L}0-9_.@]+)"), // + new RegexLeaf("PART2LONG", "[%g]([^%g]+)[%g]"), // + new RegexLeaf("PART2LONGCODE", "[%g]([^%g]+)[%g][%s]*as[%s]+([\\p{L}0-9_.@]+)"), // + new RegexLeaf("PART2CODELONG", "([\\p{L}0-9_.@]+)[%s]+as[%s]*[%g]([^%g]+)[%g]")), // + new RegexLeaf("PART2ANCHOR", ANCHOR), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("ACTIVATION", "(?:([+*!-]+)?)"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("LIFECOLOR", "(?:(#\\w+)?)"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // + RegexLeaf.spaceZeroOrMore(), new RegexLeaf("MESSAGE", "(?::[%s]*(.*))?"), RegexLeaf.end()); } private Participant getOrCreateParticipant(SequenceDiagram system, RegexResult arg2, String n) { @@ -258,7 +256,7 @@ protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocatio return CommandExecutionResult.error(error); } - final HtmlColor activationColor = diagram.getSkinParam().getIHtmlColorSet() + final HColor activationColor = diagram.getSkinParam().getIHtmlColorSet() .getColorIfValid(arg.get("LIFECOLOR", 0)); if (activationSpec != null) { @@ -318,7 +316,7 @@ public static ArrowConfiguration applyStyle(String arrowStyle, ArrowConfiguratio config = config.withBody(ArrowBody.HIDDEN); // link.goHidden(); } else { - config = config.withColor(HtmlColorSet.getInstance().getColorIfValid(s)); + config = config.withColor(HColorSet.instance().getColorIfValid(s)); } } return config; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutoNewpage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutoNewpage.java index 11fb3448f..6f6cbfa78 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutoNewpage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutoNewpage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutoactivate.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutoactivate.java index aa798a2ff..e6422c148 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutoactivate.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutoactivate.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutonumber.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutonumber.java index 55ab8b582..805a3d961 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutonumber.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutonumber.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutonumberIncrement.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutonumberIncrement.java index 3e735ea1f..f2c7e8863 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutonumberIncrement.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutonumberIncrement.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutonumberResume.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutonumberResume.java index 0158f665b..bec1be746 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutonumberResume.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutonumberResume.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutonumberStop.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutonumberStop.java index 353bd467e..fe2284234 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutonumberStop.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandAutonumberStop.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxEnd.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxEnd.java index aa80e2329..2301f79ff 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxEnd.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxEnd.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java index bf77477ff..33e770e65 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,6 +30,7 @@ */ package net.sourceforge.plantuml.sequencediagram.command; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; @@ -40,6 +41,7 @@ import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; @@ -62,7 +64,9 @@ static IRegex getRegexConcat() { RegexLeaf.spaceOneOrMore(), // new RegexLeaf("NAME2", "([^#]+)")))), // RegexLeaf.spaceZeroOrMore(), // - color().getRegex(), RegexLeaf.end()); + new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), // + color().getRegex(), // + RegexLeaf.end()); } private static ColorParser color() { @@ -70,16 +74,24 @@ private static ColorParser color() { } @Override - protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg2) { + protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) { if (diagram.isBoxPending()) { return CommandExecutionResult.error("Box cannot be nested"); } - final String argTitle = arg2.getLazzy("NAME", 0); - final String argColor = arg2.get("COLOR", 0); + final String argTitle = arg.getLazzy("NAME", 0); + final String argColor = arg.get("COLOR", 0); + + final String stereo = arg.get("STEREO", 0); + Stereotype stereotype = null; + if (stereo != null) { + final ISkinParam skinParam = diagram.getSkinParam(); + stereotype = new Stereotype(stereo); + } + // final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(argColor); - Colors colors = color().getColor(arg2, diagram.getSkinParam().getIHtmlColorSet()); + Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); final String title = argTitle == null ? "" : argTitle; - diagram.boxStart(Display.getWithNewlines(title), colors.getColor(ColorType.BACK)); + diagram.boxStart(Display.getWithNewlines(title), colors.getColor(ColorType.BACK), stereotype); return CommandExecutionResult.ok(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandDeactivateShort.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandDeactivateShort.java index 3104f32f4..baf264e4f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandDeactivateShort.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandDeactivateShort.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -56,7 +56,7 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(SequenceDiagram sequenceDiagram, LineLocation location, RegexResult arg2) { - Message message = sequenceDiagram.getActivatingMessage(); + Message message = (Message) sequenceDiagram.getActivatingMessage(); if (message == null) { return CommandExecutionResult.error("Nothing to deactivate."); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandDelay.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandDelay.java index a921c1e96..e466ec761 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandDelay.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandDelay.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandDivider.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandDivider.java index 72027a694..53ff17025 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandDivider.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandDivider.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java index 2df07e21c..b5aae6d5c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,7 +40,6 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.sequencediagram.LifeEventType; import net.sourceforge.plantuml.sequencediagram.MessageExo; import net.sourceforge.plantuml.sequencediagram.MessageExoType; @@ -51,6 +50,7 @@ import net.sourceforge.plantuml.skin.ArrowDecoration; import net.sourceforge.plantuml.skin.ArrowHead; import net.sourceforge.plantuml.skin.ArrowPart; +import net.sourceforge.plantuml.ugraphic.color.HColor; abstract class CommandExoArrowAny extends SingleLineCommand2 { @@ -62,8 +62,8 @@ public CommandExoArrowAny(IRegex pattern) { final protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) { final String body = arg.getLazzy("ARROW_BODYA", 0) + arg.getLazzy("ARROW_BODYB", 0); final String dressing = arg.getLazzy("ARROW_DRESSING", 0); - final Participant p = diagram.getOrCreateParticipant(StringUtils - .eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("PARTICIPANT", 0))); + final Participant p = diagram.getOrCreateParticipant( + StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("PARTICIPANT", 0))); final boolean sync = dressing.length() == 2; final boolean dotted = body.contains("--"); @@ -77,18 +77,25 @@ final protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineL final boolean bothDirection = arg.get("ARROW_BOTHDRESSING", 0) != null; - ArrowConfiguration config = bothDirection ? ArrowConfiguration.withDirectionBoth() : ArrowConfiguration - .withDirectionNormal(); + ArrowConfiguration config = bothDirection ? ArrowConfiguration.withDirectionBoth() + : ArrowConfiguration.withDirectionNormal(); if (dotted) { config = config.withBody(ArrowBody.DOTTED); } if (sync) { config = config.withHead(ArrowHead.ASYNC); } - config = config.withPart(getArrowPart(dressing)); - config = CommandArrow.applyStyle(arg.getLazzy("ARROW_STYLE", 0), config); final MessageExoType messageExoType = getMessageExoType(arg); + config = config.withPart(getArrowPart(dressing, messageExoType)); + config = CommandArrow.applyStyle(arg.getLazzy("ARROW_STYLE", 0), config); + + final String activationSpec = arg.get("ACTIVATION", 0); + + if (activationSpec != null && activationSpec.charAt(0) == '*') { + diagram.activate(p, LifeEventType.CREATE, null); + } + if (messageExoType == MessageExoType.TO_RIGHT || messageExoType == MessageExoType.TO_LEFT) { if (containsSymbolExterior(arg, "o")) { config = config.withDecoration2(ArrowDecoration.CIRCLE); @@ -130,16 +137,34 @@ final protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineL if (parallel) { msg.goParallel(); } + msg.setAnchor(arg.get("ANCHOR", 1)); + msg.setPart1Anchor(arg.get("PART1ANCHOR", 1)); + msg.setPart2Anchor(arg.get("PART2ANCHOR", 1)); final String error = diagram.addMessage(msg); if (error != null) { return CommandExecutionResult.error(error); } - final HtmlColor activationColor = diagram.getSkinParam().getIHtmlColorSet() + final HColor activationColor = diagram.getSkinParam().getIHtmlColorSet() .getColorIfValid(arg.get("LIFECOLOR", 0)); - if (diagram.isAutoactivate() && (config.getHead() == ArrowHead.NORMAL || config.getHead() == ArrowHead.ASYNC)) { + if (activationSpec != null) { + switch (activationSpec.charAt(0)) { + case '+': + diagram.activate(p, LifeEventType.ACTIVATE, activationColor); + break; + case '-': + diagram.activate(p, LifeEventType.DEACTIVATE, null); + break; + case '!': + diagram.activate(p, LifeEventType.DESTROY, null); + break; + default: + break; + } + } else if (diagram.isAutoactivate() + && (config.getHead() == ArrowHead.NORMAL || config.getHead() == ArrowHead.ASYNC)) { if (config.isDotted()) { diagram.activate(p, LifeEventType.DEACTIVATE, null); } else { @@ -151,12 +176,18 @@ final protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineL return CommandExecutionResult.ok(); } - private ArrowPart getArrowPart(String dressing) { + private ArrowPart getArrowPart(String dressing, MessageExoType messageExoType) { if (dressing.contains("/")) { - return ArrowPart.BOTTOM_PART; + if (messageExoType.getDirection() == 1) { + return ArrowPart.BOTTOM_PART; + } + return ArrowPart.TOP_PART; } if (dressing.contains("\\")) { - return ArrowPart.TOP_PART; + if (messageExoType.getDirection() == 1) { + return ArrowPart.TOP_PART; + } + return ArrowPart.BOTTOM_PART; } return ArrowPart.FULL; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowLeft.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowLeft.java index 3631c2745..5a0cacc79 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowLeft.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowLeft.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -48,6 +48,7 @@ public CommandExoArrowLeft() { static IRegex getRegexConcat() { return RegexConcat.build(CommandExoArrowLeft.class.getName(), RegexLeaf.start(), // new RegexLeaf("PARALLEL", "(&[%s]*)?"), // + new RegexLeaf("ANCHOR", CommandArrow.ANCHOR), // new RegexLeaf("SHORT", "([?\\[\\]][ox]?)?"), // new RegexOr( // new RegexConcat( // @@ -65,6 +66,10 @@ static IRegex getRegexConcat() { RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("PARTICIPANT", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])"), // RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("ACTIVATION", "(?:([+*!-]+)?)"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("LIFECOLOR", "(?:(#\\w+)?)"), // + RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // RegexLeaf.spaceZeroOrMore(), // new RegexOptional( // diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowRight.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowRight.java index 3390e1108..319ea8edc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowRight.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowRight.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -48,6 +48,7 @@ public CommandExoArrowRight() { static IRegex getRegexConcat() { return RegexConcat.build(CommandExoArrowRight.class.getName(), RegexLeaf.start(), // new RegexLeaf("PARALLEL", "(&[%s]*)?"), // + new RegexLeaf("ANCHOR", CommandArrow.ANCHOR), // new RegexLeaf("PARTICIPANT", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])"), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("ARROW_SUPPCIRCLE", "([%s]+[ox])?"), // @@ -65,6 +66,10 @@ static IRegex getRegexConcat() { new RegexLeaf("ARROW_BODYA2", "(-+)"))), // new RegexLeaf("SHORT", "([ox]?[?\\]\\[])?"), // RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("ACTIVATION", "(?:([+*!-]+)?)"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("LIFECOLOR", "(?:(#\\w+)?)"), // + RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // RegexLeaf.spaceZeroOrMore(), // new RegexOptional( // diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandFootbox.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandFootbox.java index 6a211b77e..f7fce761d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandFootbox.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandFootbox.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandFootboxOld.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandFootboxOld.java index d375fb59e..a72f85a02 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandFootboxOld.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandFootboxOld.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandGrouping.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandGrouping.java index 22651a0e9..099388171 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandGrouping.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandGrouping.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -42,9 +42,9 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.sequencediagram.GroupingType; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandGrouping extends SingleLineCommand2 { @@ -67,10 +67,10 @@ static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) { String type = StringUtils.goLowerCase(arg.get("TYPE", 0)); - final HtmlColor backColorElement = diagram.getSkinParam().getIHtmlColorSet() + final HColor backColorElement = diagram.getSkinParam().getIHtmlColorSet() .getColorIfValid(arg.get("COLORS", 0)); - final HtmlColor backColorGeneral = diagram.getSkinParam().getIHtmlColorSet() - .getColorIfValid(arg.get("COLORS", 1), true); + final HColor backColorGeneral = diagram.getSkinParam().getIHtmlColorSet() + .getColorIfValid(arg.get("COLORS", 1), diagram.getSkinParam().getBackgroundColor(true)); String comment = arg.get("COMMENT", 0); final GroupingType groupingType = GroupingType.getType(type); if ("group".equals(type)) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandHSpace.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandHSpace.java index 8c2265b41..c5fd8b402 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandHSpace.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandHSpace.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandIgnoreNewpage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandIgnoreNewpage.java index 7f5696541..e59a45363 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandIgnoreNewpage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandIgnoreNewpage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandLinkAnchor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandLinkAnchor.java index 6464ba46f..d40f80949 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandLinkAnchor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandLinkAnchor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandNewpage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandNewpage.java index 22211bd8e..06094df60 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandNewpage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandNewpage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java index f73fb8aaa..5fc42e149 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantA.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantA.java index 3cbb149ee..db460c8a8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantA.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantA.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantA2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantA2.java index 1b769f074..190997dd5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantA2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantA2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantA3.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantA3.java index 691f0b55e..7072fbffd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantA3.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantA3.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantA4.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantA4.java index 09df50873..7cbf693dc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantA4.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantA4.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceMultilinesOverSeveral.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceMultilinesOverSeveral.java index 9f14f7846..008b5906e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceMultilinesOverSeveral.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceMultilinesOverSeveral.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,10 +41,10 @@ import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandMultilines; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.Reference; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandReferenceMultilinesOverSeveral extends CommandMultilines { @@ -59,10 +59,10 @@ public String getPatternEnd() { } public CommandExecutionResult execute(final SequenceDiagram diagram, BlocLines lines) { - final List line0 = StringUtils.getSplit(getStartingPattern(), lines.getFirst499().getTrimmed() + final List line0 = StringUtils.getSplit(getStartingPattern(), lines.getFirst().getTrimmed() .getString()); - final HtmlColor backColorElement = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get(0)); - // final HtmlColor backColorGeneral = HtmlColorSet.getInstance().getColorIfValid(line0.get(1)); + final HColor backColorElement = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get(0)); + // final HtmlColor backColorGeneral = HtmlColorSetSimple.instance().getColorIfValid(line0.get(1)); final List participants = StringUtils.splitComma(line0.get(1)); final List p = new ArrayList(); @@ -83,7 +83,7 @@ public CommandExecutionResult execute(final SequenceDiagram diagram, BlocLines l strings = strings.subList(1, strings.size()); } - final HtmlColor backColorGeneral = null; + final HColor backColorGeneral = null; final Reference ref = new Reference(p, u, strings, backColorGeneral, backColorElement, diagram.getSkinParam() .getCurrentStyleBuilder()); diagram.addReference(ref); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceOverSeveral.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceOverSeveral.java index 62de31bc0..fa1a3a41b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceOverSeveral.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandReferenceOverSeveral.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,10 +43,10 @@ import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.Reference; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandReferenceOverSeveral extends SingleLineCommand2 { @@ -72,8 +72,8 @@ private static RegexConcat getConcat() { @Override protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) { - final HtmlColor backColorElement = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("REF", 0)); - // final HtmlColor backColorGeneral = HtmlColorSet.getInstance().getColorIfValid(arg.get("REF").get(1)); + final HColor backColorElement = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("REF", 0)); + // final HtmlColor backColorGeneral = HtmlColorSetSimple.instance().getColorIfValid(arg.get("REF").get(1)); final List participants = StringUtils.splitComma(arg.get("PARTS", 0)); final String url = arg.get("URL", 0); @@ -92,7 +92,7 @@ protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocatio u = new Url(url, title); } - final HtmlColor backColorGeneral = null; + final HColor backColorGeneral = null; final Reference ref = new Reference(p, u, strings, backColorGeneral, backColorElement, diagram.getSkinParam() .getCurrentStyleBuilder()); diagram.addReference(ref); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandReturn.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandReturn.java index 68361d912..a2d02699d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandReturn.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandReturn.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -39,13 +39,15 @@ import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColorSet; +import net.sourceforge.plantuml.sequencediagram.AbstractMessage; import net.sourceforge.plantuml.sequencediagram.EventWithDeactivate; import net.sourceforge.plantuml.sequencediagram.LifeEventType; import net.sourceforge.plantuml.sequencediagram.Message; +import net.sourceforge.plantuml.sequencediagram.MessageExo; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; import net.sourceforge.plantuml.skin.ArrowBody; import net.sourceforge.plantuml.skin.ArrowConfiguration; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class CommandReturn extends SingleLineCommand2 { @@ -70,7 +72,7 @@ private static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) { - Message message1 = diagram.getActivatingMessage(); + AbstractMessage message1 = diagram.getActivatingMessage(); boolean doDeactivation = true; if (message1 == null) { final EventWithDeactivate last = diagram.getLastEventWithDeactivate(); @@ -84,16 +86,22 @@ protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocatio ArrowConfiguration arrow = message1.getArrowConfiguration().withBody(ArrowBody.DOTTED); final String color = arg.get("COLOR", 0); if (color != null) { - arrow = arrow.withColor(HtmlColorSet.getInstance().getColorIfValid(color)); + arrow = arrow.withColor(HColorSet.instance().getColorIfValid(color)); } final Display display = Display.getWithNewlines(arg.get("MESSAGE", 0)); - final Message message2 = new Message(diagram.getSkinParam().getCurrentStyleBuilder(), - message1.getParticipant2(), message1.getParticipant1(), display, arrow, - diagram.getNextMessageNumber()); - final boolean parallel = arg.get("PARALLEL", 0) != null; - if (parallel) { - message2.goParallel(); + final AbstractMessage message2; + if (message1 instanceof MessageExo) { + final MessageExo exo1 = (MessageExo) message1; + message2 = new MessageExo(diagram.getSkinParam().getCurrentStyleBuilder(), exo1.getParticipant(), exo1 + .getType().reverse(), display, arrow, diagram.getNextMessageNumber(), false); + } else { + message2 = new Message(diagram.getSkinParam().getCurrentStyleBuilder(), message1.getParticipant2(), + message1.getParticipant1(), display, arrow, diagram.getNextMessageNumber()); + final boolean parallel = arg.get("PARALLEL", 0) != null; + if (parallel) { + message2.goParallel(); + } } diagram.addMessage(message2); @@ -106,5 +114,4 @@ protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocatio return CommandExecutionResult.ok(); } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandSkin.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandSkin.java index 8e97bab93..8da9f7a63 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandSkin.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandSkin.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandUrl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandUrl.java index 48499f76c..0fae770db 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandUrl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/command/CommandUrl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Arrow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Arrow.java index b0cc59023..6c04d3f98 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Arrow.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Arrow.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,7 +35,6 @@ import net.sourceforge.plantuml.sequencediagram.InGroupable; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.skin.ArrowComponent; -import net.sourceforge.plantuml.skin.rose.AbstractComponentRoseArrow; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -82,7 +81,7 @@ protected final void startUrl(UGraphic ug) { protected final void endUrl(UGraphic ug) { if (url != null) { - ug.closeAction(); + ug.closeUrl(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ArrowAndNoteBox.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ArrowAndNoteBox.java index b655a56fb..03cc0dff8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ArrowAndNoteBox.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ArrowAndNoteBox.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ArrowAndParticipant.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ArrowAndParticipant.java index aa0f04d89..46ff663fe 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ArrowAndParticipant.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ArrowAndParticipant.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -92,7 +92,7 @@ protected void drawInternalU(final UGraphic ug, double maxX, Context2D context) arrow.drawInternalU(ug, maxX, context); } else { final double boxWidth = participantBox.getPreferredWidth(ug.getStringBounder()); - arrow.drawInternalU(ug.apply(new UTranslate(boxWidth / 2 - paddingParticipant, 0)), maxX, context); + arrow.drawInternalU(ug.apply(UTranslate.dx(boxWidth / 2 - paddingParticipant)), maxX, context); } final double arrowHeight = arrow.getPreferredHeight(ug.getStringBounder()); @@ -102,7 +102,10 @@ protected void drawInternalU(final UGraphic ug, double maxX, Context2D context) if (arrowHeight > boxHeight) { diff = arrowHeight - boxHeight; } - participantBox.drawParticipantHead(ug.apply(new UTranslate(participantBoxStartingX, getStartingY() + diff))); + if (context.isBackground() == false) { + participantBox + .drawParticipantHead(ug.apply(new UTranslate(participantBoxStartingX, getStartingY() + diff))); + } } private double getDiff(UGraphic ug) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Constraint.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Constraint.java index b1be93e60..0f167efdf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Constraint.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Constraint.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ConstraintSet.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ConstraintSet.java index d53461a3f..f4946bb64 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ConstraintSet.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ConstraintSet.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSet.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSet.java index d73260812..eb3eec441 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSet.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSet.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -60,7 +60,6 @@ import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.skin.SimpleContext2D; import net.sourceforge.plantuml.skin.rose.Rose; -import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -291,7 +290,7 @@ private UGraphic clipAndTranslate2(final double delta, double width, Page p, UGr private UTranslate getTranslate4(final double delta) { if (delta > 0) { - return new UTranslate(0, -delta); + return UTranslate.dy(-delta); } return new UTranslate(); } @@ -341,7 +340,7 @@ private void drawHeadTailU(UGraphic ug, Page page, double positionTail) { } box.getParticipantBox().drawHeadTailU(ug, topStartingY, showHead, positionTail); if (url != null) { - ug.closeAction(); + ug.closeUrl(); } } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSetInitializer.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSetInitializer.java index 5d25bb1db..19e0c00d8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSetInitializer.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSetInitializer.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,6 +33,7 @@ import java.util.ArrayList; import java.util.List; +import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.OptionFlags; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FileMaker.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FileMaker.java index bfb280967..61518b429 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FileMaker.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FileMaker.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FreeYStrategy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FreeYStrategy.java index 7a0d2feb6..e67757b07 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FreeYStrategy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FreeYStrategy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FreeYStrategyBasic.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FreeYStrategyBasic.java index 1cfce770a..b23c2d031 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FreeYStrategyBasic.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FreeYStrategyBasic.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Frontier.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Frontier.java index dfc235b2c..ae73a8ccf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Frontier.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Frontier.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FrontierComplex.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FrontierComplex.java index 69c7aa09b..5f8660623 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FrontierComplex.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FrontierComplex.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FrontierSimple.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FrontierSimple.java index 38cc33a87..59078ba25 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FrontierSimple.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FrontierSimple.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FrontierStack.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FrontierStack.java index c924d43ec..ab9dedaa2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FrontierStack.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FrontierStack.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FrontierStackImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FrontierStackImpl.java index 6fb07d491..b37102887 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FrontierStackImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/FrontierStackImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalDelayText.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalDelayText.java index aa4a52ce4..32419f108 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalDelayText.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalDelayText.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalDivider.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalDivider.java index 1a6a7f70c..e9a5b19bd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalDivider.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalDivider.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -51,7 +51,7 @@ public GraphicalDivider(double startingY, Component comp) { @Override protected void drawInternalU(UGraphic ug, double maxX, Context2D context) { - ug = ug.apply(new UTranslate(0, getStartingY())); + ug = ug.apply(UTranslate.dy(getStartingY())); final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dim = new Dimension2DDouble(maxX, comp.getPreferredHeight(stringBounder)); comp.drawU(ug, new Area(dim), context); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalElement.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalElement.java index 00d86db58..20a970ce0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalElement.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalElement.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalElementLiveEvent.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalElementLiveEvent.java index d5891cb9b..010e458a8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalElementLiveEvent.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalElementLiveEvent.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalHSpace.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalHSpace.java index a809ff149..91d18a750 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalHSpace.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalHSpace.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalNewpage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalNewpage.java index a7e7aeab1..e7d7a26fd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalNewpage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalNewpage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -53,7 +53,7 @@ public GraphicalNewpage(double startingY, Component comp) { @Override protected void drawInternalU(UGraphic ug, double maxX, Context2D context) { //final double x = ug.getTranslateX(); - ug = ug.apply(new UTranslate(0, getStartingY())); + ug = ug.apply(UTranslate.dy(getStartingY())); final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dim = new Dimension2DDouble(maxX, comp.getPreferredHeight(stringBounder)); comp.drawU(ug, new Area(dim), context); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalReference.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalReference.java index 126c91036..7b3e9780c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalReference.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GraphicalReference.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -79,7 +79,7 @@ protected void drawInternalU(UGraphic ug, double maxX, Context2D context) { } comp.drawU(ug, new Area(dim), context); if (url != null) { - ug.closeAction(); + ug.closeUrl(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElement.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElement.java index 3b89b4e19..7cc07c926 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElement.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElement.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElementElse.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElementElse.java index 70394c85c..21077c932 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElementElse.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElementElse.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElementHeader.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElementHeader.java index e73e4f666..812a3a7d6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElementHeader.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElementHeader.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -98,7 +98,7 @@ protected void drawInternalU(UGraphic ug, double maxX, Context2D context) { comp.drawU(ug, new Area(dim), context); for (Component note : notes) { final Dimension2D dimNote = note.getPreferredDimension(stringBounder); - note.drawU(ug.apply(new UTranslate(x2 - x1, 0)), new Area(dimNote), context); + note.drawU(ug.apply(UTranslate.dx(x2 - x1)), new Area(dimNote), context); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElementTail.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElementTail.java index 6dbbe78f5..30937a438 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElementTail.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/GroupingGraphicalElementTail.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/InGroupablesStack.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/InGroupablesStack.java index 8cc473375..c8d7d7737 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/InGroupablesStack.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/InGroupablesStack.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Lazy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Lazy.java index 13e563df9..4b32ebf0b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Lazy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Lazy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeDestroy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeDestroy.java index 5ea11feac..568999257 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeDestroy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeDestroy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeLine.java index 3549cd238..8a7e49391 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,7 +40,6 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.SkinParamForceColor; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.Component; @@ -50,6 +49,7 @@ import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class LifeLine { @@ -198,15 +198,15 @@ private Collection getSegmentsCutted(StringBounder stringBounder public void drawU(UGraphic ug, Rose skin, ISkinParam skinParam) { final StringBounder stringBounder = ug.getStringBounder(); - ug = ug.apply(new UTranslate(getStartingX(stringBounder), 0)); + ug = ug.apply(UTranslate.dx(getStartingX(stringBounder))); for (int i = 0; i < events.size(); i++) { ComponentType type = ComponentType.ALIVE_BOX_CLOSE_OPEN; for (final Iterator it = getSegmentsCutted(stringBounder, i).iterator(); it.hasNext();) { final SegmentColored seg = it.next(); - final HtmlColor specificBackColor = seg.getSpecificBackColor(); + final HColor specificBackColor = seg.getSpecificBackColor(); ISkinParam skinParam2 = new SkinParamBackcolored(skinParam, specificBackColor); - final HtmlColor specificLineColor = seg.getSpecificLineColor(); + final HColor specificLineColor = seg.getSpecificLineColor(); if (specificLineColor != null) { skinParam2 = new SkinParamForceColor(skinParam2, ColorParam.sequenceLifeLineBorder, specificLineColor); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeSegmentVariation.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeSegmentVariation.java index c004b5046..4fd68e39f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeSegmentVariation.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/LifeSegmentVariation.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/LivingParticipantBox.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/LivingParticipantBox.java index e9c77a205..ecbc8d499 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/LivingParticipantBox.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/LivingParticipantBox.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/MessageArrow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/MessageArrow.java index b07b16131..8d2dd0e73 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/MessageArrow.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/MessageArrow.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/MessageExoArrow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/MessageExoArrow.java index 71cfa9b51..6f194980d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/MessageExoArrow.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/MessageExoArrow.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/MessageSelfArrow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/MessageSelfArrow.java index 82c0471e2..809d2a1a4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/MessageSelfArrow.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/MessageSelfArrow.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/NoteBox.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/NoteBox.java index cb1671ad5..03578c704 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/NoteBox.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/NoteBox.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -109,7 +109,7 @@ protected void drawInternalU(UGraphic ug, double maxX, Context2D context) { } comp.drawU(ug, new Area(dimensionToUse), context); if (url != null) { - ug.closeAction(); + ug.closeUrl(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/NotesBoxes.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/NotesBoxes.java index f6791b537..96e5c2bda 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/NotesBoxes.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/NotesBoxes.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Page.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Page.java index 3e043c309..f5b8358ca 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Page.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Page.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/PageSplitter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/PageSplitter.java index d366ac4d8..e91ffb5db 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/PageSplitter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/PageSplitter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ParticipantBox.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ParticipantBox.java index ab5688000..21a7648d3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ParticipantBox.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ParticipantBox.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -144,14 +144,14 @@ public void drawParticipantHead(UGraphic ug) { // ug.translate(outMargin, 0); final StringBounder stringBounder = ug.getStringBounder(); head.drawU( - ug.apply(new UTranslate(outMargin, 0)), + ug.apply(UTranslate.dx(outMargin)), new Area(new Dimension2DDouble(head.getPreferredWidth(stringBounder), head .getPreferredHeight(stringBounder))), new SimpleContext2D(false)); // ug.translate(-outMargin, 0); } public void drawLineU22(UGraphic ug, double startingY, final double endingY, boolean showTail, double myDelta) { - ug = ug.apply(new UTranslate(startingX, 0)); + ug = ug.apply(UTranslate.dx(startingX)); if (delays.size() > 0) { final StringBounder stringBounder = ug.getStringBounder(); for (GraphicalDelayText delay : delays) { @@ -180,7 +180,7 @@ private void drawLineIfLowerThan(UGraphic ug, double startingY, double endingY, private void drawLine(UGraphic ug, double startingY, double endingY, Component comp) { final StringBounder stringBounder = ug.getStringBounder(); - comp.drawU(ug.apply(new UTranslate(0, startingY)), + comp.drawU(ug.apply(UTranslate.dy(startingY)), new Area(new Dimension2DDouble(head.getPreferredWidth(stringBounder) + outMargin * 2, endingY - startingY)), new SimpleContext2D(false)); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ParticipantBoxSimple.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ParticipantBoxSimple.java index f8682cb8c..253d82890 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ParticipantBoxSimple.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ParticipantBoxSimple.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ParticipantRange.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ParticipantRange.java index 455953da9..baa331383 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ParticipantRange.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/ParticipantRange.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Pushable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Pushable.java index 39f7d5963..b1bb5d7dc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Pushable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Pushable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Segment.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Segment.java index d48f8ed82..7082d8640 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Segment.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Segment.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/SegmentColored.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/SegmentColored.java index 92f7e8f0e..c99fa1acc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/SegmentColored.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/SegmentColored.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,7 +36,6 @@ import java.util.Iterator; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.Area; @@ -44,6 +43,7 @@ import net.sourceforge.plantuml.skin.SimpleContext2D; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; class SegmentColored { @@ -63,14 +63,14 @@ private SegmentColored(Segment segment, SymbolContext colors, boolean shadowing, this.pos1Initial = pos1Initial; } - public HtmlColor getSpecificBackColor() { + public HColor getSpecificBackColor() { if (colors == null) { return null; } return colors.getBackColor(); } - public HtmlColor getSpecificLineColor() { + public HColor getSpecificLineColor() { if (colors == null) { return null; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramArea.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramArea.java index 38d4298b7..3b2e83b40 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramArea.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramArea.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java index f1026f492..234a85c06 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -42,7 +42,6 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.EntityImageLegend; import net.sourceforge.plantuml.core.ImageData; @@ -51,7 +50,6 @@ import net.sourceforge.plantuml.cucadiagram.DisplaySection; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -62,14 +60,15 @@ import net.sourceforge.plantuml.sequencediagram.Newpage; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; -import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.style.StyleDefinition; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SequenceDiagramFileMakerPuma2 implements FileMaker { @@ -82,7 +81,8 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker { private double scale; - public SequenceDiagramFileMakerPuma2(SequenceDiagram sequenceDiagram, Rose skin, FileFormatOption fileFormatOption) { + public SequenceDiagramFileMakerPuma2(SequenceDiagram sequenceDiagram, Rose skin, + FileFormatOption fileFormatOption) { this.diagram = sequenceDiagram; this.stringBounder = fileFormatOption.getDefaultStringBounder(); this.fileFormatOption = fileFormatOption; @@ -155,14 +155,15 @@ public ImageData createOne(OutputStream os, final int index, boolean isWithMetad compTitle = null; } else { if (SkinParam.USE_STYLES()) { - final Style style = StyleDefinition.of(SName.root, SName.title).getMergedStyle( - diagram.getSkinParam().getCurrentStyleBuilder()); + final Style style = StyleSignature.of(SName.root, SName.title) + .getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder()); compTitle = style.createTextBlockBordered(page.getTitle(), diagram.getSkinParam().getIHtmlColorSet(), diagram.getSkinParam()); } else { - compTitle = TextBlockUtils.withMargin(TextBlockUtils.title( - new FontConfiguration(drawableSet.getSkinParam(), FontParam.SEQUENCE_TITLE, null), - page.getTitle(), drawableSet.getSkinParam()), 7, 7); + compTitle = TextBlockUtils.withMargin( + TextBlockUtils.title(new FontConfiguration(drawableSet.getSkinParam(), FontParam.TITLE, null), + page.getTitle(), drawableSet.getSkinParam()), + 7, 7); } final Dimension2D dimTitle = compTitle.calculateDimension(stringBounder); area.setTitleArea(dimTitle.getWidth(), dimTitle.getHeight()); @@ -176,10 +177,10 @@ public ImageData createOne(OutputStream os, final int index, boolean isWithMetad legendBlock = TextBlockUtils.empty(0, 0); } else { if (SkinParam.USE_STYLES()) { - final Style style = StyleDefinition.of(SName.root, SName.legend).getMergedStyle( - diagram.getSkinParam().getCurrentStyleBuilder()); - legendBlock = style.createTextBlockBordered(legend.getDisplay(), diagram.getSkinParam() - .getIHtmlColorSet(), diagram.getSkinParam()); + final Style style = StyleSignature.of(SName.root, SName.legend) + .getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder()); + legendBlock = style.createTextBlockBordered(legend.getDisplay(), + diagram.getSkinParam().getIHtmlColorSet(), diagram.getSkinParam()); } else { legendBlock = EntityImageLegend.create(legend.getDisplay(), diagram.getSkinParam()); } @@ -194,8 +195,18 @@ public ImageData createOne(OutputStream os, final int index, boolean isWithMetad final String metadata = fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null; - final ImageBuilder imageBuilder = new ImageBuilder(diagram.getSkinParam(), oneOf(scale, dpiFactor), metadata, - null, 3, 10, diagram.getAnimation()); + final int margin1; + final int margin2; + if (SkinParam.USE_STYLES()) { + margin1 = SkinParam.zeroMargin(3); + margin2 = SkinParam.zeroMargin(10); + } else { + margin1 = 3; + margin2 = 10; + } + final ImageBuilder imageBuilder = ImageBuilder.buildD(diagram.getSkinParam(), + ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2), diagram.getAnimation(), metadata, null, + oneOf(scale, dpiFactor)); imageBuilder.setUDrawable(new UDrawable() { public void drawU(UGraphic ug) { @@ -228,7 +239,8 @@ public void drawU(UGraphic ug) { sequenceAreaY += legendBlock.calculateDimension(ug.getStringBounder()).getHeight(); } final UTranslate forCore = new UTranslate(area.getSequenceAreaX() + delta1 / 2, sequenceAreaY); - TextBlock core = drawableSet.asTextBlock(delta, fullDimension.getWidth(), page, diagram.isShowFootbox()); + TextBlock core = drawableSet.asTextBlock(delta, fullDimension.getWidth(), page, + diagram.isShowFootbox()); core = annotatedWorker.addFrame(core); core.drawU(ug.apply(forCore)); // drawableSet.drawU22(ug.apply(forCore), delta, fullDimension.getWidth(), page, @@ -260,8 +272,8 @@ private void drawFooter(SequenceDiagramArea area, UGraphic ug, int page, double if (text == null) { return; } - text.drawU(ug.apply(new UTranslate(area.getFooterX(diagram.getFooter().getHorizontalAlignment()), area - .getFooterY() + legendHeight))); + text.drawU(ug.apply(new UTranslate(area.getFooterX(diagram.getFooter().getHorizontalAlignment()), + area.getFooterY() + legendHeight))); } private void drawHeader(SequenceDiagramArea area, UGraphic ug, int page) { @@ -270,8 +282,8 @@ private void drawHeader(SequenceDiagramArea area, UGraphic ug, int page) { if (text == null) { return; } - text.drawU(ug.apply(new UTranslate(area.getHeaderX(diagram.getHeader().getHorizontalAlignment()), area - .getHeaderY()))); + text.drawU(ug.apply( + new UTranslate(area.getHeaderX(diagram.getHeader().getHorizontalAlignment()), area.getHeaderY()))); } private double oneOf(double a, double b) { @@ -303,14 +315,14 @@ private double getScale(double width, double height) { private PngTitler getPngTitler(final FontParam fontParam, int page) { final ISkinParam skinParam = diagram.getSkinParam(); - final HtmlColor hyperlinkColor = skinParam.getHyperlinkColor(); - final HtmlColor titleColor = skinParam.getFontHtmlColor(null, fontParam); + final HColor hyperlinkColor = skinParam.getHyperlinkColor(); + final HColor titleColor = skinParam.getFontHtmlColor(null, fontParam); final String fontFamily = skinParam.getFont(null, false, fontParam).getFamily(null); final int fontSize = skinParam.getFont(null, false, fontParam).getSize(); final DisplaySection display = diagram.getFooterOrHeaderTeoz(fontParam).withPage(page + 1, pages.size()); Style style = null; if (SkinParam.USE_STYLES()) { - final StyleDefinition def = fontParam.getStyleDefinition(); + final StyleSignature def = fontParam.getStyleDefinition(null); style = def.getMergedStyle(skinParam.getCurrentStyleBuilder()); } return new PngTitler(titleColor, display, fontSize, fontFamily, hyperlinkColor, diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramTxtMaker.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramTxtMaker.java index 617894a9f..3445b71f9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramTxtMaker.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramTxtMaker.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.sequencediagram.Event; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; @@ -98,7 +99,8 @@ public SequenceDiagramTxtMaker(SequenceDiagram sequenceDiagram, FileFormat fileF final double tailHeight = drawableSet.getTailHeight(dummyStringBounder, diagram.isShowFootbox()); final double newpage2 = fullDimension.getHeight() - (diagram.isShowFootbox() ? tailHeight : 0) - headerHeight; final Page page = new Page(headerHeight, 0, newpage2, tailHeight, 0, null); - // drawableSet.drawU_REMOVEDME_4243(ug, 0, fullDimension.getWidth(), page, diagram.isShowFootbox()); + // drawableSet.drawU_REMOVEDME_4243(ug, 0, fullDimension.getWidth(), page, + // diagram.isShowFootbox()); final Display title = diagram.getTitle().getDisplay(); @@ -106,7 +108,7 @@ public SequenceDiagramTxtMaker(SequenceDiagram sequenceDiagram, FileFormat fileF if (title.isWhite()) { ug2 = ug; } else { - ug2 = (UGraphicTxt) ug.apply(new UTranslate(0, title.as().size() + 1)); + ug2 = (UGraphicTxt) ug.apply(UTranslate.dy(title.as().size() + 1)); } drawableSet.drawU22(ug2, 0, fullDimension.getWidth(), page, diagram.isShowFootbox()); if (title.isWhite() == false) { @@ -119,10 +121,10 @@ public SequenceDiagramTxtMaker(SequenceDiagram sequenceDiagram, FileFormat fileF public ImageData createOne(OutputStream os, int index, boolean isWithMetadata) throws IOException { if (fileFormat == FileFormat.UTXT) { - final PrintStream ps = new PrintStream(os, true, "UTF-8"); + final PrintStream ps = SecurityUtils.createPrintStream(os, true, "UTF-8"); ug.getCharArea().print(ps); } else { - final PrintStream ps = new PrintStream(os); + final PrintStream ps = SecurityUtils.createPrintStream(os); ug.getCharArea().print(ps); } return new ImageDataSimple(1, 1); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Stairs.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Stairs.java index 0c8b7ea18..caca461ed 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Stairs.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Stairs.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Abstract.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Abstract.java index 7303a32e2..6106ffc25 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Abstract.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Abstract.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Message.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Message.java index 12c952aa0..06f57b597 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Message.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Message.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -172,6 +172,7 @@ private Arrow createArrow() { for (int i = 0; i < getNotes().size(); i++) { final Component note = getNotes().get(i); final Note noteOnMessage = getMessage().getNoteOnMessages().get(i); + noteOnMessage.temporaryProtectedUntilTeozIsStandard(); noteBoxes.add(createNoteBox(getStringBounder(), messageSelfArrow, note, noteOnMessage)); } return new ArrowAndNoteBox(getStringBounder(), messageSelfArrow, noteBoxes); @@ -180,6 +181,7 @@ private Arrow createArrow() { for (int i = 0; i < getNotes().size(); i++) { final Component note = getNotes().get(i); final Note noteOnMessage = getMessage().getNoteOnMessages().get(i); + noteOnMessage.temporaryProtectedUntilTeozIsStandard(); noteBoxes.add(createNoteBox(getStringBounder(), messageArrow, note, noteOnMessage)); } return new ArrowAndNoteBox(getStringBounder(), messageArrow, noteBoxes); @@ -259,7 +261,8 @@ private ArrowConfiguration getSelfArrowType(Message m) { } if (m.getArrowConfiguration().getDressing2().getHead() == ArrowHead.CROSSX) { result = result.withHead2(m.getArrowConfiguration().getDressing2().getHead()); - System.err.println("WARNING : CROSSX"); + // System.err.println("WARNING : CROSSX"); + // Thread.dumpStack(); // assert false; } result = result.withPart(m.getArrowConfiguration().getPart()); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1MessageExo.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1MessageExo.java index 97669d905..feb15e9b9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1MessageExo.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1MessageExo.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; -import net.sourceforge.plantuml.style.Style; class Step1MessageExo extends Step1Abstract { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/FixedLink.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/FixedLink.java index 9d904c788..87e430337 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/FixedLink.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/FixedLink.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PSegment.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PSegment.java index f97c721a1..2706c02b4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PSegment.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PSegment.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PUnivers.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PUnivers.java index 1f4890818..85f144d1f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PUnivers.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PUnivers.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PushDirection.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PushDirection.java index 84ecd66ed..7570cbf4a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PushDirection.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PushDirection.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PushSide.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PushSide.java index 106528b05..2d86d2c33 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PushSide.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PushSide.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PushStrategy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PushStrategy.java index 265f195e5..c27a25e62 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PushStrategy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/PushStrategy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/SegmentPosition.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/SegmentPosition.java index 2182f0b16..bb6a19239 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/SegmentPosition.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/puma/SegmentPosition.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/AbstractTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/AbstractTile.java index 55c0ba43f..67612d73e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/AbstractTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/AbstractTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -46,7 +46,7 @@ final public double getZ(StringBounder stringBounder) { return result; } - public boolean matchAnchor(String anchor) { + public boolean matchAnchorV1(String anchor) { final Event event = this.getEvent(); if (event instanceof AbstractMessage) { final AbstractMessage msg = (AbstractMessage) event; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/Bordered.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/Bordered.java index c6365730e..4a94194b0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/Bordered.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/Bordered.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java index 904a99c5f..02dcf8964 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -116,7 +116,7 @@ public void drawU(UGraphic ug) { } final Area area = new Area(x2 - x1, dim.getHeight()); - ug = ug.apply(new UTranslate(x1, 0)); + ug = ug.apply(UTranslate.dx(x1)); comp.drawU(ug, area, (Context2D) ug); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java index 602b7b366..c4fd093c0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -166,7 +166,7 @@ public void drawU(UGraphic ug) { } x2 += LIVE_DELTA_SIZE * level2; area = new Area(x1 - x2, dim.getHeight()); - ug = ug.apply(new UTranslate(x2, 0)); + ug = ug.apply(UTranslate.dx(x2)); if (isCreate()) { livingSpace2.drawHead(ug, (Context2D) ug, VerticalAlignment.TOP, HorizontalAlignment.RIGHT); } @@ -179,9 +179,9 @@ public void drawU(UGraphic ug) { x1 += LIVE_DELTA_SIZE * level1; x2 += LIVE_DELTA_SIZE * level2; area = new Area(x2 - x1, dim.getHeight()); - ug = ug.apply(new UTranslate(x1, 0)); + ug = ug.apply(UTranslate.dx(x1)); if (isCreate()) { - livingSpace2.drawHead(ug.apply(new UTranslate(area.getDimensionToUse().getWidth(), 0)), (Context2D) ug, + livingSpace2.drawHead(ug.apply(UTranslate.dx(area.getDimensionToUse().getWidth())), (Context2D) ug, VerticalAlignment.TOP, HorizontalAlignment.LEFT); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteBottom.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteBottom.java new file mode 100644 index 000000000..5c4373c39 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteBottom.java @@ -0,0 +1,150 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.sequencediagram.teoz; + +import java.awt.geom.Dimension2D; + +import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.real.Real; +import net.sourceforge.plantuml.sequencediagram.AbstractMessage; +import net.sourceforge.plantuml.sequencediagram.Event; +import net.sourceforge.plantuml.sequencediagram.Note; +import net.sourceforge.plantuml.skin.Area; +import net.sourceforge.plantuml.skin.Component; +import net.sourceforge.plantuml.skin.ComponentType; +import net.sourceforge.plantuml.skin.Context2D; +import net.sourceforge.plantuml.skin.rose.Rose; +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; + +public class CommunicationTileNoteBottom extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY { + + private final TileWithUpdateStairs tile; + private final AbstractMessage message; + private final Rose skin; + private final ISkinParam skinParam; + private final Note noteOnMessage; + + public Event getEvent() { + return message; + } + + @Override + public double getYPoint(StringBounder stringBounder) { + return tile.getYPoint(stringBounder); + } + + public CommunicationTileNoteBottom(TileWithUpdateStairs tile, AbstractMessage message, Rose skin, + ISkinParam skinParam, Note noteOnMessage) { + this.tile = tile; + this.message = message; + this.skin = skin; + this.skinParam = skinParam; + this.noteOnMessage = noteOnMessage; + } + + public void updateStairs(StringBounder stringBounder, double y) { + tile.updateStairs(stringBounder, y); + } + + private Component getComponent(StringBounder stringBounder) { + final Component comp = skin.createComponent(noteOnMessage.getUsedStyles(), ComponentType.NOTE, null, + noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings()); + return comp; + } + + private Real getNotePosition(StringBounder stringBounder) { + final Real minX = tile.getMinX(stringBounder); + return minX; + } + + public void drawU(UGraphic ug) { + final StringBounder stringBounder = ug.getStringBounder(); + final Component comp = getComponent(stringBounder); + final Dimension2D dim = comp.getPreferredDimension(stringBounder); + final Area area = new Area(dim.getWidth(), dim.getHeight()); + tile.drawU(ug); + + final double middleMsg = (tile.getMinX(stringBounder).getCurrentValue() + tile.getMaxX(stringBounder).getCurrentValue()) / 2; + + final double xNote = getNotePosition(stringBounder).getCurrentValue(); + final double yNote = tile.getPreferredHeight(stringBounder); + + comp.drawU(ug.apply(new UTranslate(xNote, yNote + spacey)), area, (Context2D) ug); + + drawLine(ug, middleMsg, tile.getYPoint(stringBounder), xNote + dim.getWidth() / 2, yNote + spacey + + Rose.paddingY); + + } + + private final double spacey = 10; + + private void drawLine(UGraphic ug, double x1, double y1, double x2, double y2) { + final HColor color = new Rose().getHtmlColor(skinParam, ColorParam.arrow); + + final double dx = x2 - x1; + final double dy = y2 - y1; + + ug.apply(new UTranslate(x1, y1)).apply(color).apply(new UStroke(2, 2, 1)) + .draw(new ULine(dx, dy)); + + } + + public double getPreferredHeight(StringBounder stringBounder) { + final Component comp = getComponent(stringBounder); + final Dimension2D dim = comp.getPreferredDimension(stringBounder); + return tile.getPreferredHeight(stringBounder) + dim.getHeight() + spacey; + } + + public void addConstraints(StringBounder stringBounder) { + tile.addConstraints(stringBounder); + } + + public Real getMinX(StringBounder stringBounder) { + return tile.getMinX(stringBounder); + } + + public Real getMaxX(StringBounder stringBounder) { + return tile.getMaxX(stringBounder); + } + + public void callbackY(double y) { + if (tile instanceof TileWithCallbackY) { + ((TileWithCallbackY) tile).callbackY(y); + } + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteLeft.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteLeft.java index ad49dcd80..4e6e62bca 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteLeft.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteLeft.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -98,7 +98,7 @@ public void drawU(UGraphic ug) { tile.drawU(ug); final Real p = getNotePosition(stringBounder); - comp.drawU(ug.apply(new UTranslate(p.getCurrentValue(), 0)), area, (Context2D) ug); + comp.drawU(ug.apply(UTranslate.dx(p.getCurrentValue())), area, (Context2D) ug); } public double getPreferredHeight(StringBounder stringBounder) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java index a89b3ab9f..4494ddb14 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -106,7 +106,7 @@ public void drawU(UGraphic ug) { tile.drawU(ug); final Real p = getNotePosition(stringBounder); - comp.drawU(ug.apply(new UTranslate(p.getCurrentValue(), 0)), area, (Context2D) ug); + comp.drawU(ug.apply(UTranslate.dx(p.getCurrentValue())), area, (Context2D) ug); } public double getPreferredHeight(StringBounder stringBounder) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteTop.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteTop.java new file mode 100644 index 000000000..599616ba1 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteTop.java @@ -0,0 +1,151 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.sequencediagram.teoz; + +import java.awt.geom.Dimension2D; + +import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.real.Real; +import net.sourceforge.plantuml.sequencediagram.AbstractMessage; +import net.sourceforge.plantuml.sequencediagram.Event; +import net.sourceforge.plantuml.sequencediagram.Note; +import net.sourceforge.plantuml.skin.Area; +import net.sourceforge.plantuml.skin.Component; +import net.sourceforge.plantuml.skin.ComponentType; +import net.sourceforge.plantuml.skin.Context2D; +import net.sourceforge.plantuml.skin.rose.Rose; +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; + +public class CommunicationTileNoteTop extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY { + + private final TileWithUpdateStairs tile; + private final AbstractMessage message; + private final Rose skin; + private final ISkinParam skinParam; + private final Note noteOnMessage; + + public Event getEvent() { + return message; + } + + @Override + public double getYPoint(StringBounder stringBounder) { + return tile.getYPoint(stringBounder); + } + + public CommunicationTileNoteTop(TileWithUpdateStairs tile, AbstractMessage message, Rose skin, + ISkinParam skinParam, Note noteOnMessage) { + this.tile = tile; + this.message = message; + this.skin = skin; + this.skinParam = skinParam; + this.noteOnMessage = noteOnMessage; + } + + public void updateStairs(StringBounder stringBounder, double y) { + tile.updateStairs(stringBounder, y); + } + + private Component getComponent(StringBounder stringBounder) { + final Component comp = skin.createComponent(noteOnMessage.getUsedStyles(), ComponentType.NOTE, null, + noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings()); + return comp; + } + + private Real getNotePosition(StringBounder stringBounder) { + final Real minX = tile.getMinX(stringBounder); + return minX; + } + + public void drawU(UGraphic ug) { + final StringBounder stringBounder = ug.getStringBounder(); + final Component comp = getComponent(stringBounder); + final Dimension2D dim = comp.getPreferredDimension(stringBounder); + final Area area = new Area(dim.getWidth(), dim.getHeight()); + + tile.drawU(ug.apply(UTranslate.dy(dim.getHeight() + spacey))); + + final double middleMsg = (tile.getMinX(stringBounder).getCurrentValue() + tile.getMaxX(stringBounder) + .getCurrentValue()) / 2; + + final double xNote = getNotePosition(stringBounder).getCurrentValue(); + + comp.drawU(ug.apply(UTranslate.dx(xNote)), area, (Context2D) ug); + + drawLine(ug, middleMsg, tile.getYPoint(stringBounder) + dim.getHeight() + spacey, xNote + dim.getWidth() / 2, + dim.getHeight() - 2 * Rose.paddingY); + + } + + private final double spacey = 10; + + private void drawLine(UGraphic ug, double x1, double y1, double x2, double y2) { + final HColor color = new Rose().getHtmlColor(skinParam, ColorParam.arrow); + + final double dx = x2 - x1; + final double dy = y2 - y1; + + ug.apply(new UTranslate(x1, y1)).apply(color).apply(new UStroke(2, 2, 1)) + .draw(new ULine(dx, dy)); + + } + + public double getPreferredHeight(StringBounder stringBounder) { + final Component comp = getComponent(stringBounder); + final Dimension2D dim = comp.getPreferredDimension(stringBounder); + return tile.getPreferredHeight(stringBounder) + dim.getHeight() + spacey; + } + + public void addConstraints(StringBounder stringBounder) { + tile.addConstraints(stringBounder); + } + + public Real getMinX(StringBounder stringBounder) { + return tile.getMinX(stringBounder); + } + + public Real getMaxX(StringBounder stringBounder) { + return tile.getMaxX(stringBounder); + } + + public void callbackY(double y) { + if (tile instanceof TileWithCallbackY) { + ((TileWithCallbackY) tile).callbackY(y); + } + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java index ded586b41..ee4a9d82f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -135,7 +135,7 @@ public void drawU(UGraphic ug) { // // x1 += CommunicationTile.LIVE_DELTA_SIZE * levelConsidere; // } area.setDeltaX1((levelIgnore - levelConsidere) * CommunicationTile.LIVE_DELTA_SIZE); - ug = ug.apply(new UTranslate(x1, 0)); + ug = ug.apply(UTranslate.dx(x1)); comp.drawU(ug, area, (Context2D) ug); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java index 3b9d32d95..f6d550a08 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -94,7 +94,7 @@ public void drawU(UGraphic ug) { tile.drawU(ug); final Real p = getNotePosition(stringBounder); - comp.drawU(ug.apply(new UTranslate(p.getCurrentValue(), 0)), area, (Context2D) ug); + comp.drawU(ug.apply(UTranslate.dx(p.getCurrentValue())), area, (Context2D) ug); } public double getPreferredHeight(StringBounder stringBounder) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/ComponentAdapter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/ComponentAdapter.java index f3a963903..610af2f53 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/ComponentAdapter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/ComponentAdapter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/DelayTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/DelayTile.java index 3bdac87fb..39c0520fe 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/DelayTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/DelayTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -97,7 +97,7 @@ public void drawU(UGraphic ug) { final Area area = new Area(getPreferredWidth(stringBounder), dim.getHeight()); tileArguments.getLivingSpaces().delayOn(y, dim.getHeight()); - ug = ug.apply(new UTranslate(getMinX(stringBounder).getCurrentValue(), 0)); + ug = ug.apply(UTranslate.dx(getMinX(stringBounder).getCurrentValue())); comp.drawU(ug, area, (Context2D) ug); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/DividerTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/DividerTile.java index 1f2c37679..3e1a8850e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/DividerTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/DividerTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -78,7 +78,7 @@ public void drawU(UGraphic ug) { final Area area = new Area(tileArguments.getBorder2() - tileArguments.getBorder1() - origin.getCurrentValue(), dim.getHeight()); - ug = ug.apply(new UTranslate(tileArguments.getBorder1(), 0)); + ug = ug.apply(UTranslate.dx(tileArguments.getBorder1())); comp.drawU(ug, area, (Context2D) ug); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/ElseTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/ElseTile.java index 0de6ceafe..ece581a8d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/ElseTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/ElseTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/EmptyTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/EmptyTile.java index 316366d5f..b5f036ce0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/EmptyTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/EmptyTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/Englobers.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/Englobers.java index 5d528cc3b..dc82ab124 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/Englobers.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/Englobers.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java index 94037250e..eddcfe3c7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistoryMode.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistoryMode.java index ed37991fe..07c5f1393 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistoryMode.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistoryMode.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java index 3601741d2..1d4a7eb1e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -86,8 +86,8 @@ public GroupingTile(Iterator it, GroupingStart start, TileArguments tileA TileArguments tileArgumentsOriginal) { final StringBounder stringBounder = tileArgumentsOriginal.getStringBounder(); this.start = start; - this.display = start.getTitle().equals("group") ? Display.create(start.getComment()) : Display.create( - start.getTitle(), start.getComment()); + this.display = start.getTitle().equals("group") ? Display.create(start.getComment()) + : Display.create(start.getTitle(), start.getComment()); this.skin = tileArgumentsOriginal.getSkin(); // this.skinParam = tileArgumentsOriginal.getSkinParam(); this.skinParam = tileArgumentsBachColorChanged.getSkinParam(); @@ -150,14 +150,15 @@ public void drawU(UGraphic ug) { final Area area = new Area(max.getCurrentValue() - min.getCurrentValue(), getTotalHeight(stringBounder)); if (ug instanceof LiveBoxFinder == false) { - comp.drawU(ug.apply(new UTranslate(min.getCurrentValue(), 0)), area, (Context2D) ug); + comp.drawU(ug.apply(UTranslate.dx(min.getCurrentValue())), area, (Context2D) ug); drawAllElses(ug); } - // ug.apply(new UChangeBackColor(HtmlColorUtils.LIGHT_GRAY)).draw(new URectangle(area.getDimensionToUse())); + // ug.apply(UChangeBackColor.nnn(HtmlColorUtils.LIGHT_GRAY)).draw(new + // URectangle(area.getDimensionToUse())); double h = dim1.getHeight() + MARGINY / 2; for (Tile tile : tiles) { - ug.apply(new UTranslate(0, h)).draw(tile); + ug.apply(UTranslate.dy(h)).draw(tile); final double preferredHeight = tile.getPreferredHeight(stringBounder); h += preferredHeight; } @@ -171,7 +172,8 @@ private double getTotalHeight(StringBounder stringBounder) { private void drawAllElses(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); final double totalHeight = getTotalHeight(stringBounder); - // final double suppHeight = getPreferredDimensionIfEmpty(stringBounder).getHeight() + MARGINY / 2; + // final double suppHeight = + // getPreferredDimensionIfEmpty(stringBounder).getHeight() + MARGINY / 2; final List ys = new ArrayList(); for (Tile tile : tiles) { if (tile instanceof ElseTile) { @@ -218,14 +220,16 @@ public void callbackY(double y) { } public static double fillPositionelTiles(StringBounder stringBounder, double y, List tiles, - final List positionedTiles) { + final List local, List full) { for (Tile tile : mergeParallel(tiles)) { - positionedTiles.add(new YPositionedTile(tile, y)); + final YPositionedTile ytile = new YPositionedTile(tile, y); + local.add(ytile); + full.add(ytile); if (tile instanceof GroupingTile) { final GroupingTile groupingTile = (GroupingTile) tile; final double headerHeight = groupingTile.getHeaderHeight(stringBounder); - fillPositionelTiles(stringBounder, y + headerHeight, groupingTile.tiles, - new ArrayList()); + final ArrayList local2 = new ArrayList(); + fillPositionelTiles(stringBounder, y + headerHeight, groupingTile.tiles, local2, full); } y += tile.getPreferredHeight(stringBounder); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/HSpaceTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/HSpaceTile.java index f12e33d7d..73d3e7888 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/HSpaceTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/HSpaceTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/IntegerColored.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/IntegerColored.java index e77bce55a..fc5071187 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/IntegerColored.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/IntegerColored.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LifeEventTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LifeEventTile.java index f7f1952c6..16ab588b2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LifeEventTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LifeEventTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -82,7 +82,7 @@ public void drawU(UGraphic ug) { final Component cross = skin.createComponent(null, ComponentType.DESTROY, null, skinParam, null); final Dimension2D dimCross = cross.getPreferredDimension(ug.getStringBounder()); final double x = livingSpace.getPosC(ug.getStringBounder()).getCurrentValue(); - cross.drawU(ug.apply(new UTranslate(x - dimCross.getWidth() / 2, 0)), null, (Context2D) ug); + cross.drawU(ug.apply(UTranslate.dx(x - dimCross.getWidth() / 2)), null, (Context2D) ug); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxFinder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxFinder.java index 51e22fe1c..1fccb96f3 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxFinder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxFinder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,21 +30,21 @@ */ package net.sourceforge.plantuml.sequencediagram.teoz; -import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.ugraphic.ColorMapper; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.UBackground; import net.sourceforge.plantuml.ugraphic.UChange; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UGraphicNo; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UParamNull; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColor; -public class LiveBoxFinder implements UGraphic { +public class LiveBoxFinder extends UGraphicNo implements UGraphic { public boolean matchesProperty(String propertyName) { return false; @@ -59,9 +59,9 @@ public UGraphic apply(UChange change) { return new LiveBoxFinder(stringBounder, translate.compose((UTranslate) change)); } else if (change instanceof UStroke) { return new LiveBoxFinder(this); - } else if (change instanceof UChangeBackColor) { + } else if (change instanceof UBackground) { return new LiveBoxFinder(this); - } else if (change instanceof UChangeColor) { + } else if (change instanceof HColor) { return new LiveBoxFinder(this); } throw new UnsupportedOperationException(); @@ -116,12 +116,6 @@ public ColorMapper getColorMapper() { return new ColorMapperIdentity(); } - public void startUrl(Url url) { - } - - public void closeAction() { - } - public void flushUg() { } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxes.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxes.java index 1146d71a4..c334a2807 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxes.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxes.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -82,7 +82,7 @@ private void drawDestroys(UGraphic ug, Stairs2 stairs, Context2D context) { private void drawOneLevel(UGraphic ug, int levelToDraw, Stairs2 stairs, Context2D context) { final LiveBoxesDrawer drawer = new LiveBoxesDrawer(context, skin, skinParam, delays); - ug = ug.apply(new UTranslate((levelToDraw - 1) * drawer.getWidth(ug.getStringBounder()) / 2.0, 0)); + ug = ug.apply(UTranslate.dx((levelToDraw - 1) * drawer.getWidth(ug.getStringBounder()) / 2.0)); boolean pending = true; for (Iterator it = stairs.getYs().iterator(); it.hasNext();) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxesDrawer.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxesDrawer.java index 898167db7..d7f78e04b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxesDrawer.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxesDrawer.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -53,7 +53,7 @@ public class LiveBoxesDrawer { private double y1; - private SymbolContext color; + private SymbolContext symbolContext; private final Component cross; private final Context2D context; @@ -81,9 +81,9 @@ public double getWidth(StringBounder stringBounder) { return compForWidth.getPreferredWidth(stringBounder); } - public void addStart(double y1, SymbolContext color) { + public void addStart(double y1, SymbolContext symbolContext) { this.y1 = y1; - this.color = color; + this.symbolContext = symbolContext; } public void doDrawing(UGraphic ug, StairsPosition yposition) { @@ -116,10 +116,13 @@ public void drawDestroyIfNeeded(UGraphic ug, StairsPosition yposition) { private void drawInternal(UGraphic ug, StairsPosition yposition, double ya, double yb, ComponentType type) { final double width = getWidth(ug.getStringBounder()); final Area area = new Area(width, yb - ya); - final ISkinParam skinParam2 = new SkinParamBackcolored(skinParam, color == null ? null : color.getBackColor()); - final Component comp = skin.createComponent( - new Style[] { type.getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()) }, - type, null, skinParam2, null); + ISkinParam skinParam2 = new SkinParamBackcolored(skinParam, symbolContext == null ? null + : symbolContext.getBackColor()); + Style style = type.getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); + if (style != null) { + style = style.eventuallyOverride(symbolContext); + } + final Component comp = skin.createComponent(new Style[] { style }, type, null, skinParam2, null); comp.drawU(ug.apply(new UTranslate(-width / 2, ya)), area, context); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java index 5c906d03e..8a1e9da9a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -172,10 +172,10 @@ public void drawHead(UGraphic ug, Context2D context, VerticalAlignment verticalA p.getSkinParamBackcolored(skinParam), p.getDisplay(skinParam.forceSequenceParticipantUnderlined())); final Dimension2D dim = comp.getPreferredDimension(ug.getStringBounder()); if (horizontalAlignment == HorizontalAlignment.RIGHT) { - ug = ug.apply(new UTranslate(-dim.getWidth(), 0)); + ug = ug.apply(UTranslate.dx(-dim.getWidth())); } if (verticalAlignment == VerticalAlignment.CENTER) { - ug = ug.apply(new UTranslate(0, -dim.getHeight() / 2)); + ug = ug.apply(UTranslate.dy(-dim.getHeight() / 2)); } final Area area = new Area(dim); final Url url = getParticipant().getUrl(); @@ -184,7 +184,7 @@ public void drawHead(UGraphic ug, Context2D context, VerticalAlignment verticalA } comp.drawU(ug, area, context); if (url != null) { - ug.closeAction(); + ug.closeUrl(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpaces.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpaces.java index df56a2c98..0b203e721 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpaces.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpaces.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -131,7 +131,7 @@ public void drawLifeLines(final UGraphic ug, double height, Context2D context) { // } // System.err.println("drawing lines " + livingSpace); final double x = livingSpace.getPosC(ug.getStringBounder()).getCurrentValue(); - livingSpace.drawLineAndLiveBoxes(ug.apply(new UTranslate(x, 0)), height, context); + livingSpace.drawLineAndLiveBoxes(ug.apply(UTranslate.dx(x)), height, context); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/MutingLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/MutingLine.java index 40aeddbc4..c40be5c48 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/MutingLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/MutingLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -105,7 +105,7 @@ private void drawInternal(UGraphic ug, Context2D context, double y1, double y2, final Component comp = skin.createComponent(new Style[] { style }, defaultLineType, null, skinParam, null); final Dimension2D dim = comp.getPreferredDimension(ug.getStringBounder()); final Area area = new Area(dim.getWidth(), y2 - y1); - comp.drawU(ug.apply(new UTranslate(0, y1)), area, context); + comp.drawU(ug.apply(UTranslate.dy(y1)), area, context); } public void delayOn(double y, double height) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/NewpageTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/NewpageTile.java index 07cc1a859..757dd4414 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/NewpageTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/NewpageTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/NoteTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/NoteTile.java index 58b35c5c5..d1640af8a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/NoteTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/NoteTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -96,9 +96,8 @@ public void drawU(UGraphic ug) { final double x = getX(stringBounder).getCurrentValue(); final Area area = new Area(getUsedWidth(stringBounder), dim.getHeight()); - ug = ug.apply(new UTranslate(x, 0)); + ug = ug.apply(UTranslate.dx(x)); comp.drawU(ug, area, (Context2D) ug); - // ug.draw(new ULine(x2 - x1, 0)); } private double getUsedWidth(StringBounder stringBounder) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java index 0794613d2..073d91af4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -94,7 +94,7 @@ public void drawU(UGraphic ug) { final double x = getX(stringBounder, note).getCurrentValue(); final Area area = new Area(getUsedWidth(stringBounder, note), dim.getHeight()); - final UGraphic ug2 = ug.apply(new UTranslate(x, 0)); + final UGraphic ug2 = ug.apply(UTranslate.dx(x)); comp.drawU(ug2, area, (Context2D) ug2); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpace.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpace.java index 165128c7a..22394531b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpace.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpace.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -105,24 +105,28 @@ public void drawForeground(UGraphic ug) { private double drawUInternal(UGraphic ug, boolean trace) { final StringBounder stringBounder = ug.getStringBounder(); - final List positionedTiles = new ArrayList(); - final double y = GroupingTile.fillPositionelTiles(stringBounder, startingY, tiles, positionedTiles); - for (YPositionedTile tile : positionedTiles) { + final List local = new ArrayList(); + final List full = new ArrayList(); + final double y = GroupingTile.fillPositionelTiles(stringBounder, startingY, tiles, local, full); + for (YPositionedTile tile : local) { tile.drawInArea(ug); } for (LinkAnchor linkAnchor : linkAnchors) { - final YPositionedTile tile1 = getFromAnchor(positionedTiles, linkAnchor.getAnchor1()); - final YPositionedTile tile2 = getFromAnchor(positionedTiles, linkAnchor.getAnchor2()); - linkAnchor.drawAnchor(ug, tile1, tile2, skinParam); + final YPositionedTile ytile1 = getFromAnchor(full, linkAnchor.getAnchor1()); + final YPositionedTile ytile2 = getFromAnchor(full, linkAnchor.getAnchor2()); + if (ytile1 != null && ytile2 != null) { + linkAnchor.drawAnchor(ug, ytile1, ytile2, skinParam); + } } // System.err.println("MainTile::drawUInternal finalY=" + y); return y; } private YPositionedTile getFromAnchor(List positionedTiles, String anchor) { - for (YPositionedTile tile : positionedTiles) { - if (tile.matchAnchor(anchor)) { - return tile; + for (YPositionedTile ytile : positionedTiles) { + final boolean matchAnchorV2 = ytile.matchAnchorV2(anchor); + if (matchAnchorV2) { + return ytile; } } return null; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpaceWithParticipants.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpaceWithParticipants.java index 6c9b93419..f1c62b43f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpaceWithParticipants.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpaceWithParticipants.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,18 +35,17 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.skin.SimpleContext2D; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UClip; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PlayingSpaceWithParticipants extends AbstractTextBlock implements TextBlock { @@ -86,26 +85,26 @@ public void drawU(UGraphic ug) { final double headHeight = livingSpaces.getHeadHeight(stringBounder); if (ymax == 0) { - playingSpace.drawBackground(ug.apply(new UTranslate(0, headHeight))); + playingSpace.drawBackground(ug.apply(UTranslate.dy(headHeight))); } else { final UClip clip = new UClip(-1000, ymin, Double.MAX_VALUE, ymax - ymin + 1); - playingSpace.drawBackground(ug.apply(new UTranslate(0, headHeight)).apply(clip)); + playingSpace.drawBackground(ug.apply(UTranslate.dy(headHeight)).apply(clip)); } - livingSpaces.drawLifeLines(ug.apply(new UTranslate(0, headHeight)), height, context); + livingSpaces.drawLifeLines(ug.apply(UTranslate.dy(headHeight)), height, context); livingSpaces.drawHeads(ug, context, VerticalAlignment.BOTTOM); if (playingSpace.isShowFootbox()) { - livingSpaces.drawHeads(ug.apply(new UTranslate(0, height + headHeight)), context, VerticalAlignment.TOP); + livingSpaces.drawHeads(ug.apply(UTranslate.dy(height + headHeight)), context, VerticalAlignment.TOP); } if (ymax == 0) { - playingSpace.drawForeground(ug.apply(new UTranslate(0, headHeight))); + playingSpace.drawForeground(ug.apply(UTranslate.dy(headHeight))); } else { final UClip clip = new UClip(-1000, ymin, Double.MAX_VALUE, ymax - ymin + 1); - // playingSpace.drawForeground(new UGraphicNewpages(ug.apply(new UTranslate(0, headHeight)), ymin, ymax)); - playingSpace.drawForeground(ug.apply(new UTranslate(0, headHeight)).apply(clip)); + // playingSpace.drawForeground(new UGraphicNewpages(ug.apply(UTranslate.dy(headHeight)), ymin, ymax)); + playingSpace.drawForeground(ug.apply(UTranslate.dy(headHeight)).apply(clip)); } - // drawNewPages(ug.apply(new UTranslate(0, headHeight))); + // drawNewPages(ug.apply(UTranslate.dy(headHeight))); } public Real getMinX(StringBounder stringBounder) { @@ -127,12 +126,12 @@ private List yNewPages() { } private void drawNewPages(UGraphic ug) { - ug = ug.apply(new UChangeColor(HtmlColorUtils.BLUE)); + ug = ug.apply(HColorUtils.BLUE); for (Double change : yNewPages()) { if (change == 0 || change == Double.MAX_VALUE) { continue; } - ug.apply(new UTranslate(0, change)).draw(new ULine(100, 0)); + ug.apply(UTranslate.dy(change)).draw(ULine.hline(100)); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/ReferenceTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/ReferenceTile.java index 94049471f..6653b01bc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/ReferenceTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/ReferenceTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -101,7 +101,7 @@ public void drawU(UGraphic ug) { final Dimension2D dim = comp.getPreferredDimension(stringBounder); final Area area = new Area(last.getCurrentValue() - first.getCurrentValue(), dim.getHeight()); - ug = ug.apply(new UTranslate(first.getCurrentValue(), 0)); + ug = ug.apply(UTranslate.dx(first.getCurrentValue())); comp.drawU(ug, area, (Context2D) ug); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java index a73ceb5f1..3f3bcb944 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -46,7 +46,6 @@ import net.sourceforge.plantuml.cucadiagram.DisplaySection; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -61,13 +60,14 @@ import net.sourceforge.plantuml.sequencediagram.graphic.FileMaker; import net.sourceforge.plantuml.skin.SimpleContext2D; import net.sourceforge.plantuml.skin.rose.Rose; -import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.style.StyleDefinition; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.utils.MathUtils; public class SequenceDiagramFileMakerTeoz implements FileMaker { @@ -76,17 +76,20 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { private final FileFormatOption fileFormatOption; private final Rose skin; private final AnnotatedWorker annotatedWorker; + private final int index; - public SequenceDiagramFileMakerTeoz(SequenceDiagram sequenceDiagram, Rose skin, FileFormatOption fileFormatOption) { + public SequenceDiagramFileMakerTeoz(SequenceDiagram sequenceDiagram, Rose skin, FileFormatOption fileFormatOption, + int index) { + this.index = index; this.stringBounder = fileFormatOption.getDefaultStringBounder(); this.diagram = sequenceDiagram; this.fileFormatOption = fileFormatOption; this.skin = skin; + this.body = new PlayingSpaceWithParticipants(createMainTile()); this.footer = getFooterOrHeader(FontParam.FOOTER); this.header = getFooterOrHeader(FontParam.HEADER); this.annotatedWorker = new AnnotatedWorker(sequenceDiagram, sequenceDiagram.getSkinParam(), stringBounder); - this.body = new PlayingSpaceWithParticipants(createMainTile()); this.min1 = body.getMinX(stringBounder); this.title = getTitle(); @@ -96,15 +99,15 @@ public SequenceDiagramFileMakerTeoz(SequenceDiagram sequenceDiagram, Rose skin, this.heightEnglober1 = englobers.getOffsetForEnglobers(stringBounder); this.heightEnglober2 = heightEnglober1 == 0 ? 0 : 10; - final double totalWidth = MathUtils.max(body.calculateDimension(stringBounder).getWidth(), title - .calculateDimension(stringBounder).getWidth(), footer.calculateDimension(stringBounder).getWidth(), - header.calculateDimension(stringBounder).getWidth(), legend.calculateDimension(stringBounder) - .getWidth()); + final double totalWidth = MathUtils.max(body.calculateDimension(stringBounder).getWidth(), + title.calculateDimension(stringBounder).getWidth(), footer.calculateDimension(stringBounder).getWidth(), + header.calculateDimension(stringBounder).getWidth(), + legend.calculateDimension(stringBounder).getWidth()); final double totalHeight = body.calculateDimension(stringBounder).getHeight() + heightEnglober1 + heightEnglober2 + title.calculateDimension(stringBounder).getHeight() + header.calculateDimension(stringBounder).getHeight() + legend.calculateDimension(stringBounder).getHeight() - + footer.calculateDimension(stringBounder).getHeight(); + + footer.calculateDimension(stringBounder).getHeight() + (annotatedWorker.hasMainFrame() ? 10 : 0); this.dimTotal = new Dimension2DDouble(totalWidth, totalHeight); } @@ -134,13 +137,25 @@ private double oneOf(double a, double b) { } public ImageData createOne(OutputStream os, final int index, boolean isWithMetadata) throws IOException { + if (this.index != index) { + throw new IllegalStateException(); + } final double dpiFactor = diagram.getDpiFactor(fileFormatOption, dimTotal); final double scale = 1; final String metadata = fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null; - final ImageBuilder imageBuilder = new ImageBuilder(diagram.getSkinParam(), oneOf(scale, dpiFactor), metadata, - null, 3, 10, diagram.getAnimation()); + final int margin1; + final int margin2; + if (SkinParam.USE_STYLES()) { + margin1 = SkinParam.zeroMargin(3); + margin2 = SkinParam.zeroMargin(10); + } else { + margin1 = 3; + margin2 = 10; + } + final ImageBuilder imageBuilder = ImageBuilder.buildD(diagram.getSkinParam(), ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), diagram.getAnimation(), metadata, + null, oneOf(scale, dpiFactor)); imageBuilder.setUDrawable(new Foo(index)); return imageBuilder.writeImageTOBEMOVED(fileFormatOption, diagram.seed(), os); @@ -168,11 +183,11 @@ private UGraphic goDownAndCenterForEnglobers(UGraphic ug) { ug = goDown(ug, legend); } final double dx = (dimTotal.getWidth() - body.calculateDimension(stringBounder).getWidth()) / 2; - return ug.apply(new UTranslate(dx, 0)); + return ug.apply(UTranslate.dx(dx)); } private UGraphic goDown(UGraphic ug, TextBlock size) { - return ug.apply(new UTranslate(0, size.calculateDimension(stringBounder).getHeight())); + return ug.apply(UTranslate.dy(size.calculateDimension(stringBounder).getHeight())); } public void printAligned(UGraphic ug, HorizontalAlignment align, final TextBlock layer) { @@ -182,21 +197,21 @@ public void printAligned(UGraphic ug, HorizontalAlignment align, final TextBlock } else if (align == HorizontalAlignment.CENTER) { dx = (dimTotal.getWidth() - layer.calculateDimension(stringBounder).getWidth()) / 2; } - layer.drawU(ug.apply(new UTranslate(dx, 0))); + layer.drawU(ug.apply(UTranslate.dx(dx))); } private PlayingSpace createMainTile() { final RealOrigin origin = RealUtils.createOrigin(); Real currentPos = origin.addAtLeast(0); for (Participant p : diagram.participants()) { - final LivingSpace livingSpace = new LivingSpace(p, diagram.getEnglober(p), skin, getSkinParam(), - currentPos, diagram.events()); + final LivingSpace livingSpace = new LivingSpace(p, diagram.getEnglober(p), skin, getSkinParam(), currentPos, + diagram.events()); livingSpaces.put(p, livingSpace); currentPos = livingSpace.getPosD(stringBounder).addAtLeast(0); } - final TileArguments tileArguments = new TileArguments(stringBounder, livingSpaces, skin, - diagram.getSkinParam(), origin); + final TileArguments tileArguments = new TileArguments(stringBounder, livingSpaces, skin, diagram.getSkinParam(), + origin); this.englobers = new Englobers(tileArguments); final PlayingSpace mainTile = new PlayingSpace(diagram, englobers, tileArguments); @@ -218,13 +233,13 @@ private TextBlock getTitle() { } final TextBlock compTitle; if (SkinParam.USE_STYLES()) { - final Style style = StyleDefinition.of(SName.root, SName.title).getMergedStyle( - diagram.getSkinParam().getCurrentStyleBuilder()); - compTitle = style.createTextBlockBordered(diagram.getTitle().getDisplay(), diagram.getSkinParam() - .getIHtmlColorSet(), diagram.getSkinParam()); + final Style style = StyleSignature.of(SName.root, SName.title) + .getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder()); + compTitle = style.createTextBlockBordered(diagram.getTitle().getDisplay(), + diagram.getSkinParam().getIHtmlColorSet(), diagram.getSkinParam()); return compTitle; } else { - compTitle = TextBlockUtils.title(new FontConfiguration(getSkinParam(), FontParam.SEQUENCE_TITLE, null), + compTitle = TextBlockUtils.title(new FontConfiguration(getSkinParam(), FontParam.TITLE, null), diagram.getTitle().getDisplay(), getSkinParam()); return TextBlockUtils.withMargin(compTitle, 7, 7); } @@ -242,15 +257,15 @@ public TextBlock getFooterOrHeader(final FontParam param) { if (diagram.getFooterOrHeaderTeoz(param).isNull()) { return new TeozLayer(null, stringBounder, param); } - final DisplaySection display = diagram.getFooterOrHeaderTeoz(param); - final HtmlColor hyperlinkColor = getSkinParam().getHyperlinkColor(); - final HtmlColor titleColor = getSkinParam().getFontHtmlColor(null, param); + final DisplaySection display = diagram.getFooterOrHeaderTeoz(param).withPage(index + 1, getNbPages()); + final HColor hyperlinkColor = getSkinParam().getHyperlinkColor(); + final HColor titleColor = getSkinParam().getFontHtmlColor(null, param); final String fontFamily = getSkinParam().getFont(null, false, param).getFamily(null); final int fontSize = getSkinParam().getFont(null, false, param).getSize(); Style style = null; final ISkinParam skinParam = diagram.getSkinParam(); if (SkinParam.USE_STYLES()) { - final StyleDefinition def = param.getStyleDefinition(); + final StyleSignature def = param.getStyleDefinition(null); style = def.getMergedStyle(skinParam.getCurrentStyleBuilder()); } final PngTitler pngTitler = new PngTitler(titleColor, display, fontSize, fontFamily, hyperlinkColor, @@ -264,20 +279,21 @@ public int getNbPages() { private void drawInternal(UGraphic ug, int index) { body.setIndex(index); - final UTranslate min1translate = new UTranslate(-min1.getCurrentValue(), 0); + final UTranslate min1translate = UTranslate.dx(-min1.getCurrentValue()); ug = ug.apply(min1translate); - englobers.drawEnglobers(goDownAndCenterForEnglobers(ug), body.calculateDimension(stringBounder).getHeight() - + heightEnglober1 + heightEnglober2 / 2, new SimpleContext2D(true)); + englobers.drawEnglobers(goDownAndCenterForEnglobers(ug), + body.calculateDimension(stringBounder).getHeight() + heightEnglober1 + heightEnglober2 / 2, + new SimpleContext2D(true)); printAligned(ug, diagram.getFooterOrHeaderTeoz(FontParam.HEADER).getHorizontalAlignment(), header); ug = goDown(ug, header); HorizontalAlignment titleAlignment = HorizontalAlignment.CENTER; if (SkinParam.USE_STYLES()) { - final StyleDefinition def = FontParam.TITLE.getStyleDefinition(); + final StyleSignature def = FontParam.TITLE.getStyleDefinition(null); titleAlignment = def.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder()) - .value(PName.HorizontalAlignment).asHorizontalAlignment(); + .getHorizontalAlignment(); } printAligned(ug, titleAlignment, title); ug = goDown(ug, title); @@ -287,10 +303,12 @@ private void drawInternal(UGraphic ug, int index) { ug = goDown(ug, legend); } - ug = ug.apply(new UTranslate(0, heightEnglober1)); - printAligned(ug, HorizontalAlignment.CENTER, body); - ug = goDown(ug, body); - ug = ug.apply(new UTranslate(0, heightEnglober2)); + ug = ug.apply(UTranslate.dy(heightEnglober1)); + final TextBlock bodyFramed = annotatedWorker.addFrame(body); + printAligned(ug.apply(UTranslate.dx((annotatedWorker.hasMainFrame() ? 4 : 0))), HorizontalAlignment.CENTER, + bodyFramed); + ug = goDown(ug, bodyFramed); + ug = ug.apply(UTranslate.dy(heightEnglober2)); printAligned(ug, HorizontalAlignment.CENTER, caption); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/Stairs2.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/Stairs2.java index 32494cb87..25c63f94e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/Stairs2.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/Stairs2.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/StairsPosition.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/StairsPosition.java index 787282f58..c4e66312a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/StairsPosition.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/StairsPosition.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TeozLayer.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TeozLayer.java index 20a0150f1..60207bc05 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TeozLayer.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TeozLayer.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/Tile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/Tile.java index 5659e5340..5560dfbe7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/Tile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/Tile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -52,7 +52,7 @@ public interface Tile extends UDrawable, UShape { public double getZ(StringBounder stringBounder); - public boolean matchAnchor(String anchor); + public boolean matchAnchorV1(String anchor); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileArguments.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileArguments.java index f2697ea40..2b2fa620b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileArguments.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileArguments.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,12 +33,12 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.SkinParamBackcoloredReference; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.Reference; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class TileArguments implements Bordered { private final StringBounder stringBounder; @@ -56,7 +56,7 @@ public TileArguments(StringBounder stringBounder, LivingSpaces livingSpaces, Ros this.skinParam = skinParam; } - public TileArguments withBackColorGeneral(HtmlColor backColorElement, HtmlColor backColorGeneral) { + public TileArguments withBackColorGeneral(HColor backColorElement, HColor backColorGeneral) { return new TileArguments(stringBounder, livingSpaces, skin, new SkinParamBackcolored(skinParam, backColorElement, backColorGeneral), origin); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java index a75d816c5..694cf08fd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -102,6 +102,12 @@ public static List buildOne(Iterator it, TileArguments tileArgument } else if (notePosition == NotePosition.RIGHT) { result = new CommunicationTileNoteRight((TileWithUpdateStairs) result, msg, skin, skinParam, reverse ? livingSpace1 : livingSpace2, noteOnMessage); + } else if (notePosition == NotePosition.BOTTOM) { + result = new CommunicationTileNoteBottom((TileWithUpdateStairs) result, msg, skin, skinParam, + noteOnMessage); + } else if (notePosition == NotePosition.TOP) { + result = new CommunicationTileNoteTop((TileWithUpdateStairs) result, msg, skin, skinParam, + noteOnMessage); } } tiles.add(result); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileMarged.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileMarged.java index 20718e427..a556d3a40 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileMarged.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileMarged.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileParallel.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileParallel.java index f4b253afd..cbaa53608 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileParallel.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileParallel.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -72,8 +72,9 @@ public void drawU(UGraphic ug) { final double yPointAll = getYPoint(stringBounder); for (Tile tile : tiles) { final double yPoint = tile.getYPoint(stringBounder); - // tile.drawU(ug.apply(new UTranslate(0, totalHeight - tile.getPreferredHeight(stringBounder)))); - tile.drawU(ug.apply(new UTranslate(0, yPointAll - yPoint))); + // tile.drawU(ug.apply(UTranslate.dy(totalHeight - + // tile.getPreferredHeight(stringBounder)))); + tile.drawU(ug.apply(UTranslate.dy(yPointAll - yPoint))); } } @@ -159,9 +160,9 @@ public Event getEvent() { return null; } - public boolean matchAnchor(String anchor) { + public boolean matchAnchorV1(String anchor) { for (Tile tile : tiles) { - if (tile.matchAnchor(anchor)) { + if (tile.matchAnchorV1(anchor)) { return true; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileUtils.java index c5a4570b8..ad26bfe18 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileWithCallbackY.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileWithCallbackY.java index 4dbbbfa04..d70b8934c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileWithCallbackY.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileWithCallbackY.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileWithUpdateStairs.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileWithUpdateStairs.java index e6cfceb64..495b550cb 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileWithUpdateStairs.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/TileWithUpdateStairs.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/UGraphicInterceptorTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/UGraphicInterceptorTile.java index 8ac39be90..6567b57e8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/UGraphicInterceptorTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/UGraphicInterceptorTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/UGraphicNewpages.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/UGraphicNewpages.java index d7bec01ce..6d19dd004 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/UGraphicNewpages.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/UGraphicNewpages.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/YPositionedTile.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/YPositionedTile.java index a3fde5901..0dac7fb48 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/YPositionedTile.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sequencediagram/teoz/YPositionedTile.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -58,11 +58,12 @@ public String toString() { public void drawInArea(UGraphic ug) { // System.err.println("YPositionedTile::drawU y=" + y + " " + tile); - ug.apply(new UTranslate(0, y)).draw(tile); + ug.apply(UTranslate.dy(y)).draw(tile); } - public boolean matchAnchor(String anchor) { - return tile.matchAnchor(anchor); + public boolean matchAnchorV2(String anchor) { + final boolean result = tile.matchAnchorV1(anchor); + return result; } public final double getY(StringBounder stringBounder) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/AbstractComponent.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/AbstractComponent.java index f23a99a80..80b76f739 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/AbstractComponent.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/AbstractComponent.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,7 +35,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.style.StyleDefinition; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -45,7 +45,7 @@ public final Style[] getUsedStyles() { throw new UnsupportedOperationException(); } - public StyleDefinition getDefaultStyleDefinition() { + public StyleSignature getDefaultStyleDefinition() { throw new UnsupportedOperationException(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java index 71067bf60..495c5f6cc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,22 +36,20 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.cucadiagram.BodyEnhanced2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockEmpty; -import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.PName; -import net.sourceforge.plantuml.style.StyleKind; +import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; public abstract class AbstractTextualComponent extends AbstractComponent { @@ -65,11 +63,11 @@ public abstract class AbstractTextualComponent extends AbstractComponent { private final ISkinSimple spriteContainer; private final UFont font; - private final HtmlColor fontColor; + private final HColor fontColor; public AbstractTextualComponent(Style style, LineBreakStrategy maxMessageSize, CharSequence label, FontConfiguration font, HorizontalAlignment horizontalAlignment, int marginX1, int marginX2, int marginY, - ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) { + ISkinSimple spriteContainer, UFont fontForStereotype, HColor htmlColorForStereotype) { this(style, style, maxMessageSize, Display.getWithNewlines(label == null ? "" : label.toString()), font, horizontalAlignment, marginX1, marginX2, marginY, spriteContainer, false, fontForStereotype, htmlColorForStereotype); @@ -77,33 +75,33 @@ public AbstractTextualComponent(Style style, LineBreakStrategy maxMessageSize, C public AbstractTextualComponent(Style style, LineBreakStrategy maxMessageSize, Display display, FontConfiguration fc, HorizontalAlignment horizontalAlignment, int marginX1, int marginX2, int marginY, - ISkinSimple spriteContainer, boolean enhanced, UFont fontForStereotype, HtmlColor htmlColorForStereotype) { + ISkinSimple spriteContainer, boolean enhanced, UFont fontForStereotype, HColor htmlColorForStereotype) { this(style, style, maxMessageSize, display, fc, horizontalAlignment, marginX1, marginX2, marginY, spriteContainer, enhanced, fontForStereotype, htmlColorForStereotype); } public AbstractTextualComponent(Style style, Style stereo, LineBreakStrategy maxMessageSize, Display display, FontConfiguration fc, HorizontalAlignment horizontalAlignment, int marginX1, int marginX2, int marginY, - ISkinSimple spriteContainer, boolean enhanced, UFont fontForStereotype, HtmlColor htmlColorForStereotype) { + ISkinSimple spriteContainer, boolean enhanced, UFont fontForStereotype, HColor htmlColorForStereotype) { super(style); this.spriteContainer = spriteContainer; - boolean keepStereotype = true; if (SkinParam.USE_STYLES()) { fc = style.getFontConfiguration(getIHtmlColorSet()); this.font = style.getUFont(); this.fontColor = style.value(PName.FontColor).asColor(getIHtmlColorSet()); - horizontalAlignment = style.value(PName.HorizontalAlignment).asHorizontalAlignment(); + horizontalAlignment = style.getHorizontalAlignment(); fontForStereotype = stereo.getUFont(); htmlColorForStereotype = stereo.value(PName.FontColor).asColor(getIHtmlColorSet()); - keepStereotype = style.getKind() == StyleKind.STEREOTYPE; + this.display = display.withoutStereotypeIfNeeded(style); } else { this.font = fc.getFont(); this.fontColor = fc.getColor(); + this.display = display; } this.marginX1 = marginX1; this.marginX2 = marginX2; this.marginY = marginY; - this.display = keepStereotype ? display : display.withoutStereotype(); + // this.display = keepStereotype ? display : display.withoutStereotype(); if (this.display.size() == 1 && this.display.get(0).length() == 0) { textBlock = new TextBlockEmpty(); @@ -111,12 +109,12 @@ public AbstractTextualComponent(Style style, Style stereo, LineBreakStrategy max textBlock = new BodyEnhanced2(this.display, FontParam.NOTE, spriteContainer, horizontalAlignment, fc, maxMessageSize); } else { - textBlock = this.display.create(fc, horizontalAlignment, spriteContainer, maxMessageSize, CreoleMode.FULL, + textBlock = this.display.create0(fc, horizontalAlignment, spriteContainer, maxMessageSize, CreoleMode.FULL, fontForStereotype, htmlColorForStereotype); } } - protected IHtmlColorSet getIHtmlColorSet() { + protected HColorSet getIHtmlColorSet() { return ((ISkinParam) spriteContainer).getIHtmlColorSet(); } @@ -156,7 +154,7 @@ final protected UFont getFont() { return font; } - protected HtmlColor getFontColor() { + protected HColor getFontColor() { return fontColor; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ActorAwesome.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ActorAwesome.java new file mode 100644 index 000000000..d44adb731 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ActorAwesome.java @@ -0,0 +1,106 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.skin; + +import java.awt.geom.Dimension2D; + +import net.sourceforge.plantuml.Dimension2DDouble; +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.ugraphic.UEllipse; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UPath; +import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.UTranslate; + +public class ActorAwesome extends AbstractTextBlock implements TextBlock { + + private final double headDiam = 32; + private final double bodyWidth = 54; + private final double shoulder = 16; + private final double collar = 4; + private final double radius = 8; + private final double bodyHeight = 28; + + private final SymbolContext symbolContext; + + public ActorAwesome(SymbolContext symbolContext) { + this.symbolContext = symbolContext.withStroke(new UStroke(1.5)); + } + + public void drawU(UGraphic ug) { + + final UEllipse head = new UEllipse(headDiam, headDiam); + final double centerX = getPreferredWidth() / 2; + + final UPath path = new UPath(); + path.moveTo(0, collar); + path.cubicTo(collar, collar, bodyWidth / 2 - shoulder - collar, collar, bodyWidth / 2 - shoulder, 0); + path.cubicTo(bodyWidth / 2 - shoulder / 2, 0, bodyWidth / 2, shoulder / 2, bodyWidth / 2, shoulder); + path.lineTo(bodyWidth / 2, bodyHeight - radius); + path.cubicTo(bodyWidth / 2, bodyHeight - radius / 2, bodyWidth / 2 - radius / 2, bodyHeight, bodyWidth / 2 + - radius, bodyHeight); + path.lineTo(-bodyWidth / 2 + radius, bodyHeight); + path.cubicTo(-bodyWidth / 2 + radius / 2, bodyHeight, -bodyWidth / 2, bodyHeight - radius / 2, -bodyWidth / 2, + bodyHeight - radius); + path.lineTo(-bodyWidth / 2, shoulder); + path.cubicTo(-bodyWidth / 2, shoulder / 2, -bodyWidth / 2 + shoulder / 2, 0, -bodyWidth / 2 + shoulder, 0); + path.cubicTo(-bodyWidth / 2 + shoulder + collar, collar, -collar, collar, 0, collar); + path.closePath(); + + if (symbolContext.getDeltaShadow() != 0) { + head.setDeltaShadow(symbolContext.getDeltaShadow()); + path.setDeltaShadow(symbolContext.getDeltaShadow()); + } + ug = symbolContext.apply(ug); + ug.apply(new UTranslate(centerX - head.getWidth() / 2, thickness())).draw(head); + ug.apply(new UTranslate(centerX, head.getHeight() + thickness())).draw(path); + + } + + private double thickness() { + return symbolContext.getStroke().getThickness(); + } + + public double getPreferredWidth() { + return bodyWidth + thickness() * 2; + } + + public double getPreferredHeight() { + return headDiam + bodyHeight + thickness() * 2; + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return new Dimension2DDouble(getPreferredWidth(), getPreferredHeight()); + } +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/StickMan.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ActorStickMan.java similarity index 79% rename from src/plantuml-asl/src/net/sourceforge/plantuml/skin/StickMan.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/skin/ActorStickMan.java index 04a11362a..3e4a534b5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/StickMan.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ActorStickMan.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,18 +34,16 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPath; -import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; -public class StickMan extends AbstractTextBlock implements TextBlock { +public class ActorStickMan extends AbstractTextBlock implements TextBlock { private final double armsY = 8; private final double armsLenght = 13; @@ -56,19 +54,10 @@ public class StickMan extends AbstractTextBlock implements TextBlock { private final SymbolContext symbolContext; - public StickMan(SymbolContext symbolContext) { + ActorStickMan(SymbolContext symbolContext) { this.symbolContext = symbolContext; } - private StickMan(HtmlColor backgroundColor, HtmlColor foregroundColor, double deltaShadow) { - this(new SymbolContext(backgroundColor, foregroundColor).withDeltaShadow(deltaShadow) - .withStroke(new UStroke(2))); - } - - public StickMan(HtmlColor backgroundColor, HtmlColor foregroundColor) { - this(new SymbolContext(backgroundColor, foregroundColor).withStroke(new UStroke(2))); - } - public void drawU(UGraphic ug) { final double startX = Math.max(armsLenght, legsX) - headDiam / 2.0 + thickness(); @@ -92,7 +81,7 @@ public void drawU(UGraphic ug) { ug = symbolContext.apply(ug); ug.apply(new UTranslate(startX, thickness())).draw(head); - ug.apply(new UTranslate(centerX, headDiam + thickness())).apply(new UChangeBackColor(null)).draw(path); + ug.apply(new UTranslate(centerX, headDiam + thickness())).apply(new HColorNone().bg()).draw(path); } private double thickness() { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ActorStyle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ActorStyle.java new file mode 100644 index 000000000..cb3e3ff3e --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ActorStyle.java @@ -0,0 +1,59 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.skin; + +import net.sourceforge.plantuml.graphic.SymbolContext; +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.USymbol; + +public enum ActorStyle { + + STICKMAN, AWESOME; + + public USymbol toUSymbol() { + if (this == STICKMAN) { + return USymbol.ACTOR_STICKMAN; + } else if (this == AWESOME) { + return USymbol.ACTOR_AWESOME; + } + throw new IllegalStateException(); + } + + public TextBlock getTextBlock(SymbolContext symbolContext) { + if (this == STICKMAN) { + return new ActorStickMan(symbolContext); + } else if (this == AWESOME) { + return new ActorAwesome(symbolContext); + } + throw new IllegalStateException(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/Area.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/Area.java index d68feb7f8..931e809b5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/Area.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/Area.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowBody.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowBody.java index 99ecb17e4..31725eb1f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowBody.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowBody.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowComponent.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowComponent.java index a58df115c..e3b98bfbd 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowComponent.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowComponent.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowConfiguration.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowConfiguration.java index 0cccc977d..6b006a362 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowConfiguration.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowConfiguration.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,9 +30,9 @@ */ package net.sourceforge.plantuml.skin; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ArrowConfiguration { @@ -44,14 +44,14 @@ public class ArrowConfiguration { private final ArrowDecoration decoration1; private final ArrowDecoration decoration2; - private final HtmlColor color; + private final HColor color; private final boolean isSelf; private final double thickness; private final boolean reverseDefine; private ArrowConfiguration(ArrowBody body, ArrowDressing dressing1, ArrowDressing dressing2, - ArrowDecoration decoration1, ArrowDecoration decoration2, HtmlColor color, boolean isSelf, + ArrowDecoration decoration1, ArrowDecoration decoration2, HColor color, boolean isSelf, double thickness, boolean reverseDefine) { if (body == null || dressing1 == null || dressing2 == null) { throw new IllegalArgumentException(); @@ -156,7 +156,7 @@ public ArrowConfiguration withDecoration2(ArrowDecoration decoration2) { reverseDefine); } - public ArrowConfiguration withColor(HtmlColor color) { + public ArrowConfiguration withColor(HColor color) { return new ArrowConfiguration(body, dressing1, dressing2, decoration1, decoration2, color, isSelf, thickness, reverseDefine); } @@ -212,7 +212,7 @@ public final ArrowPart getPart() { return dressing1.getPart(); } - public HtmlColor getColor() { + public HColor getColor() { return color; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowDecoration.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowDecoration.java index c5c46effc..f2b01e369 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowDecoration.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowDecoration.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowDirection.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowDirection.java index ca067cc32..3947a0079 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowDirection.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowDirection.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowDressing.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowDressing.java index 5d331c260..67cf37088 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowDressing.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowDressing.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowHead.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowHead.java index a03186405..f6abec1d9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowHead.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowHead.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowPart.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowPart.java index 13e920bb9..f8ba427e5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowPart.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ArrowPart.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/CircleInterface.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/CircleInterface.java index 31f3ef3b6..74f5d1811 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/CircleInterface.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/CircleInterface.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,28 +30,26 @@ */ package net.sourceforge.plantuml.skin; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CircleInterface implements UDrawable { private final float thickness; private final double headDiam; - private final HtmlColor backgroundColor; - private final HtmlColor foregroundColor; + private final HColor backgroundColor; + private final HColor foregroundColor; - public CircleInterface(HtmlColor backgroundColor, HtmlColor foregroundColor) { + public CircleInterface(HColor backgroundColor, HColor foregroundColor) { this(backgroundColor, foregroundColor, 16, 2); } - public CircleInterface(HtmlColor backgroundColor, HtmlColor foregroundColor, double headDiam, float thickness) { + public CircleInterface(HColor backgroundColor, HColor foregroundColor, double headDiam, float thickness) { this.backgroundColor = backgroundColor; this.foregroundColor = foregroundColor; this.headDiam = headDiam; @@ -61,8 +59,8 @@ public CircleInterface(HtmlColor backgroundColor, HtmlColor foregroundColor, dou public void drawU(UGraphic ug) { final UEllipse head = new UEllipse(headDiam, headDiam); - ug.apply(new UStroke(thickness)).apply(new UChangeBackColor(backgroundColor)) - .apply(new UChangeColor(foregroundColor)).apply(new UTranslate((double) thickness, (double) thickness)).draw(head); + ug.apply(new UStroke(thickness)).apply(backgroundColor.bg()) + .apply(foregroundColor).apply(new UTranslate((double) thickness, (double) thickness)).draw(head); } public double getPreferredWidth(StringBounder stringBounder) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/Component.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/Component.java index 8a45a457d..fc87e4a06 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/Component.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/Component.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ComponentType.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ComponentType.java index 77a364292..e2aad5c28 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ComponentType.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/ComponentType.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,11 +30,10 @@ */ package net.sourceforge.plantuml.skin; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.Styleable; -import net.sourceforge.plantuml.style.StyleDefinition; public enum ComponentType implements Styleable { @@ -66,52 +65,52 @@ public boolean isArrow() { return this == ARROW; } - public StyleDefinition getDefaultStyleDefinition() { + public StyleSignature getDefaultStyleDefinition() { if (this == PARTICIPANT_HEAD || this == PARTICIPANT_TAIL) { - return StyleDefinition.of(SName.root, SName.element, + return StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, SName.participant); } if (this == PARTICIPANT_LINE || this == CONTINUE_LINE) { - return StyleDefinition.of(SName.root, SName.element, - SName.sequenceDiagram); + return StyleSignature.of(SName.root, SName.element, + SName.sequenceDiagram, SName.lifeLine); } if (this == ALIVE_BOX_CLOSE_CLOSE || this == ALIVE_BOX_CLOSE_OPEN || this == ALIVE_BOX_OPEN_CLOSE || this == ALIVE_BOX_OPEN_OPEN) { - return StyleDefinition.of(SName.root, SName.element, + return StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, SName.lifeLine); } if (this == DESTROY) { - return StyleDefinition.of(SName.root, SName.element, + return StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, SName.lifeLine); } if (this == DIVIDER) { - return StyleDefinition.of(SName.root, SName.element, + return StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, SName.separator); } if (this == ENGLOBER) { - return StyleDefinition.of(SName.root, SName.element, + return StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, SName.box); } if (this == NOTE) { - return StyleDefinition.of(SName.root, SName.element, + return StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, SName.note); } if (this == DELAY_TEXT) { - return StyleDefinition.of(SName.root, SName.element, + return StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, SName.delay); } if (this == DELAY_LINE) { - return StyleDefinition.of(SName.root, SName.element, + return StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, SName.delay); } - if (this == REFERENCE) { - return StyleDefinition.of(SName.root, SName.element, - SName.sequenceDiagram, SName.reference); - } +// if (this == REFERENCE) { +// return StyleSignature.of(SName.root, SName.element, +// SName.sequenceDiagram, SName.reference); +// } if (SkinParam.USE_STYLES()) { throw new UnsupportedOperationException(toString()); } - return StyleDefinition.of(SName.root); + return StyleSignature.of(SName.root); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/Context2D.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/Context2D.java index 29157dfec..670f61189 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/Context2D.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/Context2D.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/Padder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/Padder.java index 6cd588731..10b82119e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/Padder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/Padder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,21 +34,20 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; 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.HColorNone; public class Padder { private final double margin; private final double padding; - private final HtmlColor backgroundColor; - private final HtmlColor borderColor; + private final HColor backgroundColor; + private final HColor borderColor; private final double roundCorner; public static final Padder NONE = new Padder(0, 0, null, null, 0); @@ -58,7 +57,7 @@ public String toString() { return "" + margin + "/" + padding + "/" + borderColor + "/" + backgroundColor; } - private Padder(double margin, double padding, HtmlColor backgroundColor, HtmlColor borderColor, double roundCorner) { + private Padder(double margin, double padding, HColor backgroundColor, HColor borderColor, double roundCorner) { this.margin = margin; this.padding = padding; this.borderColor = borderColor; @@ -74,11 +73,11 @@ public Padder withPadding(double padding) { return new Padder(margin, padding, backgroundColor, borderColor, roundCorner); } - public Padder withBackgroundColor(HtmlColor backgroundColor) { + public Padder withBackgroundColor(HColor backgroundColor) { return new Padder(margin, padding, backgroundColor, borderColor, roundCorner); } - public Padder withBorderColor(HtmlColor borderColor) { + public Padder withBorderColor(HColor borderColor) { return new Padder(margin, padding, backgroundColor, borderColor, roundCorner); } @@ -94,11 +93,11 @@ public final double getPadding() { return padding; } - public final HtmlColor getBackgroundColor() { + public final HColor getBackgroundColor() { return backgroundColor; } - public final HtmlColor getBorderColor() { + public final HColor getBorderColor() { return borderColor; } @@ -113,11 +112,20 @@ public Dimension2D calculateDimension(StringBounder stringBounder) { public void drawU(UGraphic ug) { ug = ug.apply(new UTranslate(margin, margin)); - final UGraphic ug2 = ug.apply(new UChangeBackColor(backgroundColor)).apply( - new UChangeColor(borderColor)); + UGraphic ug2 = ug; + if (borderColor == null) { + ug2 = ug2.apply(new HColorNone()); + } else { + ug2 = ug2.apply(borderColor); + } + if (backgroundColor == null) { + ug2 = ug2.apply(new HColorNone().bg()); + } else { + ug2 = ug2.apply(backgroundColor.bg()); + } final Dimension2D originalDim = orig.calculateDimension(ug.getStringBounder()); - final URectangle rect = new URectangle(Dimension2DDouble.delta(originalDim, 2 * padding), roundCorner, - roundCorner); + final URectangle rect = new URectangle(Dimension2DDouble.delta(originalDim, 2 * padding)) + .rounded(roundCorner); ug2.draw(rect); orig.drawU(ug.apply(new UTranslate(padding, padding))); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/SimpleContext2D.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/SimpleContext2D.java index f979cef83..d002a7d56 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/SimpleContext2D.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/SimpleContext2D.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/VisibilityModifier.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/VisibilityModifier.java index 430005c81..feab8f386 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/VisibilityModifier.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/VisibilityModifier.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -36,27 +36,26 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; 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.HColorNone; public enum VisibilityModifier { - PRIVATE_FIELD(ColorParam.iconPrivate, null), PROTECTED_FIELD(ColorParam.iconProtected, null), PACKAGE_PRIVATE_FIELD( - ColorParam.iconPackage, null), PUBLIC_FIELD(ColorParam.iconPublic, null), + PRIVATE_FIELD(ColorParam.iconPrivate, null), PROTECTED_FIELD(ColorParam.iconProtected, null), + PACKAGE_PRIVATE_FIELD(ColorParam.iconPackage, null), PUBLIC_FIELD(ColorParam.iconPublic, null), - PRIVATE_METHOD(ColorParam.iconPrivate, ColorParam.iconPrivateBackground), PROTECTED_METHOD( - ColorParam.iconProtected, ColorParam.iconProtectedBackground), PACKAGE_PRIVATE_METHOD( - ColorParam.iconPackage, ColorParam.iconPackageBackground), PUBLIC_METHOD(ColorParam.iconPublic, - ColorParam.iconPublicBackground), + PRIVATE_METHOD(ColorParam.iconPrivate, ColorParam.iconPrivateBackground), + PROTECTED_METHOD(ColorParam.iconProtected, ColorParam.iconProtectedBackground), + PACKAGE_PRIVATE_METHOD(ColorParam.iconPackage, ColorParam.iconPackageBackground), + PUBLIC_METHOD(ColorParam.iconPublic, ColorParam.iconPublicBackground), IE_MANDATORY(ColorParam.iconIEMandatory, ColorParam.iconIEMandatory); @@ -72,7 +71,7 @@ private VisibilityModifier(ColorParam foreground, ColorParam background) { this.backgroundParam = background; } - public UDrawable getUDrawable(final int size, final HtmlColor foregroundColor, final HtmlColor backgoundColor) { + public UDrawable getUDrawable(final int size, final HColor foregroundColor, final HColor backgoundColor) { return new UDrawable() { public void drawU(UGraphic ug) { drawInternal(ug, size, foregroundColor, backgoundColor, 0, 0); @@ -81,7 +80,7 @@ public void drawU(UGraphic ug) { }; } - public TextBlock getUBlock(final int size, final HtmlColor foregroundColor, final HtmlColor backgoundColor, + public TextBlock getUBlock(final int size, final HColor foregroundColor, final HColor backgoundColor, final boolean withInvisibleRectanble) { return new AbstractTextBlock() { @@ -96,16 +95,21 @@ public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, public void drawU(UGraphic ug) { if (withInvisibleRectanble) { - ug.apply(new UChangeColor(null)).draw(new URectangle(size * 2, size)); + ug.apply(new HColorNone()).draw(new URectangle(size * 2, size)); } drawInternal(ug, size, foregroundColor, backgoundColor, 0, 0); } }; } - private void drawInternal(UGraphic ug, int size, final HtmlColor foregroundColor, final HtmlColor backgoundColor, + private void drawInternal(UGraphic ug, int size, final HColor foregroundColor, final HColor backgoundColor, double x, double y) { - ug = ug.apply(new UChangeBackColor(backgoundColor)).apply(new UChangeColor(foregroundColor)); + if (backgoundColor == null) { + ug = ug.apply(new HColorNone().bg()); + } else { + ug = ug.apply(backgoundColor.bg()); + } + ug = ug.apply(foregroundColor); size = ensureEven(size); switch (this) { case PACKAGE_PRIVATE_FIELD: diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/bluemodern/FillRoundShape.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/bluemodern/FillRoundShape.java deleted file mode 100644 index 62eacc155..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/bluemodern/FillRoundShape.java +++ /dev/null @@ -1,75 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.skin.bluemodern; - -import java.awt.GradientPaint; -import java.awt.Graphics2D; -import java.awt.geom.RoundRectangle2D; - -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; -import net.sourceforge.plantuml.ugraphic.ColorMapper; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.URectangle; - -public class FillRoundShape { - - final private double width; - final private double height; - final private double corner; - final private HtmlColor c1; - final private HtmlColor c2; - - public FillRoundShape(double width, double height, HtmlColor c1, HtmlColor c2, double corner) { - this.width = width; - this.height = height; - this.c1 = c1; - this.c2 = c2; - this.corner = corner; - - } - - public void draw(ColorMapper mapper, Graphics2D g2d) { - final GradientPaint paint = new GradientPaint(0, 0, mapper.getMappedColor(c1), (float) width, (float) height, - mapper.getMappedColor(c2)); - final RoundRectangle2D r = new RoundRectangle2D.Double(0, 0, width, height, corner * 2, corner * 2); - g2d.setPaint(paint); - g2d.fill(r); - } - - public void drawU(UGraphic ug) { - final HtmlColorGradient gradient = new HtmlColorGradient(c1, c2, '\\'); - final URectangle r = new URectangle(width, height, corner * 2, corner * 2); - ug.apply(new UChangeBackColor(gradient)).draw(r); - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java index bd0b4b0c3..3616832df 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -33,52 +33,54 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.ArrowComponent; import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.skin.Padder; -import net.sourceforge.plantuml.style.Style; 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; public abstract class AbstractComponentRoseArrow extends AbstractTextualComponent implements ArrowComponent { private final int arrowDeltaX = 10; private final int arrowDeltaY = 4; - private final HtmlColor foregroundColor; + private final HColor foregroundColor; private final ArrowConfiguration arrowConfiguration; - public AbstractComponentRoseArrow(Style style, HtmlColor foregroundColor, FontConfiguration font, + public AbstractComponentRoseArrow(Style style, HColor foregroundColor, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer, HorizontalAlignment textHorizontalAlignment, LineBreakStrategy maxMessageSize) { super(style, maxMessageSize, stringsToDisplay, font, textHorizontalAlignment, 7, 7, 1, spriteContainer, false, null, null); - this.arrowConfiguration = arrowConfiguration; if (SkinParam.USE_STYLES()) { this.foregroundColor = style.value(PName.LineColor).asColor(getIHtmlColorSet()); + final UStroke stroke = style.getStroke(); + this.arrowConfiguration = arrowConfiguration.withThickness(stroke.getThickness()); } else { this.foregroundColor = foregroundColor; + this.arrowConfiguration = arrowConfiguration; } } @Override final protected TextBlock getTextBlock() { final Padder padder = getISkinSimple() instanceof ISkinParam ? ((ISkinParam) getISkinSimple()) - .getSequenceDiagramPadder() : Padder.NONE; + .sequenceDiagramPadder() : Padder.NONE; return padder.apply(super.getTextBlock()); } abstract public double getYPoint(StringBounder stringBounder); - protected final HtmlColor getForegroundColor() { + protected final HColor getForegroundColor() { return foregroundColor; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java index 16636b2b5..951fe56a8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,20 +32,17 @@ import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.AbstractComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; 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 ComponentRoseActiveLine extends AbstractComponent { @@ -54,7 +51,7 @@ public class ComponentRoseActiveLine extends AbstractComponent { private final boolean closeDown; public ComponentRoseActiveLine(Style style, SymbolContext symbolContext, boolean closeUp, boolean closeDown, - IHtmlColorSet set) { + HColorSet set) { super(style); if (SkinParam.USE_STYLES()) { symbolContext = style.getSymbolContext(set); @@ -69,25 +66,29 @@ protected void drawInternalU(UGraphic ug, Area area) { final StringBounder stringBounder = ug.getStringBounder(); final int x = (int) (dimensionToUse.getWidth() - getPreferredWidth(stringBounder)) / 2; + if (dimensionToUse.getHeight() == 0) { + return; + } + final URectangle rect = new URectangle(getPreferredWidth(stringBounder), dimensionToUse.getHeight()); if (symbolContext.isShadowing()) { rect.setDeltaShadow(1); } - ug = ug.apply(new UChangeColor(symbolContext.getForeColor())); + ug = ug.apply(symbolContext.getForeColor()); if (closeUp && closeDown) { - ug.apply(new UChangeBackColor(symbolContext.getBackColor())).apply(new UTranslate(x, 0)).draw(rect); + ug.apply(symbolContext.getBackColor().bg()).apply(UTranslate.dx(x)).draw(rect); return; } - ug.apply(new UChangeBackColor(symbolContext.getBackColor())) - .apply(new UChangeColor(symbolContext.getBackColor())).apply(new UTranslate(x, 0)).draw(rect); + ug.apply(symbolContext.getBackColor().bg()) + .apply(symbolContext.getBackColor()).apply(UTranslate.dx(x)).draw(rect); - final ULine vline = new ULine(0, dimensionToUse.getHeight()); - ug.apply(new UTranslate(x, 0)).draw(vline); - ug.apply(new UTranslate(x + getPreferredWidth(stringBounder), 0)).draw(vline); + final ULine vline = ULine.vline(dimensionToUse.getHeight()); + ug.apply(UTranslate.dx(x)).draw(vline); + ug.apply(UTranslate.dx(x + getPreferredWidth(stringBounder))).draw(vline); - final ULine hline = new ULine(getPreferredWidth(stringBounder), 0); + final ULine hline = ULine.hline(getPreferredWidth(stringBounder)); if (closeUp) { - ug.apply(new UTranslate(x, 0)).draw(hline); + ug.apply(UTranslate.dx(x)).draw(hline); } if (closeDown) { ug.apply(new UTranslate(x, dimensionToUse.getHeight())).draw(hline); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActor.java index 636472f2e..4ad88f03c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,37 +34,38 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.AbstractTextualComponent; +import net.sourceforge.plantuml.skin.ActorStyle; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.StickMan; import net.sourceforge.plantuml.style.Style; 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; public class ComponentRoseActor extends AbstractTextualComponent { private final TextBlock stickman; private final boolean head; - public ComponentRoseActor(Style style, Style stereo, SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, - boolean head, ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) { + public ComponentRoseActor(ActorStyle actorStyle, Style style, Style stereo, SymbolContext biColor, + FontConfiguration font, Display stringsToDisplay, boolean head, ISkinSimple spriteContainer, + UFont fontForStereotype, HColor htmlColorForStereotype) { super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false, fontForStereotype, htmlColorForStereotype); this.head = head; if (SkinParam.USE_STYLES()) { biColor = style.getSymbolContext(getIHtmlColorSet()); } - this.stickman = new StickMan(biColor); + // this.stickman = new ActorStickMan(biColor); + this.stickman = actorStyle.getTextBlock(biColor); } @Override @@ -76,9 +77,9 @@ protected void drawInternalU(UGraphic ug, Area area) { if (head) { textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), dimStickman.getHeight()))); - ug = ug.apply(new UTranslate(delta, 0)); + ug = ug.apply(UTranslate.dx(delta)); } else { - textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), 0))); + textBlock.drawU(ug.apply(UTranslate.dx(getTextMiddlePostion(stringBounder)))); ug = ug.apply(new UTranslate(delta, getTextHeight(stringBounder))); } stickman.drawU(ug); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java index d1d4d2930..a68f047bf 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,11 +35,9 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; -import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.ArrowConfiguration; @@ -48,16 +46,14 @@ import net.sourceforge.plantuml.skin.ArrowDressing; import net.sourceforge.plantuml.skin.ArrowHead; import net.sourceforge.plantuml.skin.ArrowPart; -import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseArrow extends AbstractComponentRoseArrow { @@ -65,15 +61,16 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow { private final boolean niceArrow; private final boolean belowForResponse; - public ComponentRoseArrow(Style style, HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay, + public ComponentRoseArrow(Style style, HColor foregroundColor, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, HorizontalAlignment messagePosition, ISkinSimple spriteContainer, HorizontalAlignment textHorizontalAlignment, LineBreakStrategy maxMessageSize, boolean niceArrow, boolean belowForResponse) { super(style, foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer, textHorizontalAlignment, maxMessageSize); - if (SkinParam.USE_STYLES()) { - messagePosition = style.value(PName.HorizontalAlignment).asHorizontalAlignment(); - } + // Done in Rose::createComponentArrow + // if (SkinParam.USE_STYLES()) { + // messagePosition = style.getHorizontalAlignment(); + // } this.messagePosition = messagePosition; this.niceArrow = niceArrow; this.belowForResponse = belowForResponse; @@ -90,7 +87,7 @@ public void drawInternalU(UGraphic ug, Area area) { } final Dimension2D dimensionToUse = area.getDimensionToUse(); final StringBounder stringBounder = ug.getStringBounder(); - ug = ug.apply(new UChangeColor(getForegroundColor())); + ug = ug.apply(getForegroundColor()); final ArrowDressing dressing1 = getArrowConfiguration().getDressing1(); final ArrowDressing dressing2 = getArrowConfiguration().getDressing2(); @@ -144,9 +141,9 @@ public void drawInternalU(UGraphic ug, Area area) { yText = 0; } - drawDressing1(ug.apply(new UTranslate(0, posArrow)), pos1, dressing1, getArrowConfiguration().getDecoration1()); - drawDressing2(ug.apply(new UTranslate(0, posArrow)), pos2, dressing2, getArrowConfiguration().getDecoration2()); - getArrowConfiguration().applyStroke(ug).apply(new UTranslate(start, posArrow)).draw(new ULine(len, 0)); + drawDressing1(ug.apply(UTranslate.dy(posArrow)), pos1, dressing1, getArrowConfiguration().getDecoration1()); + drawDressing2(ug.apply(UTranslate.dy(posArrow)), pos2, dressing2, getArrowConfiguration().getDecoration2()); + getArrowConfiguration().applyStroke(ug).apply(new UTranslate(start, posArrow)).draw(ULine.hline(len)); final ArrowDirection direction2 = getDirection2(); final double textPos; @@ -173,7 +170,7 @@ private void drawDressing1(UGraphic ug, double x, ArrowDressing dressing, ArrowD if (decoration == ArrowDecoration.CIRCLE) { final UEllipse circle = new UEllipse(diamCircle, diamCircle); - ug.apply(new UStroke(thinCircle)).apply(new UChangeColor(getForegroundColor())) + ug.apply(new UStroke(thinCircle)).apply(getForegroundColor()) .apply(new UTranslate(x - diamCircle / 2 - thinCircle, -diamCircle / 2 - thinCircle / 2)) .draw(circle); x += diamCircle / 2 + thinCircle; @@ -181,11 +178,11 @@ private void drawDressing1(UGraphic ug, double x, ArrowDressing dressing, ArrowD if (dressing.getHead() == ArrowHead.ASYNC) { if (dressing.getPart() != ArrowPart.BOTTOM_PART) { - getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x - 1, 0)) + getArrowConfiguration().applyThicknessOnly(ug).apply(UTranslate.dx(x - 1)) .draw(new ULine(getArrowDeltaX(), -getArrowDeltaY())); } if (dressing.getPart() != ArrowPart.TOP_PART) { - getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x - 1, 0)) + getArrowConfiguration().applyThicknessOnly(ug).apply(UTranslate.dx(x - 1)) .draw(new ULine(getArrowDeltaX(), getArrowDeltaY())); } } else if (dressing.getHead() == ArrowHead.CROSSX) { @@ -196,7 +193,7 @@ private void drawDressing1(UGraphic ug, double x, ArrowDressing dressing, ArrowD new ULine(getArrowDeltaX(), -getArrowDeltaX())); } else if (dressing.getHead() == ArrowHead.NORMAL) { final UPolygon polygon = getPolygonReverse(dressing.getPart()); - ug.apply(new UChangeBackColor(getForegroundColor())).apply(new UTranslate(x, 0)).draw(polygon); + ug.apply(getForegroundColor().bg()).apply(UTranslate.dx(x)).draw(polygon); } } @@ -204,7 +201,7 @@ private void drawDressing1(UGraphic ug, double x, ArrowDressing dressing, ArrowD private void drawDressing2(UGraphic ug, double x, ArrowDressing dressing, ArrowDecoration decoration) { if (decoration == ArrowDecoration.CIRCLE) { - ug = ug.apply(new UStroke(thinCircle)).apply(new UChangeColor(getForegroundColor())); + ug = ug.apply(new UStroke(thinCircle)).apply(getForegroundColor()); final UEllipse circle = new UEllipse(diamCircle, diamCircle); ug.apply(new UTranslate(x - diamCircle / 2 + thinCircle, -diamCircle / 2 - thinCircle / 2)).draw(circle); ug = ug.apply(new UStroke()); @@ -213,11 +210,11 @@ private void drawDressing2(UGraphic ug, double x, ArrowDressing dressing, ArrowD if (dressing.getHead() == ArrowHead.ASYNC) { if (dressing.getPart() != ArrowPart.BOTTOM_PART) { - getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x, 0)) + getArrowConfiguration().applyThicknessOnly(ug).apply(UTranslate.dx(x)) .draw(new ULine(-getArrowDeltaX(), -getArrowDeltaY())); } if (dressing.getPart() != ArrowPart.TOP_PART) { - getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x, 0)) + getArrowConfiguration().applyThicknessOnly(ug).apply(UTranslate.dx(x)) .draw(new ULine(-getArrowDeltaX(), getArrowDeltaY())); } } else if (dressing.getHead() == ArrowHead.CROSSX) { @@ -229,7 +226,7 @@ private void drawDressing2(UGraphic ug, double x, ArrowDressing dressing, ArrowD ug = ug.apply(new UStroke()); } else if (dressing.getHead() == ArrowHead.NORMAL) { final UPolygon polygon = getPolygonNormal(dressing.getPart(), x); - ug.apply(new UChangeBackColor(getForegroundColor())).draw(polygon); + ug.apply(getForegroundColor().bg()).draw(polygon); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseBoundary.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseBoundary.java index 4827ce5e3..df394582f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseBoundary.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseBoundary.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,23 +34,21 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.svek.Boundary; 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; public class ComponentRoseBoundary extends AbstractTextualComponent { @@ -59,7 +57,7 @@ public class ComponentRoseBoundary extends AbstractTextualComponent { public ComponentRoseBoundary(Style style, Style stereo, SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head, ISkinSimple spriteContainer, UFont fontForStereotype, - HtmlColor htmlColorForStereotype) { + HColor htmlColorForStereotype) { super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false, fontForStereotype, htmlColorForStereotype); if (SkinParam.USE_STYLES()) { @@ -78,9 +76,9 @@ protected void drawInternalU(UGraphic ug, Area area) { if (head) { textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), dimStickman.getHeight()))); - ug = ug.apply(new UTranslate(delta, 0)); + ug = ug.apply(UTranslate.dx(delta)); } else { - textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), 0))); + textBlock.drawU(ug.apply(UTranslate.dx(getTextMiddlePostion(stringBounder)))); ug = ug.apply(new UTranslate(delta, getTextHeight(stringBounder))); } stickman.drawU(ug); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseControl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseControl.java index 44d145497..af0147e89 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseControl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseControl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,12 +34,10 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -50,6 +48,7 @@ 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; public class ComponentRoseControl extends AbstractTextualComponent { @@ -58,7 +57,7 @@ public class ComponentRoseControl extends AbstractTextualComponent { public ComponentRoseControl(Style style, Style stereo, SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head, ISkinSimple spriteContainer, UFont fontForStereotype, - HtmlColor htmlColorForStereotype) { + HColor htmlColorForStereotype) { super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false, fontForStereotype, htmlColorForStereotype); if (SkinParam.USE_STYLES()) { @@ -77,9 +76,9 @@ protected void drawInternalU(UGraphic ug, Area area) { if (head) { textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), dimStickman.getHeight()))); - ug = ug.apply(new UTranslate(delta, 0)); + ug = ug.apply(UTranslate.dx(delta)); } else { - textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), 0))); + textBlock.drawU(ug.apply(UTranslate.dx(getTextMiddlePostion(stringBounder)))); ug = ug.apply(new UTranslate(delta, getTextHeight(stringBounder))); } stickman.drawU(ug); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDatabase.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDatabase.java index e015e85c4..5908ea638 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDatabase.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDatabase.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,7 +38,6 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -51,6 +50,7 @@ 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; public class ComponentRoseDatabase extends AbstractTextualComponent { @@ -59,7 +59,7 @@ public class ComponentRoseDatabase extends AbstractTextualComponent { public ComponentRoseDatabase(Style style, Style stereo, SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head, ISkinSimple spriteContainer, UFont fontForStereotype, - HtmlColor htmlColorForStereotype) { + HColor htmlColorForStereotype) { super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false, fontForStereotype, htmlColorForStereotype); this.head = head; @@ -68,7 +68,7 @@ public ComponentRoseDatabase(Style style, Style stereo, SymbolContext biColor, F } final SymbolContext symbolContext = new SymbolContext(biColor.getBackColor(), biColor.getForeColor()) - .withStroke(new UStroke(1.5)).withShadow(biColor.getDeltaShadow() > 0); + .withStroke(new UStroke(1.5)).withShadow(biColor.getDeltaShadow()); this.stickman = USymbol.DATABASE.asSmall(null, TextBlockUtils.empty(16, 17), TextBlockUtils.empty(0, 0), symbolContext, HorizontalAlignment.CENTER); } @@ -82,9 +82,9 @@ protected void drawInternalU(UGraphic ug, Area area) { if (head) { textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), dimStickman.getHeight()))); - ug = ug.apply(new UTranslate(delta, 0)); + ug = ug.apply(UTranslate.dx(delta)); } else { - textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), 0))); + textBlock.drawU(ug.apply(UTranslate.dx(getTextMiddlePostion(stringBounder)))); ug = ug.apply(new UTranslate(delta, getTextHeight(stringBounder))); } stickman.drawU(ug); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayLine.java index 77afe3763..45f426aa8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,23 +32,22 @@ import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UAntiAliasing; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseDelayLine extends AbstractComponent { - private final HtmlColor color; + private final HColor color; - public ComponentRoseDelayLine(Style style, HtmlColor color) { + public ComponentRoseDelayLine(Style style, HColor color) { super(style); this.color = color; } @@ -56,9 +55,9 @@ public ComponentRoseDelayLine(Style style, HtmlColor color) { @Override protected void drawInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); - ug = ArrowConfiguration.stroke(ug, 1, 4, 1).apply(new UChangeColor(color)); + ug = ArrowConfiguration.stroke(ug, 1, 4, 1).apply(color); final int x = (int) (dimensionToUse.getWidth() / 2); - ug.apply(UAntiAliasing.ANTI_ALIASING_OFF).apply(new UTranslate(x, 0)).draw(new ULine(0, dimensionToUse.getHeight())); + ug.apply(UAntiAliasing.ANTI_ALIASING_OFF).apply(UTranslate.dx(x)).draw(ULine.vline(dimensionToUse.getHeight())); } @Override diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayText.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayText.java index b6e6b056f..a5909f7c2 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayText.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayText.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDestroy.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDestroy.java index 1258b960c..e1e9e3f8d 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDestroy.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDestroy.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,22 +30,21 @@ */ package net.sourceforge.plantuml.skin.rose; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.ugraphic.UChangeColor; 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; public class ComponentRoseDestroy extends AbstractComponent { - private final HtmlColor foregroundColor; + private final HColor foregroundColor; - public ComponentRoseDestroy(Style style, HtmlColor foregroundColor) { + public ComponentRoseDestroy(Style style, HColor foregroundColor) { super(style); this.foregroundColor = foregroundColor; } @@ -54,10 +53,10 @@ public ComponentRoseDestroy(Style style, HtmlColor foregroundColor) { @Override protected void drawInternalU(UGraphic ug, Area area) { - ug = ug.apply(new UStroke(2)).apply(new UChangeColor(foregroundColor)); + ug = ug.apply(new UStroke(2)).apply(foregroundColor); ug.draw(new ULine(2 * crossSize, 2 * crossSize)); - ug.apply(new UTranslate(0, 2 * crossSize)).draw(new ULine(2 * crossSize, -2 * crossSize)); + ug.apply(UTranslate.dy(2 * crossSize)).draw(new ULine(2 * crossSize, -2 * crossSize)); } @Override diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java index 1b2fbbd4d..7f9c00463 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,38 +34,35 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; 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; public class ComponentRoseDivider extends AbstractTextualComponent { // private final int outMargin = 5; - private final HtmlColor borderColor; - private final HtmlColor background; + private final HColor borderColor; + private final HColor background; private final boolean empty; private final boolean withShadow; private final UStroke stroke; private final double roundCorner; - public ComponentRoseDivider(Style style, FontConfiguration font, HtmlColor background, Display stringsToDisplay, - ISkinSimple spriteContainer, boolean withShadow, UStroke stroke, HtmlColor borderColor) { + public ComponentRoseDivider(Style style, FontConfiguration font, HColor background, Display stringsToDisplay, + ISkinSimple spriteContainer, boolean withShadow, UStroke stroke, HColor borderColor) { super(style, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 4, 4, 4, spriteContainer, false, null, null); if (SkinParam.USE_STYLES()) { @@ -87,9 +84,9 @@ public ComponentRoseDivider(Style style, FontConfiguration font, HtmlColor backg protected void drawInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); - ug = ug.apply(new UChangeBackColor(background)); + ug = ug.apply(background.bg()); if (empty) { - drawSep(ug.apply(new UTranslate(0, dimensionToUse.getHeight() / 2)), dimensionToUse.getWidth()); + drawSep(ug.apply(UTranslate.dy(dimensionToUse.getHeight() / 2)), dimensionToUse.getWidth()); } else { final TextBlock textBlock = getTextBlock(); final StringBounder stringBounder = ug.getStringBounder(); @@ -99,11 +96,11 @@ protected void drawInternalU(UGraphic ug, Area area) { final double xpos = (dimensionToUse.getWidth() - textWidth - deltaX) / 2; final double ypos = (dimensionToUse.getHeight() - textHeight) / 2; - drawSep(ug.apply(new UTranslate(0, dimensionToUse.getHeight() / 2)), dimensionToUse.getWidth()); + drawSep(ug.apply(UTranslate.dy(dimensionToUse.getHeight() / 2)), dimensionToUse.getWidth()); - ug = ug.apply(new UChangeColor(borderColor)); + ug = ug.apply(borderColor); ug = ug.apply(stroke); - final URectangle rect = new URectangle(textWidth + deltaX, textHeight, roundCorner, roundCorner); + final URectangle rect = new URectangle(textWidth + deltaX, textHeight).rounded(roundCorner); if (withShadow) { rect.setDeltaShadow(4); } @@ -116,13 +113,13 @@ protected void drawInternalU(UGraphic ug, Area area) { } private void drawSep(UGraphic ug, double width) { - ug = ug.apply(new UChangeColor(background)); - drawRectLong(ug.apply(new UTranslate(0, -1)), width); + ug = ug.apply(background); + drawRectLong(ug.apply(UTranslate.dy(-1)), width); drawDoubleLine(ug, width); } private void drawRectLong(UGraphic ug, double width) { - final URectangle rectLong = new URectangle(width, 3, roundCorner, roundCorner); + final URectangle rectLong = new URectangle(width, 3).rounded(roundCorner); if (withShadow) { rectLong.setDeltaShadow(2); } @@ -131,10 +128,10 @@ private void drawRectLong(UGraphic ug, double width) { } private void drawDoubleLine(UGraphic ug, final double width) { - ug = ug.apply(new UStroke(stroke.getThickness() / 2)).apply(new UChangeColor(borderColor)); - final ULine line = new ULine(width, 0); - ug.apply(new UTranslate(0, -1)).draw(line); - ug.apply(new UTranslate(0, 2)).draw(line); + ug = ug.apply(new UStroke(stroke.getThickness() / 2)).apply(borderColor); + final ULine line = ULine.hline(width); + ug.apply(UTranslate.dy(-1)).draw(line); + ug.apply(UTranslate.dy(2)).draw(line); } @Override diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEnglober.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEnglober.java index 0c05e688d..8bb07eb41 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEnglober.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEnglober.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -69,9 +69,9 @@ public ComponentRoseEnglober(Style style, SymbolContext symbolContext, Display s protected void drawBackgroundInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); ug = symbolContext.transparentBackColorToNull().apply(ug); - ug.draw(new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight(), roundCorner, roundCorner)); + ug.draw(new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()).rounded(roundCorner)); final double xpos = (dimensionToUse.getWidth() - getPureTextWidth(ug.getStringBounder())) / 2; - getTextBlock().drawU(ug.apply(new UTranslate(xpos, 0))); + getTextBlock().drawU(ug.apply(UTranslate.dx(xpos))); } @Override diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEntity.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEntity.java index 99c0b1006..958d0b1d9 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEntity.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEntity.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,7 +38,6 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -49,6 +48,7 @@ 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; public class ComponentRoseEntity extends AbstractTextualComponent { @@ -57,7 +57,7 @@ public class ComponentRoseEntity extends AbstractTextualComponent { public ComponentRoseEntity(Style style, Style stereo, SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head, ISkinSimple spriteContainer, UFont fontForStereotype, - HtmlColor htmlColorForStereotype) { + HColor htmlColorForStereotype) { super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false, fontForStereotype, htmlColorForStereotype); if (SkinParam.USE_STYLES()) { @@ -76,9 +76,9 @@ protected void drawInternalU(UGraphic ug, Area area) { if (head) { textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), dimStickman.getHeight()))); - ug = ug.apply(new UTranslate(delta, 0)); + ug = ug.apply(UTranslate.dx(delta)); } else { - textBlock.drawU(ug.apply(new UTranslate(getTextMiddlePostion(stringBounder), 0))); + textBlock.drawU(ug.apply(UTranslate.dx(getTextMiddlePostion(stringBounder)))); ug = ug.apply(new UTranslate(delta, getTextHeight(stringBounder))); } stickman.drawU(ug); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java index fde2f30e3..48c16d542 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,36 +34,39 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; +import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorTransparent; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; 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.HColorBackground; +import net.sourceforge.plantuml.ugraphic.color.HColorNone; public class ComponentRoseGroupingElse extends AbstractTextualComponent { - private final HtmlColor groupBorder; - private final HtmlColor backgroundColor; + private final HColor groupBorder; + private final HColor backgroundColor; - public ComponentRoseGroupingElse(Style style, HtmlColor groupBorder, FontConfiguration smallFont, - CharSequence comment, ISkinSimple spriteContainer, HtmlColor backgroundColor) { + public ComponentRoseGroupingElse(Style style, HColor groupBorder, FontConfiguration smallFont, + CharSequence comment, ISkinSimple spriteContainer, HColor backgroundColor) { super(style, LineBreakStrategy.NONE, comment == null ? null : "[" + comment + "]", smallFont, HorizontalAlignment.LEFT, 5, 5, 1, spriteContainer, null, null); if (SkinParam.USE_STYLES()) { + if (spriteContainer instanceof SkinParamBackcolored) { + style = style.eventuallyOverride(PName.BackGroundColor, + ((SkinParamBackcolored) spriteContainer).getBackgroundColor(false)); + } this.groupBorder = style.value(PName.LineColor).asColor(getIHtmlColorSet()); this.backgroundColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet()); } else { @@ -74,19 +77,19 @@ public ComponentRoseGroupingElse(Style style, HtmlColor groupBorder, FontConfigu @Override protected void drawBackgroundInternalU(UGraphic ug, Area area) { - if (backgroundColor instanceof HtmlColorTransparent) { + if (backgroundColor instanceof HColorBackground) { return; } final Dimension2D dimensionToUse = area.getDimensionToUse(); final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()); - ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(backgroundColor)).draw(rect); + ug.apply(new HColorNone()).apply(backgroundColor.bg()).draw(rect); } @Override protected void drawInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); - ug = ArrowConfiguration.stroke(ug, 2, 2, 1).apply(new UChangeColor(groupBorder)); - ug.apply(new UTranslate(0, 1)).draw(new ULine(dimensionToUse.getWidth(), 0)); + ug = ArrowConfiguration.stroke(ug, 2, 2, 1).apply(groupBorder); + ug.apply(UTranslate.dy(1)).draw(ULine.hline(dimensionToUse.getWidth())); ug = ug.apply(new UStroke()); getTextBlock().drawU(ug.apply(new UTranslate(getMarginX1(), getMarginY()))); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java index ede22ee19..6e27efca6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,13 +34,10 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorTransparent; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -48,13 +45,13 @@ import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPath; 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.HColorBackground; public class ComponentRoseGroupingHeader extends AbstractTextualComponent { @@ -63,12 +60,12 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent { private final TextBlock commentTextBlock; - private final HtmlColor background; + private final HColor background; private final SymbolContext symbolContext; private final SymbolContext symbolContextCorner; private final double roundCorner; - public ComponentRoseGroupingHeader(Style style, Style styleHeader, HtmlColor background, + public ComponentRoseGroupingHeader(Style style, Style styleHeader, HColor background, SymbolContext symbolContext, FontConfiguration bigFont, FontConfiguration smallFont2, Display strings, ISkinSimple spriteContainer, double roundCorner) { super(styleHeader, LineBreakStrategy.NONE, strings.get(0), bigFont, HorizontalAlignment.LEFT, 15, 30, 1, @@ -99,7 +96,8 @@ public ComponentRoseGroupingHeader(Style style, Style styleHeader, HtmlColor bac } } - // new FontConfiguration(smallFont, bigFont.getColor(), bigFont.getHyperlinkColor(), + // new FontConfiguration(smallFont, bigFont.getColor(), + // bigFont.getHyperlinkColor(), // bigFont.useUnderlineForHyperlink()); private double getSuppHeightForComment(StringBounder stringBounder) { @@ -134,15 +132,15 @@ final public double getPreferredHeight(StringBounder stringBounder) { @Override protected void drawBackgroundInternalU(UGraphic ug, Area area) { - if (background instanceof HtmlColorTransparent) { + if (background instanceof HColorBackground) { return; } final Dimension2D dimensionToUse = area.getDimensionToUse(); - ug = symbolContext.applyStroke(ug).apply(new UChangeColor(symbolContext.getForeColor())); - final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight(), roundCorner, - roundCorner); + ug = symbolContext.applyStroke(ug).apply(symbolContext.getForeColor()); + final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()) + .rounded(roundCorner); rect.setDeltaShadow(symbolContext.getDeltaShadow()); - ug.apply(new UChangeBackColor(background)).draw(rect); + ug.apply(background.bg()).draw(rect); } @Override @@ -158,9 +156,9 @@ protected void drawInternalU(UGraphic ug, Area area) { symbolContextCorner.applyColors(ug).draw(getCorner(textWidth, textHeight)); } - ug = symbolContext.applyStroke(ug).apply(new UChangeColor(symbolContext.getForeColor())); - final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight(), roundCorner, - roundCorner); + ug = symbolContext.applyStroke(ug).apply(symbolContext.getForeColor()); + final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()) + .rounded(roundCorner); ug.draw(rect); ug = ug.apply(new UStroke()); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingSpace.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingSpace.java index afbcd06dd..4bb5ec464 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingSpace.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingSpace.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,7 +38,7 @@ import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.style.StyleDefinition; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.UGraphic; public class ComponentRoseGroupingSpace implements Component { @@ -47,7 +47,7 @@ public Style[] getUsedStyles() { throw new UnsupportedOperationException(); } - public StyleDefinition getDefaultStyleDefinition() { + public StyleSignature getDefaultStyleDefinition() { throw new UnsupportedOperationException(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java index 489f5f574..dccce12ed 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,29 +32,27 @@ import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.ArrowConfiguration; -import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.PName; -import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.style.Style; 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; public class ComponentRoseLine extends AbstractComponent { - private final HtmlColor color; + private final HColor color; private final boolean continueLine; private final UStroke stroke; - public ComponentRoseLine(Style style, HtmlColor color, boolean continueLine, UStroke stroke, IHtmlColorSet set) { + public ComponentRoseLine(Style style, HColor color, boolean continueLine, UStroke stroke, HColorSet set) { super(style); if (SkinParam.USE_STYLES()) { this.color = style.value(PName.LineColor).asColor(set); @@ -68,14 +66,14 @@ public ComponentRoseLine(Style style, HtmlColor color, boolean continueLine, USt @Override protected void drawInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); - ug = ug.apply(new UChangeColor(color)); + ug = ug.apply(color); if (continueLine) { ug = ug.apply(new UStroke()); } else { ug = ArrowConfiguration.stroke(ug, 5, 5, stroke.getThickness()); } final int x = (int) (dimensionToUse.getWidth() / 2); - ug.apply(new UTranslate(x, 0)).draw(new ULine(0, dimensionToUse.getHeight())); + ug.apply(UTranslate.dx(x)).draw(ULine.vline(dimensionToUse.getHeight())); } @Override diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNewpage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNewpage.java index d1e743e12..3a81a0215 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNewpage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNewpage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,21 +32,20 @@ import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseNewpage extends AbstractComponent { - private final HtmlColor foregroundColor; + private final HColor foregroundColor; - public ComponentRoseNewpage(Style style, HtmlColor foregroundColor) { + public ComponentRoseNewpage(Style style, HColor foregroundColor) { super(style); this.foregroundColor = foregroundColor; } @@ -54,8 +53,8 @@ public ComponentRoseNewpage(Style style, HtmlColor foregroundColor) { @Override protected void drawInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); - ug = ArrowConfiguration.stroke(ug, 2, 2, 1).apply(new UChangeColor(foregroundColor)); - ug.draw(new ULine(dimensionToUse.getWidth(), 0)); + ug = ArrowConfiguration.stroke(ug, 2, 2, 1).apply(foregroundColor); + ug.draw(ULine.hline(dimensionToUse.getWidth())); } @Override diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNote.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNote.java index a85b189dd..91b560598 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNote.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNote.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,7 +31,6 @@ package net.sourceforge.plantuml.skin.rose; import net.sourceforge.plantuml.ISkinSimple; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.cucadiagram.Display; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteBox.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteBox.java index 965bc93a4..302dd5267 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteBox.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteBox.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,6 +31,7 @@ package net.sourceforge.plantuml.skin.rose; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; @@ -38,6 +39,7 @@ import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; +import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; @@ -52,8 +54,13 @@ final public class ComponentRoseNoteBox extends AbstractTextualComponent { public ComponentRoseNoteBox(Style style, SymbolContext symbolContext, FontConfiguration font, Display strings, ISkinSimple spriteContainer, double roundCorner, HorizontalAlignment alignment) { super(style, spriteContainer.wrapWidth(), strings, font, alignment, 4, 4, 4, spriteContainer, false, null, null); - this.roundCorner = roundCorner; - this.symbolContext = symbolContext; + if (SkinParam.USE_STYLES()) { + this.symbolContext = style.getSymbolContext(getIHtmlColorSet()); + this.roundCorner = style.value(PName.RoundCorner).asInt(); + } else { + this.symbolContext = symbolContext; + this.roundCorner = roundCorner; + } } @Override @@ -92,7 +99,7 @@ protected void drawInternalU(UGraphic ug, Area area) { } ug = symbolContext.apply(ug); - final URectangle rect = new URectangle(x2, textHeight, roundCorner, roundCorner); + final URectangle rect = new URectangle(x2, textHeight).rounded(roundCorner); rect.setDeltaShadow(symbolContext.getDeltaShadow()); ug.draw(rect); ug = ug.apply(new UStroke()); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteHexagonal.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteHexagonal.java index fb7011b14..23fee176c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteHexagonal.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteHexagonal.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -31,6 +31,7 @@ package net.sourceforge.plantuml.skin.rose; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; @@ -52,7 +53,11 @@ final public class ComponentRoseNoteHexagonal extends AbstractTextualComponent { public ComponentRoseNoteHexagonal(Style style, SymbolContext symbolContext, FontConfiguration font, Display strings, ISkinSimple spriteContainer, HorizontalAlignment alignment) { super(style, spriteContainer.wrapWidth(), strings, font, alignment, 12, 12, 4, spriteContainer, false, null, null); - this.symbolContext = symbolContext; + if (SkinParam.USE_STYLES()) { + this.symbolContext = style.getSymbolContext(getIHtmlColorSet()); + } else { + this.symbolContext = symbolContext; + } } @Override diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java index eabecad37..c27d73685 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,50 +32,51 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.Component; -import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.PName; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.ugraphic.Shadowable; 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.HColor; public class ComponentRoseParticipant extends AbstractTextualComponent { - private final HtmlColor back; - private final HtmlColor foregroundColor; + private final HColor back; + private final HColor foregroundColor; private final double deltaShadow; private final double roundCorner; + private final double diagonalCorner; private final UStroke stroke; private final double minWidth; private final boolean collections; private final double padding; public ComponentRoseParticipant(Style style, Style stereo, SymbolContext biColor, FontConfiguration font, - Display stringsToDisplay, ISkinSimple spriteContainer, double roundCorner, UFont fontForStereotype, - HtmlColor htmlColorForStereotype, double minWidth, boolean collections, double padding) { + Display stringsToDisplay, ISkinSimple spriteContainer, double roundCorner, double diagonalCorner, + UFont fontForStereotype, HColor htmlColorForStereotype, double minWidth, boolean collections, + double padding) { super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 7, 7, 7, spriteContainer, false, fontForStereotype, htmlColorForStereotype); if (SkinParam.USE_STYLES()) { this.roundCorner = style.value(PName.RoundCorner).asInt(); + this.diagonalCorner = style.value(PName.DiagonalCorner).asInt(); biColor = style.getSymbolContext(getIHtmlColorSet()); this.stroke = style.getStroke(); } else { this.roundCorner = roundCorner; + this.diagonalCorner = diagonalCorner; this.stroke = biColor.getStroke(); } this.padding = padding; @@ -89,15 +90,15 @@ public ComponentRoseParticipant(Style style, Style stereo, SymbolContext biColor @Override protected void drawInternalU(UGraphic ug, Area area) { final StringBounder stringBounder = ug.getStringBounder(); - ug = ug.apply(new UTranslate(padding, 0)); - ug = ug.apply(new UChangeBackColor(back)).apply(new UChangeColor(foregroundColor)); + ug = ug.apply(UTranslate.dx(padding)); + ug = ug.apply(back.bg()).apply(foregroundColor); ug = ug.apply(stroke); - final URectangle rect = new URectangle(getTextWidth(stringBounder), getTextHeight(stringBounder), roundCorner, - roundCorner); + final Shadowable rect = new URectangle(getTextWidth(stringBounder), getTextHeight(stringBounder)) + .rounded(roundCorner).diagonalCorner(diagonalCorner); rect.setDeltaShadow(deltaShadow); if (collections) { - ug.apply(new UTranslate(getDeltaCollection(), 0)).draw(rect); - ug = ug.apply(new UTranslate(0, getDeltaCollection())); + ug.apply(UTranslate.dx(getDeltaCollection())).draw(rect); + ug = ug.apply(UTranslate.dy(getDeltaCollection())); } ug.draw(rect); ug = ug.apply(new UStroke()); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseQueue.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseQueue.java index 3367bc4e7..43e337404 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseQueue.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseQueue.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,12 +34,10 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; @@ -51,6 +49,7 @@ 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; public class ComponentRoseQueue extends AbstractTextualComponent { @@ -59,7 +58,7 @@ public class ComponentRoseQueue extends AbstractTextualComponent { public ComponentRoseQueue(Style style, Style stereo, SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head, ISkinSimple spriteContainer, UFont fontForStereotype, - HtmlColor htmlColorForStereotype) { + HColor htmlColorForStereotype) { super(style, stereo, LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false, fontForStereotype, htmlColorForStereotype); if (SkinParam.USE_STYLES()) { @@ -76,7 +75,7 @@ protected void drawInternalU(UGraphic ug, Area area) { final Dimension2D dimStickman = stickman.calculateDimension(stringBounder); final double delta = (getPreferredWidth(stringBounder) - dimStickman.getWidth()) / 2; - ug = ug.apply(new UTranslate(delta, 0)); + ug = ug.apply(UTranslate.dx(delta)); stickman.drawU(ug); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java index 51fdd7646..a7464b7c4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -34,51 +34,50 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; -import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; 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; public class ComponentRoseReference extends AbstractTextualComponent { - private final HtmlColor background; private final int cornersize = 10; private final TextBlock textHeader; private final double heightFooter = 5; private final double xMargin = 2; private final HorizontalAlignment position; - private final SymbolContext symbolContext; + private final SymbolContext symbolContextHeader; + private final SymbolContext symbolContextBody; - public ComponentRoseReference(Style style, FontConfiguration font, SymbolContext symbolContext, - FontConfiguration header, Display stringsToDisplay, HorizontalAlignment position, - ISkinSimple spriteContainer, HtmlColor background) { + public ComponentRoseReference(Style style, Style styleHeader, FontConfiguration font, SymbolContext symbolContext, + FontConfiguration fcHeader, Display stringsToDisplay, HorizontalAlignment position, + ISkinSimple spriteContainer, HColor background) { super(style, LineBreakStrategy.NONE, stringsToDisplay.subList(1, stringsToDisplay.size()), font, HorizontalAlignment.LEFT, 4, 4, 4, spriteContainer, false, null, null); if (SkinParam.USE_STYLES()) { - this.symbolContext = style.getSymbolContext(getIHtmlColorSet()); - this.background = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet()); - this.position = style.value(PName.HorizontalAlignment).asHorizontalAlignment(); + this.symbolContextHeader = styleHeader.getSymbolContext(getIHtmlColorSet()); + this.symbolContextBody = style.getSymbolContext(getIHtmlColorSet()); + fcHeader = styleHeader.getFontConfiguration(getIHtmlColorSet()); + this.position = style.getHorizontalAlignment(); } else { - this.symbolContext = symbolContext; - this.background = background; + this.symbolContextHeader = symbolContext; + this.symbolContextBody = symbolContextHeader.withBackColor(background); this.position = position; } - this.textHeader = stringsToDisplay.subList(0, 1).create(header, HorizontalAlignment.LEFT, spriteContainer); + this.textHeader = stringsToDisplay.subList(0, 1).create(fcHeader, HorizontalAlignment.LEFT, spriteContainer); } @@ -89,12 +88,11 @@ protected void drawInternalU(UGraphic ug, Area area) { final int textHeaderWidth = (int) (getHeaderWidth(stringBounder)); final int textHeaderHeight = (int) (getHeaderHeight(stringBounder)); - final URectangle rect = new URectangle( - dimensionToUse.getWidth() - xMargin * 2 - symbolContext.getDeltaShadow(), dimensionToUse.getHeight() - - heightFooter); - rect.setDeltaShadow(symbolContext.getDeltaShadow()); - ug = symbolContext.withBackColor(background).apply(ug); - ug.apply(new UTranslate(xMargin, 0)).draw(rect); + final URectangle rect = new URectangle(dimensionToUse.getWidth() - xMargin * 2 + - symbolContextHeader.getDeltaShadow(), dimensionToUse.getHeight() - heightFooter); + rect.setDeltaShadow(symbolContextHeader.getDeltaShadow()); + ug = symbolContextBody.apply(ug); + ug.apply(UTranslate.dx(xMargin)).draw(rect); final UPolygon polygon = new UPolygon(); polygon.addPoint(0, 0); @@ -106,8 +104,8 @@ protected void drawInternalU(UGraphic ug, Area area) { polygon.addPoint(0, textHeaderHeight); polygon.addPoint(0, 0); - ug = symbolContext.apply(ug); - ug.apply(new UTranslate(xMargin, 0)).draw(polygon); + ug = symbolContextHeader.apply(ug); + ug.apply(UTranslate.dx(xMargin)).draw(polygon); ug = ug.apply(new UStroke()); @@ -143,7 +141,7 @@ public double getPreferredHeight(StringBounder stringBounder) { @Override public double getPreferredWidth(StringBounder stringBounder) { return Math.max(getTextWidth(stringBounder), getHeaderWidth(stringBounder)) + xMargin * 2 - + symbolContext.getDeltaShadow(); + + symbolContextHeader.getDeltaShadow(); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java index 5e9157935..f93ad4877 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -38,7 +38,6 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.ArrowConfiguration; @@ -46,21 +45,20 @@ import net.sourceforge.plantuml.skin.ArrowHead; import net.sourceforge.plantuml.skin.ArrowPart; import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow { private final double arrowWidth = 45; private final boolean niceArrow; - public ComponentRoseSelfArrow(Style style, HtmlColor foregroundColor, FontConfiguration font, + public ComponentRoseSelfArrow(Style style, HColor foregroundColor, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, boolean niceArrow) { super(style, foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer, @@ -76,7 +74,7 @@ protected void drawInternalU(UGraphic ug, Area area) { final StringBounder stringBounder = ug.getStringBounder(); final double textHeight = getTextHeight(stringBounder); - ug = ug.apply(new UChangeColor(getForegroundColor())); + ug = ug.apply(getForegroundColor()); final double xRight = arrowWidth - 3; final UGraphic ug2 = getArrowConfiguration().applyStroke(ug); @@ -88,7 +86,7 @@ protected void drawInternalU(UGraphic ug, Area area) { final UEllipse circle = new UEllipse(ComponentRoseArrow.diamCircle, ComponentRoseArrow.diamCircle); if (getArrowConfiguration().getDecoration1() == ArrowDecoration.CIRCLE) { ug2.apply(new UStroke(ComponentRoseArrow.thinCircle)) - .apply(new UChangeColor(getForegroundColor())) + .apply(getForegroundColor()) .apply(new UTranslate(x1 + 1 - ComponentRoseArrow.diamCircle / 2 - ComponentRoseArrow.thinCircle, textHeight - ComponentRoseArrow.diamCircle / 2 - ComponentRoseArrow.thinCircle / 2)) .draw(circle); @@ -96,7 +94,7 @@ protected void drawInternalU(UGraphic ug, Area area) { } if (getArrowConfiguration().getDecoration2() == ArrowDecoration.CIRCLE) { ug2.apply(new UStroke(ComponentRoseArrow.thinCircle)) - .apply(new UChangeColor(getForegroundColor())) + .apply(getForegroundColor()) .apply(new UTranslate(x2 - ComponentRoseArrow.diamCircle / 2 - ComponentRoseArrow.thinCircle, textAndArrowHeight - ComponentRoseArrow.diamCircle / 2 - ComponentRoseArrow.thinCircle / 2)) .draw(circle); @@ -108,9 +106,9 @@ protected void drawInternalU(UGraphic ug, Area area) { } final double arrowHeight = textAndArrowHeight - textHeight; - ug2.apply(new UTranslate(x1, textHeight)).draw(new ULine(xRight - x1, 0)); - ug2.apply(new UTranslate(xRight, textHeight)).draw(new ULine(0, arrowHeight)); - ug2.apply(new UTranslate(x2, textAndArrowHeight)).draw(new ULine(xRight - x2, 0)); + ug2.apply(new UTranslate(x1, textHeight)).draw(ULine.hline(xRight - x1)); + ug2.apply(new UTranslate(xRight, textHeight)).draw(ULine.vline(arrowHeight)); + ug2.apply(new UTranslate(x2, textAndArrowHeight)).draw(ULine.hline(xRight - x2)); if (getArrowConfiguration().isAsync()) { if (getArrowConfiguration().getPart() != ArrowPart.BOTTOM_PART) { @@ -125,18 +123,18 @@ protected void drawInternalU(UGraphic ug, Area area) { ug = ug.apply(new UStroke(2)); ug.apply( new UTranslate(ComponentRoseArrow.spaceCrossX, textHeight - getArrowDeltaX() / 2 - + getArrowOnlyHeight(stringBounder))).draw(new ULine(getArrowDeltaX(), getArrowDeltaX())); + + getArrowOnlyHeight(stringBounder))).draw(new ULine(getArrowDeltaX(), getArrowDeltaX())); ug.apply( new UTranslate(ComponentRoseArrow.spaceCrossX, textHeight + getArrowDeltaX() / 2 - + getArrowOnlyHeight(stringBounder))).draw(new ULine(getArrowDeltaX(), -getArrowDeltaX())); + + getArrowOnlyHeight(stringBounder))).draw(new ULine(getArrowDeltaX(), -getArrowDeltaX())); } else { final UPolygon polygon = getPolygon(textAndArrowHeight); - ug.apply(new UChangeBackColor(getForegroundColor())).apply(new UTranslate(x2, 0)).draw(polygon); + ug.apply(getForegroundColor().bg()).apply(UTranslate.dx(x2)).draw(polygon); } - getTextBlock().drawU(ug.apply(new UTranslate(getMarginX1(), 0))); + getTextBlock().drawU(ug.apply(UTranslate.dx(getMarginX1()))); } private UPolygon getPolygon(final double textAndArrowHeight) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/Rose.java b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/Rose.java index d5bcc7740..cf4d150a5 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/Rose.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/skin/rose/Rose.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -37,12 +37,12 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.PaddingParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.ArrowComponent; @@ -50,26 +50,30 @@ import net.sourceforge.plantuml.skin.ArrowDirection; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; +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.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Rose { final private double paddingX = 5; - final private double paddingY = 5; + final public static double paddingY = 5; - public HtmlColor getFontColor(ISkinParam skin, FontParam fontParam) { + public HColor getFontColor(ISkinParam skin, FontParam fontParam) { return skin.getFontHtmlColor(null, fontParam); } - public HtmlColor getHtmlColor(ISkinParam skin, ColorParam color) { + public HColor getHtmlColor(ISkinParam skin, ColorParam color) { return getHtmlColor(skin, null, color); } - public HtmlColor getHtmlColor(ISkinParam skin, Stereotype stereotype, ColorParam... colorParams) { + public HColor getHtmlColor(ISkinParam skin, Stereotype stereotype, ColorParam... colorParams) { for (ColorParam param : colorParams) { - final HtmlColor result = skin.getHtmlColor(param, stereotype, false); + final HColor result = skin.getHtmlColor(param, stereotype, false); if (result != null) { return result; } @@ -85,6 +89,8 @@ public Component createComponent(Style[] styles, ComponentType type, ArrowConfig Display stringsToDisplay) { final UFont fontGrouping = param.getFont(null, false, FontParam.SEQUENCE_GROUP); + final Stereotype stereotype = stringsToDisplay == null ? null : stringsToDisplay.getStereotypeIfAny(); + final UFont newFontForStereotype = param.getFont(null, false, FontParam.SEQUENCE_STEREOTYPE); if (type.isArrow()) { @@ -92,197 +98,210 @@ public Component createComponent(Style[] styles, ComponentType type, ArrowConfig } final double padding = param.getPadding(PaddingParam.PARTICIPANT); final double roundCorner = param.getRoundCorner(CornerParam.DEFAULT, null); + final double diagonalCorner = param.getDiagonalCorner(CornerParam.DEFAULT, null); if (type == ComponentType.PARTICIPANT_HEAD) { return new ComponentRoseParticipant(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.participantBorder), getUFont2(param, FontParam.PARTICIPANT), - stringsToDisplay, param, roundCorner, newFontForStereotype, getFontColor(param, - FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), false, padding); + getSymbolContext(stereotype, param, ColorParam.participantBorder), + getUFont2(param, FontParam.PARTICIPANT), stringsToDisplay, param, roundCorner, diagonalCorner, + newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), + false, padding); } if (type == ComponentType.PARTICIPANT_TAIL) { return new ComponentRoseParticipant(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.participantBorder), getUFont2(param, FontParam.PARTICIPANT), - stringsToDisplay, param, roundCorner, newFontForStereotype, getFontColor(param, - FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), false, padding); + getSymbolContext(stereotype, param, ColorParam.participantBorder), + getUFont2(param, FontParam.PARTICIPANT), stringsToDisplay, param, roundCorner, diagonalCorner, + newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), + false, padding); } if (type == ComponentType.COLLECTIONS_HEAD) { return new ComponentRoseParticipant(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.collectionsBorder), getUFont2(param, FontParam.PARTICIPANT), - stringsToDisplay, param, roundCorner, newFontForStereotype, getFontColor(param, - FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), true, padding); + getSymbolContext(stereotype, param, ColorParam.collectionsBorder), + getUFont2(param, FontParam.PARTICIPANT), stringsToDisplay, param, roundCorner, diagonalCorner, + newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), + true, padding); } if (type == ComponentType.COLLECTIONS_TAIL) { return new ComponentRoseParticipant(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.collectionsBorder), getUFont2(param, FontParam.PARTICIPANT), - stringsToDisplay, param, roundCorner, newFontForStereotype, getFontColor(param, - FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), true, padding); + getSymbolContext(stereotype, param, ColorParam.collectionsBorder), + getUFont2(param, FontParam.PARTICIPANT), stringsToDisplay, param, roundCorner, diagonalCorner, + newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), + true, padding); } if (type == ComponentType.PARTICIPANT_LINE) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder); - return new ComponentRoseLine(styles == null ? null : styles[0], borderColor, false, getStroke(param, - LineParam.sequenceLifeLineBorder, 1), param.getIHtmlColorSet()); + final HColor borderColor = getHtmlColor(param, stereotype, ColorParam.sequenceLifeLineBorder); + return new ComponentRoseLine(styles == null ? null : styles[0], borderColor, false, + getStroke(param, LineParam.sequenceLifeLineBorder, 1), param.getIHtmlColorSet()); } if (type == ComponentType.CONTINUE_LINE) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder); - return new ComponentRoseLine(styles == null ? null : styles[0], borderColor, true, getStroke(param, - LineParam.sequenceLifeLineBorder, 1.5), param.getIHtmlColorSet()); + final HColor borderColor = getHtmlColor(param, stereotype, ColorParam.sequenceLifeLineBorder); + return new ComponentRoseLine(styles == null ? null : styles[0], borderColor, true, + getStroke(param, LineParam.sequenceLifeLineBorder, 1.5), param.getIHtmlColorSet()); } if (type == ComponentType.ACTOR_HEAD) { - return new ComponentRoseActor(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.actorBorder), getUFont2(param, FontParam.ACTOR), - stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, - FontParam.SEQUENCE_STEREOTYPE)); + return new ComponentRoseActor(param.actorStyle(), styles == null ? null : styles[0], + styles == null ? null : styles[1], getSymbolContext(stereotype, param, ColorParam.actorBorder), + getUFont2(param, FontParam.ACTOR), stringsToDisplay, true, param, newFontForStereotype, + getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.ACTOR_TAIL) { - return new ComponentRoseActor(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.actorBorder), getUFont2(param, FontParam.ACTOR), - stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, - FontParam.SEQUENCE_STEREOTYPE)); + return new ComponentRoseActor(param.actorStyle(), styles == null ? null : styles[0], + styles == null ? null : styles[1], getSymbolContext(stereotype, param, ColorParam.actorBorder), + getUFont2(param, FontParam.ACTOR), stringsToDisplay, false, param, newFontForStereotype, + getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.BOUNDARY_HEAD) { return new ComponentRoseBoundary(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.boundaryBorder), getUFont2(param, FontParam.BOUNDARY), - stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, - FontParam.BOUNDARY_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.boundaryBorder), + getUFont2(param, FontParam.BOUNDARY), stringsToDisplay, true, param, newFontForStereotype, + getFontColor(param, FontParam.BOUNDARY_STEREOTYPE)); } if (type == ComponentType.BOUNDARY_TAIL) { return new ComponentRoseBoundary(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.boundaryBorder), getUFont2(param, FontParam.BOUNDARY), - stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, - FontParam.BOUNDARY_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.boundaryBorder), + getUFont2(param, FontParam.BOUNDARY), stringsToDisplay, false, param, newFontForStereotype, + getFontColor(param, FontParam.BOUNDARY_STEREOTYPE)); } if (type == ComponentType.CONTROL_HEAD) { return new ComponentRoseControl(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.controlBorder), getUFont2(param, FontParam.CONTROL), - stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, - FontParam.CONTROL_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.controlBorder), getUFont2(param, FontParam.CONTROL), + stringsToDisplay, true, param, newFontForStereotype, + getFontColor(param, FontParam.CONTROL_STEREOTYPE)); } if (type == ComponentType.CONTROL_TAIL) { return new ComponentRoseControl(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.controlBorder), getUFont2(param, FontParam.CONTROL), - stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, - FontParam.CONTROL_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.controlBorder), getUFont2(param, FontParam.CONTROL), + stringsToDisplay, false, param, newFontForStereotype, + getFontColor(param, FontParam.CONTROL_STEREOTYPE)); } if (type == ComponentType.ENTITY_HEAD) { return new ComponentRoseEntity(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.entityBorder), getUFont2(param, FontParam.ENTITY), - stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, - FontParam.ENTITY_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.entityBorder), getUFont2(param, FontParam.ENTITY), + stringsToDisplay, true, param, newFontForStereotype, + getFontColor(param, FontParam.ENTITY_STEREOTYPE)); } if (type == ComponentType.ENTITY_TAIL) { return new ComponentRoseEntity(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.entityBorder), getUFont2(param, FontParam.ENTITY), - stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, - FontParam.ENTITY_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.entityBorder), getUFont2(param, FontParam.ENTITY), + stringsToDisplay, false, param, newFontForStereotype, + getFontColor(param, FontParam.ENTITY_STEREOTYPE)); } if (type == ComponentType.QUEUE_HEAD) { return new ComponentRoseQueue(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.entityBorder), getUFont2(param, FontParam.QUEUE), + getSymbolContext(stereotype, param, ColorParam.queueBorder), getUFont2(param, FontParam.QUEUE), stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, FontParam.QUEUE_STEREOTYPE)); } if (type == ComponentType.QUEUE_TAIL) { return new ComponentRoseQueue(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.entityBorder), getUFont2(param, FontParam.QUEUE), - stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, - FontParam.QUEUE_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.queueBorder), getUFont2(param, FontParam.QUEUE), + stringsToDisplay, false, param, newFontForStereotype, + getFontColor(param, FontParam.QUEUE_STEREOTYPE)); } if (type == ComponentType.DATABASE_HEAD) { return new ComponentRoseDatabase(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.databaseBorder), getUFont2(param, FontParam.DATABASE), - stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, - FontParam.DATABASE_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.databaseBorder), + getUFont2(param, FontParam.DATABASE), stringsToDisplay, true, param, newFontForStereotype, + getFontColor(param, FontParam.DATABASE_STEREOTYPE)); } if (type == ComponentType.DATABASE_TAIL) { return new ComponentRoseDatabase(styles == null ? null : styles[0], styles == null ? null : styles[1], - getSymbolContext(param, ColorParam.databaseBorder), getUFont2(param, FontParam.DATABASE), - stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, - FontParam.DATABASE_STEREOTYPE)); + getSymbolContext(stereotype, param, ColorParam.databaseBorder), + getUFont2(param, FontParam.DATABASE), stringsToDisplay, false, param, newFontForStereotype, + getFontColor(param, FontParam.DATABASE_STEREOTYPE)); } if (type == ComponentType.NOTE) { final HorizontalAlignment alignment = param.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null, false); - return new ComponentRoseNote(styles == null ? null : styles[0], getSymbolContext(param, - ColorParam.noteBorder), getUFont2(param, FontParam.NOTE), stringsToDisplay, paddingX, paddingY, - param, roundCorner, alignment); + return new ComponentRoseNote(styles == null ? null : styles[0], + getSymbolContext(stereotype, param, ColorParam.noteBorder), getUFont2(param, FontParam.NOTE), + stringsToDisplay, paddingX, paddingY, param, roundCorner, alignment); } if (type == ComponentType.NOTE_HEXAGONAL) { final HorizontalAlignment alignment = param.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null, false); - return new ComponentRoseNoteHexagonal(styles == null ? null : styles[0], getSymbolContext(param, - ColorParam.noteBorder), getUFont2(param, FontParam.NOTE), stringsToDisplay, param, alignment); + return new ComponentRoseNoteHexagonal(styles == null ? null : styles[0], + getSymbolContext(stereotype, param, ColorParam.noteBorder), getUFont2(param, FontParam.NOTE), + stringsToDisplay, param, alignment); } if (type == ComponentType.NOTE_BOX) { final HorizontalAlignment alignment = param.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null, false); - return new ComponentRoseNoteBox(styles == null ? null : styles[0], getSymbolContext(param, - ColorParam.noteBorder), getUFont2(param, FontParam.NOTE), stringsToDisplay, param, roundCorner, - alignment); + return new ComponentRoseNoteBox(styles == null ? null : styles[0], + getSymbolContext(stereotype, param, ColorParam.noteBorder), getUFont2(param, FontParam.NOTE), + stringsToDisplay, param, roundCorner, alignment); } final FontConfiguration bigFont = getUFont2(param, FontParam.SEQUENCE_GROUP_HEADER); if (type == ComponentType.GROUPING_HEADER) { FontConfiguration smallFont = bigFont.forceFont(fontGrouping, null); - final HtmlColor smallColor = SkinParamUtils.getFontColor(param, FontParam.SEQUENCE_GROUP, null); + final HColor smallColor = SkinParamUtils.getFontColor(param, FontParam.SEQUENCE_GROUP, null); if (smallColor != null) { smallFont = smallFont.changeColor(smallColor); } - return new ComponentRoseGroupingHeader(styles == null ? null : styles[0], - styles == null ? null : styles[1], param.getBackgroundColor(), getSymbolContext(param, - ColorParam.sequenceGroupBorder), bigFont, smallFont, stringsToDisplay, param, roundCorner); + return new ComponentRoseGroupingHeader(styles == null ? null : styles[0], styles == null ? null : styles[1], + param.getBackgroundColor(true), getSymbolContext(stereotype, param, ColorParam.sequenceGroupBorder), + bigFont, smallFont, stringsToDisplay, param, roundCorner); } if (type == ComponentType.GROUPING_ELSE) { - return new ComponentRoseGroupingElse(styles == null ? null : styles[0], getHtmlColor(param, - ColorParam.sequenceGroupBorder), getUFont2(param, FontParam.SEQUENCE_GROUP), - stringsToDisplay.get(0), param, param.getBackgroundColor()); + return new ComponentRoseGroupingElse(styles == null ? null : styles[0], + getHtmlColor(param, stereotype, ColorParam.sequenceGroupBorder), + getUFont2(param, FontParam.SEQUENCE_GROUP), stringsToDisplay.get(0), param, + param.getBackgroundColor(true)); } if (type == ComponentType.GROUPING_SPACE) { return new ComponentRoseGroupingSpace(7); } if (type == ComponentType.ALIVE_BOX_CLOSE_CLOSE) { - return new ComponentRoseActiveLine(styles == null ? null : styles[0], getSymbolContext(param, - ColorParam.sequenceLifeLineBorder), true, true, param.getIHtmlColorSet()); + return new ComponentRoseActiveLine(styles == null ? null : styles[0], + getSymbolContext(stereotype, param, ColorParam.sequenceLifeLineBorder), true, true, + param.getIHtmlColorSet()); } if (type == ComponentType.ALIVE_BOX_CLOSE_OPEN) { - return new ComponentRoseActiveLine(styles == null ? null : styles[0], getSymbolContext(param, - ColorParam.sequenceLifeLineBorder), true, false, param.getIHtmlColorSet()); + return new ComponentRoseActiveLine(styles == null ? null : styles[0], + getSymbolContext(stereotype, param, ColorParam.sequenceLifeLineBorder), true, false, + param.getIHtmlColorSet()); } if (type == ComponentType.ALIVE_BOX_OPEN_CLOSE) { - return new ComponentRoseActiveLine(styles == null ? null : styles[0], getSymbolContext(param, - ColorParam.sequenceLifeLineBorder), false, true, param.getIHtmlColorSet()); + return new ComponentRoseActiveLine(styles == null ? null : styles[0], + getSymbolContext(stereotype, param, ColorParam.sequenceLifeLineBorder), false, true, + param.getIHtmlColorSet()); } if (type == ComponentType.ALIVE_BOX_OPEN_OPEN) { - return new ComponentRoseActiveLine(styles == null ? null : styles[0], getSymbolContext(param, - ColorParam.sequenceLifeLineBorder), false, false, param.getIHtmlColorSet()); + return new ComponentRoseActiveLine(styles == null ? null : styles[0], + getSymbolContext(stereotype, param, ColorParam.sequenceLifeLineBorder), false, false, + param.getIHtmlColorSet()); } if (type == ComponentType.DELAY_LINE) { - return new ComponentRoseDelayLine(null, getHtmlColor(param, ColorParam.sequenceLifeLineBorder)); + return new ComponentRoseDelayLine(null, getHtmlColor(param, stereotype, ColorParam.sequenceLifeLineBorder)); } if (type == ComponentType.DELAY_TEXT) { - return new ComponentRoseDelayText(styles == null ? null : styles[0], getUFont2(param, - FontParam.SEQUENCE_DELAY), stringsToDisplay, param); + return new ComponentRoseDelayText(styles == null ? null : styles[0], + getUFont2(param, FontParam.SEQUENCE_DELAY), stringsToDisplay, param); } if (type == ComponentType.DESTROY) { - return new ComponentRoseDestroy(null, getHtmlColor(param, ColorParam.sequenceLifeLineBorder)); + return new ComponentRoseDestroy(null, getHtmlColor(param, stereotype, ColorParam.sequenceLifeLineBorder)); } if (type == ComponentType.NEWPAGE) { throw new UnsupportedOperationException(); } if (type == ComponentType.DIVIDER) { - return new ComponentRoseDivider(styles == null ? null : styles[0], getUFont2(param, - FontParam.SEQUENCE_DIVIDER), getHtmlColor(param, ColorParam.sequenceDividerBackground), - stringsToDisplay, param, deltaShadow(param, ColorParam.sequenceDividerBackground) > 0, getStroke( - param, LineParam.sequenceDividerBorder, 2), getHtmlColor(param, - ColorParam.sequenceDividerBorder)); + return new ComponentRoseDivider(styles == null ? null : styles[0], + getUFont2(param, FontParam.SEQUENCE_DIVIDER), + getHtmlColor(param, stereotype, ColorParam.sequenceDividerBackground), stringsToDisplay, param, + deltaShadow(param, ColorParam.sequenceDividerBackground) > 0, + getStroke(param, LineParam.sequenceDividerBorder, 2), + getHtmlColor(param, stereotype, ColorParam.sequenceDividerBorder)); } if (type == ComponentType.REFERENCE) { - return new ComponentRoseReference(styles == null ? null : styles[0], getUFont2(param, - FontParam.SEQUENCE_REFERENCE), getSymbolContext(param, ColorParam.sequenceReferenceBorder), - bigFont, stringsToDisplay, param.getHorizontalAlignment(AlignmentParam.sequenceReferenceAlignment, - null, false), param, getHtmlColor(param, ColorParam.sequenceReferenceBackground)); + return new ComponentRoseReference(styles == null ? null : styles[0], styles == null ? null : styles[1], + getUFont2(param, FontParam.SEQUENCE_REFERENCE), + getSymbolContext(stereotype, param, ColorParam.sequenceReferenceBorder), bigFont, stringsToDisplay, + param.getHorizontalAlignment(AlignmentParam.sequenceReferenceAlignment, null, false), param, + getHtmlColor(param, stereotype, ColorParam.sequenceReferenceBackground)); } if (type == ComponentType.ENGLOBER) { - return new ComponentRoseEnglober(styles == null ? null : styles[0], getSymbolContext(param, - ColorParam.sequenceBoxBorder), stringsToDisplay, getUFont2(param, FontParam.SEQUENCE_BOX), param, - roundCorner); + return new ComponentRoseEnglober(styles == null ? null : styles[0], + getSymbolContext(stereotype, param, ColorParam.sequenceBoxBorder), stringsToDisplay, + getUFont2(param, FontParam.SEQUENCE_BOX), param, roundCorner); } return null; @@ -294,20 +313,65 @@ public ComponentRoseNewpage createComponentNewPage(ISkinParam param) { public ArrowComponent createComponentArrow(Style[] styles, ArrowConfiguration config, ISkinParam param, Display stringsToDisplay) { - final HtmlColor sequenceArrow = config.getColor() == null ? getHtmlColor(param, ColorParam.arrow) : config - .getColor(); + final HColor sequenceArrow = config.getColor() == null ? getHtmlColor(param, ColorParam.arrow) + : config.getColor(); if (config.getArrowDirection() == ArrowDirection.SELF) { - return new ComponentRoseSelfArrow(styles == null ? null : styles[0], sequenceArrow, getUFont2(param, - FontParam.ARROW), stringsToDisplay, config, param, param.maxMessageSize(), + return new ComponentRoseSelfArrow(styles == null ? null : styles[0], sequenceArrow, + getUFont2(param, FontParam.ARROW), stringsToDisplay, config, param, param.maxMessageSize(), param.strictUmlStyle() == false); } - final HorizontalAlignment messageHorizontalAlignment = param.getHorizontalAlignment( - AlignmentParam.sequenceMessageAlignment, config.getArrowDirection(), config.isReverseDefine()); - final HorizontalAlignment textHorizontalAlignment = param.getHorizontalAlignment( - AlignmentParam.sequenceMessageTextAlignment, config.getArrowDirection(), false); - return new ComponentRoseArrow(styles == null ? null : styles[0], sequenceArrow, getUFont2(param, - FontParam.ARROW), stringsToDisplay, config, messageHorizontalAlignment, param, textHorizontalAlignment, - param.maxMessageSize(), param.strictUmlStyle() == false, param.responseMessageBelowArrow()); + HorizontalAlignment messageHorizontalAlignment; + final HorizontalAlignment textHorizontalAlignment; + final ArrowDirection arrowDirection = config.getArrowDirection(); + if (SkinParam.USE_STYLES()) { + final StyleSignature signature = StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, + SName.arrow); + final Style textStyle = signature.getMergedStyle(param.getCurrentStyleBuilder()); + final String value = textStyle.value(PName.HorizontalAlignment).asString(); + messageHorizontalAlignment = textStyle.getHorizontalAlignment(); + textHorizontalAlignment = textStyle.getHorizontalAlignment(); + if ("first".equalsIgnoreCase(value)) { + final boolean isReverseDefine = config.isReverseDefine(); + if (arrowDirection == ArrowDirection.RIGHT_TO_LEFT_REVERSE) { + if (isReverseDefine) { + messageHorizontalAlignment = HorizontalAlignment.LEFT; + } else { + messageHorizontalAlignment = HorizontalAlignment.RIGHT; + } + } else { + if (isReverseDefine) { + messageHorizontalAlignment = HorizontalAlignment.RIGHT; + } else { + messageHorizontalAlignment = HorizontalAlignment.LEFT; + } + } + } else if ("direction".equalsIgnoreCase(value)) { + if (arrowDirection == ArrowDirection.LEFT_TO_RIGHT_NORMAL) { + messageHorizontalAlignment = HorizontalAlignment.LEFT; + } else if (arrowDirection == ArrowDirection.RIGHT_TO_LEFT_REVERSE) { + messageHorizontalAlignment = HorizontalAlignment.RIGHT; + } else if (arrowDirection == ArrowDirection.BOTH_DIRECTION) { + messageHorizontalAlignment = HorizontalAlignment.CENTER; + } + } else if ("reversedirection".equalsIgnoreCase(value)) { + if (arrowDirection == ArrowDirection.LEFT_TO_RIGHT_NORMAL) { + messageHorizontalAlignment = HorizontalAlignment.RIGHT; + } else if (arrowDirection == ArrowDirection.RIGHT_TO_LEFT_REVERSE) { + messageHorizontalAlignment = HorizontalAlignment.LEFT; + } else if (arrowDirection == ArrowDirection.BOTH_DIRECTION) { + messageHorizontalAlignment = HorizontalAlignment.CENTER; + } + } + } else { + messageHorizontalAlignment = param.getHorizontalAlignment(AlignmentParam.sequenceMessageAlignment, + arrowDirection, config.isReverseDefine()); + textHorizontalAlignment = param.getHorizontalAlignment(AlignmentParam.sequenceMessageTextAlignment, + config.getArrowDirection(), false); + } + return new ComponentRoseArrow(styles == null ? null : styles[0], sequenceArrow, + getUFont2(param, FontParam.ARROW), stringsToDisplay, config, messageHorizontalAlignment, param, + textHorizontalAlignment, param.maxMessageSize(), param.strictUmlStyle() == false, + param.responseMessageBelowArrow()); } private double deltaShadow(ISkinParam param, ColorParam color) { @@ -316,70 +380,96 @@ private double deltaShadow(ISkinParam param, ColorParam color) { skinParameter = SkinParameter.PARTICIPANT; } else if (color == ColorParam.actorBorder) { skinParameter = SkinParameter.ACTOR; + } else if (color == ColorParam.boundaryBorder) { + skinParameter = SkinParameter.BOUNDARY; + } else if (color == ColorParam.controlBorder) { + skinParameter = SkinParameter.CONTROL; + } else if (color == ColorParam.entityBorder) { + skinParameter = SkinParameter.ENTITY; + } else if (color == ColorParam.collectionsBorder) { + skinParameter = SkinParameter.COLLECTIONS; + } else if (color == ColorParam.databaseBorder) { + skinParameter = SkinParameter.DATABASE; } final boolean result = skinParameter == null ? param.shadowing(null) : param.shadowing2(null, skinParameter); return result ? 4.0 : 0; } - private SymbolContext getSymbolContext(ISkinParam skin, ColorParam color) { + private SymbolContext getSymbolContext(Stereotype stereotype, ISkinParam skin, ColorParam color) { if (color == ColorParam.participantBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.participantBackground), getHtmlColor(skin, - ColorParam.participantBorder)) - .withStroke(getStroke(skin, LineParam.sequenceParticipantBorder, 1.5)).withDeltaShadow( - deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.participantBackground), + getHtmlColor(skin, stereotype, ColorParam.participantBorder)) + .withStroke(getStroke(skin, LineParam.sequenceParticipantBorder, 1.5)) + .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.actorBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.actorBackground), getHtmlColor(skin, - ColorParam.actorBorder)).withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) - .withDeltaShadow(deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.actorBackground), + getHtmlColor(skin, stereotype, ColorParam.actorBorder)) + .withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) + .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.boundaryBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.boundaryBackground), getHtmlColor(skin, - ColorParam.boundaryBorder)).withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) - .withDeltaShadow(deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.boundaryBackground), + getHtmlColor(skin, stereotype, ColorParam.boundaryBorder)) + .withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) + .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.controlBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.controlBackground), getHtmlColor(skin, - ColorParam.controlBorder)).withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) - .withDeltaShadow(deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.controlBackground), + getHtmlColor(skin, stereotype, ColorParam.controlBorder)) + .withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) + .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.collectionsBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.collectionsBackground), getHtmlColor(skin, - ColorParam.collectionsBorder)).withStroke(getStroke(skin, LineParam.sequenceActorBorder, 1.5)) - .withDeltaShadow(deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.collectionsBackground), + getHtmlColor(skin, stereotype, ColorParam.collectionsBorder)) + .withStroke(getStroke(skin, LineParam.sequenceActorBorder, 1.5)) + .withDeltaShadow(deltaShadow(skin, color)); + } + if (color == ColorParam.queueBorder) { + final double tmp = deltaShadow(skin, color); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.queueBackground), + getHtmlColor(skin, stereotype, ColorParam.queueBorder)) + .withStroke(getStroke(skin, LineParam.queueBorder, 2)).withDeltaShadow(tmp); } if (color == ColorParam.entityBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.entityBackground), getHtmlColor(skin, - ColorParam.entityBorder)).withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) - .withDeltaShadow(deltaShadow(skin, color)); + final double tmp = deltaShadow(skin, color); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.entityBackground), + getHtmlColor(skin, stereotype, ColorParam.entityBorder)) + .withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)).withDeltaShadow(tmp); } if (color == ColorParam.databaseBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.databaseBackground), getHtmlColor(skin, - ColorParam.databaseBorder)).withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) - .withDeltaShadow(deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.databaseBackground), + getHtmlColor(skin, stereotype, ColorParam.databaseBorder)) + .withStroke(getStroke(skin, LineParam.sequenceActorBorder, 2)) + .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.sequenceLifeLineBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.sequenceLifeLineBackground), getHtmlColor(skin, - ColorParam.sequenceLifeLineBorder)).withDeltaShadow(deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.sequenceLifeLineBackground), + getHtmlColor(skin, stereotype, ColorParam.sequenceLifeLineBorder)) + .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.noteBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.noteBackground), getHtmlColor(skin, - ColorParam.noteBorder)).withStroke(getStroke(skin, LineParam.noteBorder, 1)).withDeltaShadow( - deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.noteBackground), + getHtmlColor(skin, stereotype, ColorParam.noteBorder)) + .withStroke(getStroke(skin, LineParam.noteBorder, 1)) + .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.sequenceGroupBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.sequenceGroupBackground), getHtmlColor(skin, - ColorParam.sequenceGroupBorder)).withStroke(getStroke(skin, LineParam.sequenceGroupBorder, 2)) - .withDeltaShadow(deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.sequenceGroupBackground), + getHtmlColor(skin, stereotype, ColorParam.sequenceGroupBorder)) + .withStroke(getStroke(skin, LineParam.sequenceGroupBorder, 2)) + .withDeltaShadow(deltaShadow(skin, color)); } if (color == ColorParam.sequenceBoxBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.sequenceBoxBackground), getHtmlColor(skin, - ColorParam.sequenceBoxBorder)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.sequenceBoxBackground), + getHtmlColor(skin, stereotype, ColorParam.sequenceBoxBorder)); } if (color == ColorParam.sequenceReferenceBorder) { - return new SymbolContext(getHtmlColor(skin, ColorParam.sequenceReferenceHeaderBackground), getHtmlColor( - skin, ColorParam.sequenceReferenceBorder)).withStroke( - getStroke(skin, LineParam.sequenceReferenceBorder, 2)).withDeltaShadow(deltaShadow(skin, color)); + return new SymbolContext(getHtmlColor(skin, stereotype, ColorParam.sequenceReferenceHeaderBackground), + getHtmlColor(skin, stereotype, ColorParam.sequenceReferenceBorder)) + .withStroke(getStroke(skin, LineParam.sequenceReferenceBorder, 2)) + .withDeltaShadow(deltaShadow(skin, color)); } throw new IllegalArgumentException(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/ColorPalette.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/ColorPalette.java similarity index 76% rename from src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/ColorPalette.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/sprite/ColorPalette.java index b2e3a31a9..cd688d99f 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/ColorPalette.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/ColorPalette.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,27 +28,27 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.ugraphic.sprite; +package net.sourceforge.plantuml.sprite; import java.awt.Color; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; public class ColorPalette { private static final String colorValue = "!#$%&*+-:;<=>?@^_~GHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; public char getCharFor(Color dest) { - return getCharFor(new HtmlColorSimple(dest, false)); + return getCharFor(new HColorSimple(dest, false)); } - public char getCharFor(HtmlColor dest) { + public char getCharFor(HColor dest) { char result = 0; double resultDist = Double.MAX_VALUE; for (int i = 0; i < colorValue.length(); i++) { final char c = colorValue.charAt(i); - final double dist = ((HtmlColorSimple) dest).distance(getHtmlColorSimpleFor(c)); + final double dist = ((HColorSimple) dest).distance(getHtmlColorSimpleFor(c)); if (dist < resultDist) { result = c; resultDist = dist; @@ -58,12 +58,12 @@ public char getCharFor(HtmlColor dest) { return result; } - private HtmlColorSimple getHtmlColorSimpleFor(char c) { + private HColorSimple getHtmlColorSimpleFor(char c) { final Color color = getColorFor(c); if (color == null) { throw new IllegalArgumentException(); } - return new HtmlColorSimple(color, false); + return new HColorSimple(color, false); } public Color getColorFor(char c) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/ColorPalette4096.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/ColorPalette4096.java similarity index 80% rename from src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/ColorPalette4096.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/sprite/ColorPalette4096.java index 88d2b6d28..fa171fa3a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/ColorPalette4096.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/ColorPalette4096.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,26 +28,26 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.ugraphic.sprite; +package net.sourceforge.plantuml.sprite; import java.awt.Color; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; public class ColorPalette4096 { private static final String colorValue = "!#$%&*+-:;<=>?@^_~GHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; public String getStringFor(Color dest) { - return getStringFor(new HtmlColorSimple(dest, false)); + return getStringFor(new HColorSimple(dest, false)); } - public String getStringFor(HtmlColor dest) { + public String getStringFor(HColor dest) { int result = 0; double resultDist = Double.MAX_VALUE; for (int i = 0; i < 4096; i++) { - final double dist = ((HtmlColorSimple) dest).distance(getHtmlColorSimpleFor(i)); + final double dist = ((HColorSimple) dest).distance(getHtmlColorSimpleFor(i)); if (dist < resultDist) { result = i; resultDist = dist; @@ -63,12 +63,12 @@ protected String encodeInt(int result) { return "" + colorValue.charAt(v1) + colorValue.charAt(v2); } - private HtmlColorSimple getHtmlColorSimpleFor(int s) { + private HColorSimple getHtmlColorSimpleFor(int s) { final Color color = getColorFor(s); if (color == null) { throw new IllegalArgumentException(); } - return new HtmlColorSimple(color, false); + return new HColorSimple(color, false); } public Color getColorFor(String s) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/CommandListSprite.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/CommandListSprite.java new file mode 100644 index 000000000..cf20b2f5a --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/CommandListSprite.java @@ -0,0 +1,59 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.sprite; + +import net.sourceforge.plantuml.LineLocation; +import net.sourceforge.plantuml.UmlDiagram; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.SingleLineCommand2; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; + +public class CommandListSprite extends SingleLineCommand2 { + + public CommandListSprite() { + super(getRegexConcat()); + } + + private static IRegex getRegexConcat() { + return RegexConcat.build(CommandListSprite.class.getName(), RegexLeaf.start(), // + new RegexLeaf("listsprites?"), // + RegexLeaf.end()); + } + + @Override + protected CommandExecutionResult executeArg(UmlDiagram system, LineLocation location, RegexResult arg) { + return CommandExecutionResult.ok(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/CommandStdlib.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/CommandStdlib.java new file mode 100644 index 000000000..de5a215af --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/CommandStdlib.java @@ -0,0 +1,62 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.sprite; + +import net.sourceforge.plantuml.LineLocation; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.SingleLineCommand2; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; + +public class CommandStdlib extends SingleLineCommand2 { + + public CommandStdlib() { + super(getRegexConcat()); + } + + private static IRegex getRegexConcat() { + return RegexConcat.build(CommandStdlib.class.getName(), RegexLeaf.start(), // + new RegexLeaf("stdlib"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("NAME", "([-\\w]+)"), // + RegexLeaf.end()); + } + + @Override + protected CommandExecutionResult executeArg(StdlibDiagram system, LineLocation location, RegexResult arg) { + final String name = arg.get("NAME", 0); + system.setStdlibName(name); + return CommandExecutionResult.ok(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java new file mode 100644 index 000000000..d761c24e5 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java @@ -0,0 +1,128 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.sprite; + +import java.awt.geom.Dimension2D; +import java.io.IOException; +import java.io.OutputStream; + +import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.FileFormatOption; +import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.SkinParam; +import net.sourceforge.plantuml.UmlDiagram; +import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.core.DiagramDescription; +import net.sourceforge.plantuml.core.ImageData; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; +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.HColorUtils; + +public class ListSpriteDiagram extends UmlDiagram { + + public ListSpriteDiagram(ISkinSimple skinParam) { + super(skinParam); + } + + public DiagramDescription getDescription() { + return new DiagramDescription("(Sprites)"); + } + + @Override + public UmlDiagramType getUmlDiagramType() { + return UmlDiagramType.HELP; + } + + @Override + protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) + throws IOException { + + final TextBlock result = getTable(); + final double dpiFactor = 1; + + final int margin1; + final int margin2; + if (SkinParam.USE_STYLES()) { + margin1 = SkinParam.zeroMargin(10); + margin2 = SkinParam.zeroMargin(10); + } else { + margin1 = 10; + margin2 = 10; + } + final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), getAnimation(), fileFormatOption.isWithMetadata() ? getMetadata() : null, + getWarningOrError(), dpiFactor); + imageBuilder.setUDrawable(result); + + return imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed(), os); + } + + private TextBlock getTable() { + return new AbstractTextBlock() { + + public void drawU(UGraphic ug) { + double x = 0; + double y = 0; + double rawHeight = 0; + for (String n : getSkinParam().getAllSpriteNames()) { + 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); + tb = TextBlockUtils.mergeTB(tb, blockName, HorizontalAlignment.CENTER); + tb.drawU(ug.apply(new UTranslate(x, y))); + final Dimension2D dim = tb.calculateDimension(ug.getStringBounder()); + rawHeight = Math.max(rawHeight, dim.getHeight()); + x += dim.getWidth(); + x += 30; + if (x > 1024) { + x = 0; + y += rawHeight + 50; + rawHeight = 0; + } + } + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return new Dimension2DDouble(1024, 1024); + } + }; + } +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/ListSpriteDiagramFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/ListSpriteDiagramFactory.java new file mode 100644 index 000000000..67d04fece --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/ListSpriteDiagramFactory.java @@ -0,0 +1,63 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.sprite; + +import java.util.ArrayList; +import java.util.List; + +import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.command.Command; +import net.sourceforge.plantuml.command.UmlDiagramFactory; + +public class ListSpriteDiagramFactory extends UmlDiagramFactory { + + private final ISkinSimple skinParam; + + public ListSpriteDiagramFactory(ISkinSimple skinParam) { + this.skinParam = skinParam; + } + + @Override + protected List createCommands() { + + final List cmds = new ArrayList(); + addCommonCommands1(cmds); + addCommonCommands2(cmds); + cmds.add(new CommandListSprite()); + return cmds; + } + + @Override + public ListSpriteDiagram createEmptyDiagram() { + return new ListSpriteDiagram(skinParam); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/PSystemListInternalSprites.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/PSystemListInternalSprites.java similarity index 85% rename from src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/PSystemListInternalSprites.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/sprite/PSystemListInternalSprites.java index 1a97c6986..2c7079ef8 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/PSystemListInternalSprites.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/PSystemListInternalSprites.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.ugraphic.sprite; +package net.sourceforge.plantuml.sprite; import java.io.IOException; import java.io.OutputStream; @@ -40,13 +40,13 @@ import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.donors.PSystemDonors; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockHorizontal; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.VerticalAlignment; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PSystemListInternalSprites extends AbstractPSystem { @@ -54,15 +54,15 @@ public class PSystemListInternalSprites extends AbstractPSystem { final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { final UDrawable result = getGraphicStrings(); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE, - getMetadata(), null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), + false, null, getMetadata(), null, 1.0, HColorUtils.WHITE); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); } private UDrawable getGraphicStrings() throws IOException { final List lines = new ArrayList(); - lines.add("List Current Sprits"); + lines.add("List Current Sprites"); lines.add("Credit to"); lines.add("http://www.archimatetool.com"); lines.add(" "); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/PSystemListInternalSpritesFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/PSystemListInternalSpritesFactory.java similarity index 89% rename from src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/PSystemListInternalSpritesFactory.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/sprite/PSystemListInternalSpritesFactory.java index 06fc9c498..57834ddef 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/PSystemListInternalSpritesFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/PSystemListInternalSpritesFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.ugraphic.sprite; +package net.sourceforge.plantuml.sprite; import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.StringUtils; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/RessourcesUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/RessourcesUtils.java similarity index 90% rename from src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/RessourcesUtils.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/sprite/RessourcesUtils.java index 663ca45a7..c8514ca4c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/RessourcesUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/RessourcesUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,9 +28,8 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.ugraphic.sprite; +package net.sourceforge.plantuml.sprite; -import java.io.File; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; @@ -42,6 +41,7 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; +import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.version.Version; public class RessourcesUtils { @@ -54,7 +54,7 @@ public static Set getJarFile(String path, boolean folder) throws IOExcep if ("file".equals(protocol)) { final URL local = Version.class.getClassLoader().getResource(path); try { - return listEntry(new File(local.toURI())); + return listEntry(new SFile(local.toURI())); } catch (URISyntaxException e) { e.printStackTrace(); return null; @@ -71,7 +71,7 @@ public static Set getJarFile(String path, boolean folder) throws IOExcep } } - return Collections. emptySet(); + return Collections.emptySet(); } private static String getProtocol() { @@ -107,7 +107,7 @@ private static Set listFolders(JarFile jarFile, String path) { return result; } - private static Set listEntry(File dir) { + private static Set listEntry(SFile dir) { final Set result = new TreeSet(); for (String n : dir.list()) { result.add(n); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/Sprite.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/Sprite.java similarity index 78% rename from src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/Sprite.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/sprite/Sprite.java index a21248da4..62a506478 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/Sprite.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/Sprite.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,13 +28,13 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.ugraphic.sprite; +package net.sourceforge.plantuml.sprite; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.ugraphic.color.HColor; public interface Sprite { - public TextBlock asTextBlock(final HtmlColor color, double scale); + public TextBlock asTextBlock(final HColor color, double scale); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteColor.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteColor.java similarity index 77% rename from src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteColor.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteColor.java index 34cb8a286..0e4210055 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteColor.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteColor.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.ugraphic.sprite; +package net.sourceforge.plantuml.sprite; import java.awt.Color; import java.awt.geom.Dimension2D; @@ -36,14 +36,16 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.ColorMapper; +import net.sourceforge.plantuml.ugraphic.AffineTransformType; +import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class SpriteColor implements Sprite { @@ -92,16 +94,16 @@ public int getWidth() { return width; } - public UImage toUImage(ColorMapper colorMapper, HtmlColor backcolor, HtmlColor forecolor) { + public UImage toUImage(ColorMapper colorMapper, HColor backcolor, HColor forecolor) { final BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); if (backcolor == null) { - backcolor = HtmlColorUtils.WHITE; + backcolor = HColorUtils.WHITE; } if (forecolor == null) { - forecolor = HtmlColorUtils.BLACK; + forecolor = HColorUtils.BLACK; } - final HtmlColorGradient gradient = new HtmlColorGradient(backcolor, forecolor, '\0'); + final HColorGradient gradient = new HColorGradient(backcolor, forecolor, '\0'); for (int col = 0; col < width; col++) { for (int line = 0; line < height; line++) { final int localColor = color[line][col]; @@ -114,10 +116,10 @@ public UImage toUImage(ColorMapper colorMapper, HtmlColor backcolor, HtmlColor f } } } - return new UImage(im); + return new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR)); } - public TextBlock asTextBlock(final HtmlColor color, final double scale) { + public TextBlock asTextBlock(final HColor color, final double scale) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteColorBuilder.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteColorBuilder.java similarity index 93% rename from src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteColorBuilder.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteColorBuilder.java index d1f31d42d..9414897a0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteColorBuilder.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteColorBuilder.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.ugraphic.sprite; +package net.sourceforge.plantuml.sprite; import java.awt.Color; import java.awt.image.BufferedImage; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteColorBuilder4096.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteColorBuilder4096.java similarity index 93% rename from src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteColorBuilder4096.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteColorBuilder4096.java index 3d2a3aa38..fcb62bd44 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteColorBuilder4096.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteColorBuilder4096.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.ugraphic.sprite; +package net.sourceforge.plantuml.sprite; import java.awt.Color; import java.awt.image.BufferedImage; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteGrayLevel.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteGrayLevel.java similarity index 91% rename from src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteGrayLevel.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteGrayLevel.java index ea321afe7..f69805513 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteGrayLevel.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteGrayLevel.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,11 +28,10 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.ugraphic.sprite; +package net.sourceforge.plantuml.sprite; import java.awt.Color; import java.awt.image.BufferedImage; -import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -40,11 +39,13 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.code.AsciiEncoder; import net.sourceforge.plantuml.code.AsciiEncoderFinalZeros; +import net.sourceforge.plantuml.code.ByteArray; import net.sourceforge.plantuml.code.CompressionZlib; import net.sourceforge.plantuml.code.CompressionZopfliZlib; +import net.sourceforge.plantuml.code.NoPlantumlCompressionException; import net.sourceforge.plantuml.code.PairInt; import net.sourceforge.plantuml.code.SpiralOnRectangle; -import net.sourceforge.plantuml.ugraphic.ColorChangerMonochrome; +import net.sourceforge.plantuml.ugraphic.color.ColorChangerMonochrome; public enum SpriteGrayLevel { @@ -276,18 +277,23 @@ private List cut(String s) { return Collections.unmodifiableList(result); } - public Sprite buildSpriteZ(int width, int height, String compressed) throws IOException { + public Sprite buildSpriteZ(int width, int height, String compressed) { final byte comp[] = new AsciiEncoder().decode(compressed); - final byte img[] = new CompressionZlib().decompress(comp); - final SpriteMonochrome result = new SpriteMonochrome(width, height, nbColor); - int cpt = 0; - for (int line = 0; line < result.getHeight(); line++) { - for (int col = 0; col < result.getWidth(); col++) { - result.setGrey(col, line, img[cpt++]); + try { + final ByteArray img = new CompressionZlib().decompress(comp); + final SpriteMonochrome result = new SpriteMonochrome(width, height, nbColor); + int cpt = 0; + for (int line = 0; line < result.getHeight(); line++) { + for (int col = 0; col < result.getWidth(); col++) { + result.setGrey(col, line, img.getByteAt(cpt++)); + } } + return result; + } catch (NoPlantumlCompressionException e) { + e.printStackTrace(); + return null; } - return result; } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteImage.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteImage.java similarity index 76% rename from src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteImage.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteImage.java index 37002d71a..9f74b8bce 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteImage.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteImage.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,40 +28,44 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.ugraphic.sprite; +package net.sourceforge.plantuml.sprite; import java.awt.geom.Dimension2D; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; -import javax.imageio.ImageIO; - import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.security.ImageIO; +import net.sourceforge.plantuml.ugraphic.AffineTransformType; +import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; public class SpriteImage implements Sprite { private final UImage img; public SpriteImage(BufferedImage img) { - this.img = new UImage(img); + if (img == null) { + throw new IllegalArgumentException(); + } + this.img = new UImage(new PixelImage(img, AffineTransformType.TYPE_BILINEAR)); } - public TextBlock asTextBlock(final HtmlColor color, final double scale) { + public TextBlock asTextBlock(final HColor color, final double scale) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { if (color == null) { ug.draw(img.scale(scale)); } else { - ug.draw(img.muteColor(((HtmlColorSimple) color).getColor999()).scale(scale)); + ug.draw(img.muteColor(((HColorSimple) color).getColor999()).scale(scale)); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteMonochrome.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteMonochrome.java similarity index 82% rename from src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteMonochrome.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteMonochrome.java index bd9065a9a..aae9b0565 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteMonochrome.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteMonochrome.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.ugraphic.sprite; +package net.sourceforge.plantuml.sprite; import java.awt.Color; import java.awt.geom.Dimension2D; @@ -38,15 +38,17 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorGradient; -import net.sourceforge.plantuml.graphic.HtmlColorSimple; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.ColorMapper; +import net.sourceforge.plantuml.ugraphic.AffineTransformType; +import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; +import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorGradient; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class SpriteMonochrome implements Sprite { @@ -176,19 +178,19 @@ public int getWidth() { return width; } - public UImage toUImage(ColorMapper colorMapper, HtmlColor backcolor, HtmlColor color) { + public UImage toUImage(ColorMapper colorMapper, HColor backcolor, HColor color) { if (backcolor == null) { - backcolor = HtmlColorUtils.WHITE; + backcolor = HColorUtils.WHITE; } if (color == null) { - color = HtmlColorUtils.BLACK; + color = HColorUtils.BLACK; } // if (backcolor instanceof HtmlColorGradient) { // return special(colorMapper, (HtmlColorGradient) backcolor, color); // } final BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); - final HtmlColorGradient gradient = new HtmlColorGradient(backcolor, color, '\0'); + final HColorGradient gradient = new HColorGradient(backcolor, color, '\0'); for (int col = 0; col < width; col++) { for (int line = 0; line < height; line++) { final double coef = 1.0 * grey[line][col] / (grayLevel - 1); @@ -196,25 +198,25 @@ public UImage toUImage(ColorMapper colorMapper, HtmlColor backcolor, HtmlColor c im.setRGB(col, line, c.getRGB()); } } - return new UImage(im); + return new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR)); } - private UImage special(ColorMapper colorMapper, HtmlColorGradient backcolor, HtmlColor color) { + private UImage special(ColorMapper colorMapper, HColorGradient backcolor, HColor color) { final BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); for (int col = 0; col < width; col++) { for (int line = 0; line < height; line++) { - final HtmlColor backColorLocal = new HtmlColorSimple(backcolor.getColor(colorMapper, 1.0 * line - / height), false); - final HtmlColorGradient gradient = new HtmlColorGradient(backColorLocal, color, '\0'); + final HColor backColorLocal = new HColorSimple(backcolor.getColor(colorMapper, 1.0 * line / height), + false); + final HColorGradient gradient = new HColorGradient(backColorLocal, color, '\0'); final double coef = 1.0 * grey[line][col] / (grayLevel - 1); final Color c = gradient.getColor(colorMapper, coef); im.setRGB(col, line, c.getRGB()); } } - return new UImage(im); + return new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR)); } - public TextBlock asTextBlock(final HtmlColor color, final double scale) { + public TextBlock asTextBlock(final HColor color, final double scale) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteSvg.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteSvg.java similarity index 74% rename from src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteSvg.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteSvg.java index d0fac306e..18a68497b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteSvg.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteSvg.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,22 +28,18 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.ugraphic.sprite; +package net.sourceforge.plantuml.sprite; import java.awt.geom.Dimension2D; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.FileUtils; import net.sourceforge.plantuml.SvgString; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImageSvg; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class SpriteSvg implements Sprite { @@ -53,15 +49,7 @@ public SpriteSvg(String svg) { this.img = new UImageSvg(new SvgString(svg, 1)); } - public SpriteSvg(File svgFile) throws IOException { - this(FileUtils.readSvg(svgFile)); - } - - public SpriteSvg(InputStream is) throws IOException { - this(FileUtils.readSvg(is)); - } - - public TextBlock asTextBlock(final HtmlColor color, final double scale) { + public TextBlock asTextBlock(final HColor color, final double scale) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteUtils.java similarity index 93% rename from src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteUtils.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteUtils.java index ccc671029..d1fd9a334 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/SpriteUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.ugraphic.sprite; +package net.sourceforge.plantuml.sprite; import java.awt.image.BufferedImage; import java.util.List; diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java new file mode 100644 index 000000000..c292e154c --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java @@ -0,0 +1,168 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.sprite; + +import java.awt.geom.Dimension2D; +import java.io.IOException; +import java.io.OutputStream; +import java.util.List; + +import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.FileFormatOption; +import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.SkinParam; +import net.sourceforge.plantuml.UmlDiagram; +import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.WithSprite; +import net.sourceforge.plantuml.command.BlocLines; +import net.sourceforge.plantuml.command.Command; +import net.sourceforge.plantuml.command.CommandFactorySprite; +import net.sourceforge.plantuml.core.DiagramDescription; +import net.sourceforge.plantuml.core.ImageData; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.preproc.Stdlib; +import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; +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.HColorUtils; + +public class StdlibDiagram extends UmlDiagram { + + private static final int WIDTH = 1800; + private String name; + + public StdlibDiagram(ISkinSimple skinParam) { + super(skinParam); + } + + public DiagramDescription getDescription() { + return new DiagramDescription("(Sprites)"); + } + + @Override + public UmlDiagramType getUmlDiagramType() { + return UmlDiagramType.HELP; + } + + @Override + protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) + throws IOException { + + final TextBlock result = getTable(); + + final double dpiFactor = 1; + final int margin1; + final int margin2; + if (SkinParam.USE_STYLES()) { + margin1 = SkinParam.zeroMargin(10); + margin2 = SkinParam.zeroMargin(10); + } else { + margin1 = 10; + margin2 = 10; + } + final ImageBuilder imageBuilder = ImageBuilder.buildD(getSkinParam(), ClockwiseTopRightBottomLeft.margin1margin2((double) margin1, (double) margin2), getAnimation(), fileFormatOption.isWithMetadata() ? getMetadata() : null, + getWarningOrError(), dpiFactor); + imageBuilder.setUDrawable(result); + + return imageBuilder.writeImageTOBEMOVED(fileFormatOption, seed(), os); + } + + private TextBlock getTable() { + return new AbstractTextBlock() { + + public void drawU(UGraphic ug) { + try { + drawInternal(ug); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return new Dimension2DDouble(WIDTH, 4096); + } + }; + } + + public void setStdlibName(String name) { + this.name = name; + } + + private void drawInternal(UGraphic ug) throws IOException { + double x = 0; + double y = 0; + double rawHeight = 0; + final Stdlib folder = Stdlib.retrieve(name); + + final CommandFactorySprite factorySpriteCommand = new CommandFactorySprite(); + + Command cmd = factorySpriteCommand.createMultiLine(false); + + final List all = folder.extractAllSprites(); + int nb = 0; + for (String s : all) { + // System.err.println("s="+s); + final BlocLines bloc = BlocLines.fromArray(s.split("\n")); + cmd.execute(this, bloc); +// System.err.println("nb=" + nb); + nb++; + } + + for (String n : getSkinParam().getAllSpriteNames()) { + 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); + tb = TextBlockUtils.mergeTB(tb, blockName, HorizontalAlignment.CENTER); + tb.drawU(ug.apply(new UTranslate(x, y))); + final Dimension2D dim = tb.calculateDimension(ug.getStringBounder()); + rawHeight = Math.max(rawHeight, dim.getHeight()); + x += dim.getWidth(); + x += 30; + if (x > WIDTH) { + x = 0; + y += rawHeight + 50; + rawHeight = 0; + if (y > 1024) { +// break; + } + } + } + } +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/ObjectDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/StdlibDiagramFactory.java similarity index 56% rename from src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/ObjectDiagram.java rename to src/plantuml-asl/src/net/sourceforge/plantuml/sprite/StdlibDiagramFactory.java index c887283a9..c75bfd514 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/objectdiagram/ObjectDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/sprite/StdlibDiagramFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -28,32 +28,34 @@ * * Original Author: Arnaud Roques */ -package net.sourceforge.plantuml.objectdiagram; +package net.sourceforge.plantuml.sprite; + +import java.util.ArrayList; +import java.util.List; import net.sourceforge.plantuml.ISkinSimple; -import net.sourceforge.plantuml.UmlDiagramType; -import net.sourceforge.plantuml.cucadiagram.Code; -import net.sourceforge.plantuml.cucadiagram.ILeaf; -import net.sourceforge.plantuml.cucadiagram.LeafType; -import net.sourceforge.plantuml.graphic.USymbol; +import net.sourceforge.plantuml.command.Command; +import net.sourceforge.plantuml.command.UmlDiagramFactory; + +public class StdlibDiagramFactory extends UmlDiagramFactory { -public class ObjectDiagram extends AbstractClassOrObjectDiagram { + private final ISkinSimple skinParam; - public ObjectDiagram(ISkinSimple skinParam) { - super(skinParam); + public StdlibDiagramFactory(ISkinSimple skinParam) { + this.skinParam = skinParam; } @Override - public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) { - if (type == null) { - type = LeafType.OBJECT; - } - return getOrCreateLeafDefault(code, type, symbol); + protected List createCommands() { + + final List cmds = new ArrayList(); + cmds.add(new CommandStdlib()); + return cmds; } @Override - public UmlDiagramType getUmlDiagramType() { - return UmlDiagramType.OBJECT; + public StdlibDiagram createEmptyDiagram() { + return new StdlibDiagram(skinParam); } } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/StateDiagram.java b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/StateDiagram.java index 455309812..e8868405b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/StateDiagram.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/StateDiagram.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -27,6 +27,7 @@ * * * Original Author: Arnaud Roques + * Contribution : Serge Wenger */ package net.sourceforge.plantuml.statediagram; @@ -39,6 +40,8 @@ import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; +import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; @@ -51,13 +54,40 @@ public class StateDiagram extends AbstractEntityDiagram { public StateDiagram(ISkinSimple skinParam) { super(skinParam); + // setNamespaceSeparator(null); } - public boolean checkConcurrentStateOk(Code code) { + public boolean checkConcurrentStateOk(Ident ident, Code code) { + if (this.V1972()) { + return checkConcurrentStateOkInternal1972(ident); + } + final boolean result = checkConcurrentStateOkInternal(code); + // System.err.println("checkConcurrentStateOk " + code + " " + ident + " " + + // result); + return result; + } + + private boolean checkConcurrentStateOkInternal(Code code) { if (leafExist(code) == false) { return true; } - final IEntity existing = this.getLeafsget(code); + final IEntity existing = this.getLeaf(code); + if (getCurrentGroup().getGroupType() == GroupType.CONCURRENT_STATE + && getCurrentGroup() != existing.getParentContainer()) { + return false; + } + if (existing.getParentContainer().getGroupType() == GroupType.CONCURRENT_STATE + && getCurrentGroup() != existing.getParentContainer()) { + return false; + } + return true; + } + + private boolean checkConcurrentStateOkInternal1972(Ident ident) { + if (leafExistSmart(ident) == false) { + return true; + } + final IEntity existing = this.getLeafSmart(ident); if (getCurrentGroup().getGroupType() == GroupType.CONCURRENT_STATE && getCurrentGroup() != existing.getParentContainer()) { return false; @@ -70,52 +100,116 @@ && getCurrentGroup() != existing.getParentContainer()) { } @Override - public IEntity getOrCreateLeaf(Code code, LeafType type, USymbol symbol) { - if (checkConcurrentStateOk(code) == false) { + public IEntity getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol) { + checkNotNull(ident); + if (checkConcurrentStateOk(ident, code) == false) { throw new IllegalStateException("Concurrent State " + code); } - if (type == null) { - if (code.getFullName().startsWith("[*]")) { + if (!this.V1972() && type == null) { + if (code.getName().startsWith("[*]")) { throw new IllegalArgumentException(); } if (isGroup(code)) { return getGroup(code); } - return getOrCreateLeafDefault(code, LeafType.STATE, null); + return getOrCreateLeafDefault(ident, code, LeafType.STATE, null); + } + if (this.V1972() && type == null) { + if (ident.getName().startsWith("[*]")) { + throw new IllegalArgumentException(); + } + if (isGroupVerySmart(ident)) { + return getGroupVerySmart(ident); + } + if (getNamespaceSeparator() == null) { + final ILeaf result = getLeafVerySmart(ident); + if (result != null) { + return result; + } + + } + return getOrCreateLeafDefault(ident, code, LeafType.STATE, null); } - return getOrCreateLeafDefault(code, type, symbol); + return getOrCreateLeafDefault(ident, code, type, symbol); } public IEntity getStart() { final IGroup g = getCurrentGroup(); if (EntityUtils.groupRoot(g)) { - return getOrCreateLeaf(Code.of("*start"), LeafType.CIRCLE_START, null); + final Ident ident = buildLeafIdent("*start"); + final Code code = this.V1972() ? ident : buildCode("*start"); + return getOrCreateLeaf(ident, code, LeafType.CIRCLE_START, null); } - return getOrCreateLeaf(Code.of("*start*" + g.getCode().getFullName()), LeafType.CIRCLE_START, null); + final String idShort = "*start*" + g.getCodeGetName(); + final Ident ident = buildLeafIdent(idShort); + final Code code = this.V1972() ? ident : buildCode(idShort); + return getOrCreateLeaf(ident, code, LeafType.CIRCLE_START, null); } public IEntity getEnd() { final IGroup p = getCurrentGroup(); if (EntityUtils.groupRoot(p)) { - return getOrCreateLeaf(Code.of("*end"), LeafType.CIRCLE_END, null); + final Ident ident = buildLeafIdent("*end"); + final Code code = this.V1972() ? ident : buildCode("*end"); + return getOrCreateLeaf(ident, code, LeafType.CIRCLE_END, null); } - return getOrCreateLeaf(Code.of("*end*" + p.getCode().getFullName()), LeafType.CIRCLE_END, null); + final String idShort = "*end*" + p.getCodeGetName(); + final Ident ident = buildLeafIdent(idShort); + final Code code = this.V1972() ? ident : buildCode(idShort); + return getOrCreateLeaf(ident, code, LeafType.CIRCLE_END, null); } public IEntity getHistorical() { final IGroup g = getCurrentGroup(); if (EntityUtils.groupRoot(g)) { - return getOrCreateLeaf(Code.of("*historical"), LeafType.PSEUDO_STATE, null); + final Ident ident = buildLeafIdent("*historical"); + final Code code = buildCode("*historical"); + return getOrCreateLeaf(ident, code, LeafType.PSEUDO_STATE, null); + } + final String idShort = "*historical*" + g.getCodeGetName(); + final Ident ident = buildLeafIdent(idShort); + final Code code = this.V1972() ? ident : buildCode(idShort); + return getOrCreateLeaf(ident, code, LeafType.PSEUDO_STATE, null); + } + + public IEntity getHistorical(String idShort) { + final Ident idNewLong = buildLeafIdent(idShort); + final Code codeGroup = this.V1972() ? idNewLong : buildCode(idShort); + gotoGroup(idNewLong, codeGroup, Display.getWithNewlines(codeGroup), GroupType.STATE, getRootGroup(), + NamespaceStrategy.SINGLE); + final IEntity g = getCurrentGroup(); + final String tmp = "*historical*" + g.getCodeGetName(); + final Ident ident = buildLeafIdent(tmp); + final Code code = this.V1972() ? ident : buildCode(tmp); + final IEntity result = getOrCreateLeaf(ident, code, LeafType.PSEUDO_STATE, null); + endGroup(); + return result; + } + + public IEntity getDeepHistory() { + final IGroup g = getCurrentGroup(); + if (EntityUtils.groupRoot(g)) { + final Ident ident = buildLeafIdent("*deephistory"); + final Code code = buildCode("*deephistory"); + return getOrCreateLeaf(ident, code, LeafType.DEEP_HISTORY, null); } - return getOrCreateLeaf(Code.of("*historical*" + g.getCode().getFullName()), LeafType.PSEUDO_STATE, null); + + final String idShort = "*deephistory*" + g.getCodeGetName(); + final Ident ident = buildLeafIdent(idShort); + final Code code = this.V1972() ? ident : buildCode(idShort); + return getOrCreateLeaf(ident, code, LeafType.DEEP_HISTORY, null); } - public IEntity getHistorical(Code codeGroup) { - gotoGroup2(codeGroup, Display.getWithNewlines(codeGroup), GroupType.STATE, getRootGroup(), + public IEntity getDeepHistory(String idShort) { + final Ident idNewLong = buildLeafIdent(idShort); + final Code codeGroup = this.V1972() ? idNewLong : buildCode(idShort); + gotoGroup(idNewLong, codeGroup, Display.getWithNewlines(codeGroup), GroupType.STATE, getRootGroup(), NamespaceStrategy.SINGLE); final IEntity g = getCurrentGroup(); - final IEntity result = getOrCreateLeaf(Code.of("*historical*" + g.getCode().getFullName()), - LeafType.PSEUDO_STATE, null); + final String tmp = "*deephistory*" + g.getCodeGetName(); + final Ident ident = buildLeafIdent(tmp); + final Code code = this.V1972() ? ident : buildCode(tmp); + final IEntity result = getOrCreateLeaf(ident, code, LeafType.DEEP_HISTORY, null); endGroup(); return result; } @@ -127,14 +221,20 @@ public boolean concurrentState(char direction) { super.endGroup(); } getCurrentGroup().setConcurrentSeparator(direction); - gotoGroup2(UniqueSequence.getCode(CONCURRENT_PREFIX), Display.create(""), GroupType.CONCURRENT_STATE, - getCurrentGroup(), NamespaceStrategy.SINGLE); + final String tmp1 = UniqueSequence.getString(CONCURRENT_PREFIX); + final Ident ident1 = buildLeafIdent(tmp1); + final Code code1 = this.V1972() ? ident1 : buildCode(tmp1); + gotoGroup(ident1, code1, Display.create(""), GroupType.CONCURRENT_STATE, getCurrentGroup(), + NamespaceStrategy.SINGLE); final IGroup conc1 = getCurrentGroup(); if (EntityUtils.groupRoot(cur) == false && cur.getGroupType() == GroupType.STATE) { cur.moveEntitiesTo(conc1); super.endGroup(); - gotoGroup2(UniqueSequence.getCode(CONCURRENT_PREFIX), Display.create(""), GroupType.CONCURRENT_STATE, - getCurrentGroup(), NamespaceStrategy.SINGLE); + final String tmp2 = UniqueSequence.getString(CONCURRENT_PREFIX); + final Ident ident2 = buildLeafIdent(tmp2); + final Code code2 = this.V1972() ? ident2 : buildCode(tmp2); + gotoGroup(ident2, code2, Display.create(""), GroupType.CONCURRENT_STATE, getCurrentGroup(), + NamespaceStrategy.SINGLE); } // printlink("AFTER"); return true; @@ -179,8 +279,7 @@ public String checkFinalError() { final IGroup parent2 = getGroupParentIfItIsConcurrentState(link.getEntity2()); if (isCompatible(parent1, parent2) == false) { return "State within concurrent state cannot be linked out of this concurrent state (between " - + link.getEntity1().getCode().getFullName() + " and " - + link.getEntity2().getCode().getFullName() + ")"; + + link.getEntity1().getCodeGetName() + " and " + link.getEntity2().getCodeGetName() + ")"; } } return super.checkFinalError(); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/StateDiagramFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/StateDiagramFactory.java index aa904c1ab..b3501a52e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/StateDiagramFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/StateDiagramFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -35,15 +35,16 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2; +import net.sourceforge.plantuml.classdiagram.command.CommandNamespaceSeparator; import net.sourceforge.plantuml.classdiagram.command.CommandRemoveRestore; 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.UmlDiagramFactory; -import net.sourceforge.plantuml.command.note.FactoryNoteCommand; -import net.sourceforge.plantuml.command.note.FactoryNoteOnEntityCommand; -import net.sourceforge.plantuml.command.note.FactoryNoteOnLinkCommand; +import net.sourceforge.plantuml.command.note.CommandFactoryNote; +import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnEntity; +import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnLink; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.statediagram.command.CommandAddField; @@ -71,17 +72,15 @@ protected List createCommands() { final List cmds = new ArrayList(); cmds.add(new CommandFootboxIgnored()); cmds.add(new CommandRankDir()); - // cmds.add(new CommandHideEmptyDescription()); cmds.add(new CommandRemoveRestore()); cmds.add(new CommandCreateState()); - // addCommand(new CommandLinkState()); cmds.add(new CommandLinkState()); cmds.add(new CommandCreatePackageState()); cmds.add(new CommandEndState()); cmds.add(new CommandAddField()); cmds.add(new CommandConcurrentState()); - final FactoryNoteOnEntityCommand factoryNoteOnEntityCommand = new FactoryNoteOnEntityCommand("state", + final CommandFactoryNoteOnEntity factoryNoteOnEntityCommand = new CommandFactoryNoteOnEntity("state", new RegexOr("ENTITY", new RegexLeaf("[\\p{L}0-9_.]+"), // new RegexLeaf("[%g][^%g]+[%g]") // )); @@ -89,17 +88,18 @@ protected List createCommands() { cmds.add(factoryNoteOnEntityCommand.createMultiLine(false)); cmds.add(factoryNoteOnEntityCommand.createSingleLine()); - final FactoryNoteOnLinkCommand factoryNoteOnLinkCommand = new FactoryNoteOnLinkCommand(); + final CommandFactoryNoteOnLink factoryNoteOnLinkCommand = new CommandFactoryNoteOnLink(); cmds.add(factoryNoteOnLinkCommand.createSingleLine()); cmds.add(factoryNoteOnLinkCommand.createMultiLine(false)); cmds.add(new CommandUrl()); - final FactoryNoteCommand factoryNoteCommand = new FactoryNoteCommand(); + final CommandFactoryNote factoryNoteCommand = new CommandFactoryNote(); cmds.add(factoryNoteCommand.createSingleLine()); cmds.add(factoryNoteCommand.createMultiLine(false)); addCommonCommands1(cmds); cmds.add(new CommandHideShow2()); + cmds.add(new CommandNamespaceSeparator()); return cmds; } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandAddField.java b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandAddField.java index 7c3c27b42..88b5eebd7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandAddField.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandAddField.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -40,6 +40,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.statediagram.StateDiagram; public class CommandAddField extends SingleLineCommand2 { @@ -61,12 +62,20 @@ private static IRegex getRegexConcat() { @Override protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) { - final String code = arg.getLazzy("CODE", 0); + final String codeString = arg.getLazzy("CODE", 0); final String field = arg.get("FIELD", 0); - final IEntity entity = diagram.getOrCreateLeaf(Code.of(code), null, null); + Ident ident = diagram.buildLeafIdent(codeString); + if (diagram.V1972()) { + // This is very bad. xi04 xc06 + if (ident.parent().getLast().equals(codeString)) { + ident = ident.parent(); + } + } + final Code code = diagram.V1972() ? ident : diagram.buildCode(codeString); + final IEntity entity = diagram.getOrCreateLeaf(ident, code, null, null); - entity.getBodier().addFieldOrMethod(field, entity); + entity.getBodier().addFieldOrMethod(field); return CommandExecutionResult.ok(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandConcurrentState.java b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandConcurrentState.java index 986be8d6a..599db70ec 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandConcurrentState.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandConcurrentState.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java index 7185bed87..5e589377e 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -47,13 +47,14 @@ import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.statediagram.StateDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandCreatePackageState extends SingleLineCommand2 { @@ -104,12 +105,14 @@ private String getNotNull(RegexResult arg, String v1, String v2) { @Override protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) { final IGroup currentPackage = diagram.getCurrentGroup(); - final Code code = Code.of(getNotNull(arg, "CODE1", "CODE2")); + final String idShort = getNotNull(arg, "CODE1", "CODE2"); + final Ident idNewLong = diagram.buildLeafIdentSpecial(idShort); + final Code code = diagram.V1972() ? idNewLong : diagram.buildCode(idShort); String display = getNotNull(arg, "DISPLAY1", "DISPLAY2"); if (display == null) { - display = code.getFullName(); + display = code.getName(); } - diagram.gotoGroup2(code, Display.getWithNewlines(display), GroupType.STATE, currentPackage, + diagram.gotoGroup(idNewLong, code, Display.getWithNewlines(display), GroupType.STATE, currentPackage, NamespaceStrategy.SINGLE); final IEntity p = diagram.getCurrentGroup(); final String stereotype = arg.get("STEREOTYPE", 0); @@ -125,7 +128,7 @@ protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation l Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); - final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); + final HColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); if (lineColor != null) { colors = colors.add(ColorType.LINE, lineColor); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java index 827387808..21269fa42 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -45,13 +45,14 @@ import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.statediagram.StateDiagram; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class CommandCreateState extends SingleLineCommand2 { @@ -98,18 +99,20 @@ private static ColorParser color() { @Override protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) { - final Code code = Code.of(arg.getLazzy("CODE", 0)); + final String idShort = arg.getLazzy("CODE", 0); + final Ident ident = diagram.buildLeafIdent(idShort); + final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); String display = arg.getLazzy("DISPLAY", 0); if (display == null) { - display = code.getFullName(); + display = code.getName(); } final String stereotype = arg.get("STEREOTYPE", 0); final LeafType type = getTypeFromStereotype(stereotype); - if (diagram.checkConcurrentStateOk(code) == false) { - return CommandExecutionResult.error("The state " + code.getFullName() + if (diagram.checkConcurrentStateOk(ident, code) == false) { + return CommandExecutionResult.error("The state " + code.getName() + " has been created in a concurrent state : it cannot be used here."); } - final IEntity ent = diagram.getOrCreateLeaf(code, type, null); + final IEntity ent = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), code, type, null); ent.setDisplay(Display.getWithNewlines(display)); if (stereotype != null) { @@ -124,7 +127,7 @@ protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation l Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); - final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); + final HColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); if (lineColor != null) { colors = colors.add(ColorType.LINE, lineColor); } @@ -141,7 +144,7 @@ protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation l final String addFields = arg.get("ADDFIELD", 0); if (addFields != null) { - ent.getBodier().addFieldOrMethod(addFields, ent); + ent.getBodier().addFieldOrMethod(addFields); } return CommandExecutionResult.ok(); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandEndState.java b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandEndState.java index e9168042e..f4601d243 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandEndState.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandEndState.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandHideEmptyDescription.java b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandHideEmptyDescription.java index 53a5e56f2..6e7fc049b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandHideEmptyDescription.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandHideEmptyDescription.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandLinkState.java b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandLinkState.java index b16066ac8..02ed1d997 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandLinkState.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/statediagram/command/CommandLinkState.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -27,6 +27,7 @@ * * * Original Author: Arnaud Roques + * Contribution : Serge Wenger */ package net.sourceforge.plantuml.statediagram.command; @@ -43,6 +44,7 @@ import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; @@ -63,7 +65,7 @@ static RegexConcat getRegex() { getStatePattern("ENT1"), // RegexLeaf.spaceZeroOrMore(), // new RegexConcat( - // + // new RegexLeaf("ARROW_CROSS_START", "(x)?"), // new RegexLeaf("ARROW_BODY1", "(-+)"), // new RegexLeaf("ARROW_STYLE1", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), // @@ -84,9 +86,8 @@ static RegexConcat getRegex() { } private static RegexLeaf getStatePattern(String name) { - return new RegexLeaf( - name, - "([\\p{L}0-9_.]+|[\\p{L}0-9_.]+\\[H\\]|\\[\\*\\]|\\[H\\]|(?:==+)(?:[\\p{L}0-9_.]+)(?:==+))[%s]*(\\<\\<.*\\>\\>)?[%s]*(#\\w+)?"); + return new RegexLeaf(name, + "([\\p{L}0-9_.]+|[\\p{L}0-9_.]+\\[H\\*?\\]|\\[\\*\\]|\\[H\\*?\\]|(?:==+)(?:[\\p{L}0-9_.]+)(?:==+))[%s]*(\\<\\<.*\\>\\>)?[%s]*(#\\w+)?"); } @Override @@ -96,13 +97,13 @@ protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation l final IEntity cl1 = getEntityStart(diagram, ent1); if (cl1 == null) { - return CommandExecutionResult.error("The state " + ent1 - + " has been created in a concurrent state : it cannot be used here."); + return CommandExecutionResult + .error("The state " + ent1 + " has been created in a concurrent state : it cannot be used here."); } final IEntity cl2 = getEntityEnd(diagram, ent2); if (cl2 == null) { - return CommandExecutionResult.error("The state " + ent2 - + " has been created in a concurrent state : it cannot be used here."); + return CommandExecutionResult + .error("The state " + ent2 + " has been created in a concurrent state : it cannot be used here."); } if (arg.get("ENT1", 1) != null) { @@ -146,27 +147,6 @@ protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation l return CommandExecutionResult.ok(); } - // public static void applyStyle(String arrowStyle, Link link) { - // if (arrowStyle == null) { - // return; - // } - // final StringTokenizer st = new StringTokenizer(arrowStyle, ","); - // while (st.hasMoreTokens()) { - // final String s = st.nextToken(); - // if (s.equalsIgnoreCase("dashed")) { - // link.goDashed(); - // } else if (s.equalsIgnoreCase("bold")) { - // link.goBold(); - // } else if (s.equalsIgnoreCase("dotted")) { - // link.goDotted(); - // } else if (s.equalsIgnoreCase("hidden")) { - // link.goHidden(); - // } else { - // link.setSpecificColor(s); - // } - // } - // } - private Direction getDirection(RegexResult arg) { final String arrowDirection = arg.get("ARROW_DIRECTION", 0); if (arrowDirection != null) { @@ -175,24 +155,45 @@ private Direction getDirection(RegexResult arg) { return null; } - private IEntity getEntityStart(StateDiagram system, String code) { - if (code.startsWith("[*]")) { - return system.getStart(); + private IEntity getEntityStart(StateDiagram diagram, final String codeString) { + if (codeString.startsWith("[*]")) { + return diagram.getStart(); + } + return getFoo1(diagram, codeString); + } + + private IEntity getEntityEnd(StateDiagram diagram, final String codeString) { + if (codeString.startsWith("[*]")) { + return diagram.getEnd(); + } + return getFoo1(diagram, codeString); + } + + private IEntity getFoo1(StateDiagram diagram, final String codeString) { + if (codeString.equalsIgnoreCase("[H]")) { + return diagram.getHistorical(); + } + if (codeString.endsWith("[H]")) { + return diagram.getHistorical(codeString.substring(0, codeString.length() - 3)); } - if (code.equalsIgnoreCase("[H]")) { - return system.getHistorical(); + if (codeString.equalsIgnoreCase("[H*]")) { + return diagram.getDeepHistory(); } - if (code.endsWith("[H]")) { - return system.getHistorical(Code.of(code.substring(0, code.length() - 3))); + if (codeString.endsWith("[H*]")) { + return diagram.getDeepHistory(codeString.substring(0, codeString.length() - 4)); } - if (code.startsWith("=") && code.endsWith("=")) { - code = removeEquals(code); - return system.getOrCreateLeaf(Code.of(code), LeafType.SYNCHRO_BAR, null); + if (codeString.startsWith("=") && codeString.endsWith("=")) { + final String codeString1 = removeEquals(codeString); + final Ident ident1 = diagram.buildLeafIdent(codeString1); + final Code code1 = diagram.V1972() ? ident1 : diagram.buildCode(codeString1); + return diagram.getOrCreateLeaf(ident1, code1, LeafType.SYNCHRO_BAR, null); } - if (system.checkConcurrentStateOk(Code.of(code)) == false) { + final Ident ident = diagram.buildLeafIdent(codeString); + final Code code = diagram.V1972() ? ident : diagram.buildCode(codeString); + if (diagram.checkConcurrentStateOk(ident, code) == false) { return null; } - return system.getOrCreateLeaf(Code.of(code), null, null); + return diagram.getOrCreateLeaf(ident, code, null, null); } private String removeEquals(String code) { @@ -205,21 +206,4 @@ private String removeEquals(String code) { return code; } - private IEntity getEntityEnd(StateDiagram system, String code) { - if (code.startsWith("[*]")) { - return system.getEnd(); - } - if (code.endsWith("[H]")) { - return system.getHistorical(Code.of(code.substring(0, code.length() - 3))); - } - if (code.startsWith("=") && code.endsWith("=")) { - code = removeEquals(code); - return system.getOrCreateLeaf(Code.of(code), LeafType.SYNCHRO_BAR, null); - } - if (system.checkConcurrentStateOk(Code.of(code)) == false) { - return null; - } - return system.getOrCreateLeaf(Code.of(code), null, null); - } - } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/CreoleConverter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/CreoleConverter.java index 39ef96c95..9860df508 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/CreoleConverter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/CreoleConverter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/FormatCounter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/FormatCounter.java index cac5b1f9b..1c430779c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/FormatCounter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/FormatCounter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/HistoricalData.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/HistoricalData.java index 630d9ba33..9adaa0853 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/HistoricalData.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/HistoricalData.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/HtmlConverter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/HtmlConverter.java index d40881b63..68178b3a6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/HtmlConverter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/HtmlConverter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/HumanDuration.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/HumanDuration.java index bfc84d605..daaa69b6a 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/HumanDuration.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/HumanDuration.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/PSystemStats.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/PSystemStats.java index 91ca88577..15aaaa28b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/PSystemStats.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/PSystemStats.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -41,8 +41,8 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.svek.TextBlockBackcolored; -import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; public class PSystemStats extends AbstractPSystem { @@ -57,8 +57,8 @@ public class PSystemStats extends AbstractPSystem { final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) throws IOException { final TextBlockBackcolored result = getGraphicStrings(); - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, result.getBackcolor(), - getMetadata(), null, 0, 0, null, false); + final ImageBuilder imageBuilder = ImageBuilder.buildA(new ColorMapperIdentity(), + false, null, getMetadata(), null, 1.0, result.getBackcolor()); imageBuilder.setUDrawable(result); return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os); } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/PSystemStatsFactory.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/PSystemStatsFactory.java index 6f93eaeed..f1bdff7b0 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/PSystemStatsFactory.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/PSystemStatsFactory.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/ParsedGenerated.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/ParsedGenerated.java index 54ca32c9f..e74945909 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/ParsedGenerated.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/ParsedGenerated.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsImpl.java index 30bc917d5..03a66e785 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsLineImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsLineImpl.java index 89d46c377..92a072ff4 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsLineImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsLineImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsTableImpl.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsTableImpl.java index 66d506e11..69e51bbfe 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsTableImpl.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsTableImpl.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsUtils.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsUtils.java index 4e2b67c75..26af60e43 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsUtils.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsUtils.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,9 +30,7 @@ */ package net.sourceforge.plantuml.stats; -import java.io.File; import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; @@ -49,6 +47,8 @@ import javax.xml.transform.TransformerException; import net.sourceforge.plantuml.Log; +import net.sourceforge.plantuml.security.SFile; +import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.stats.api.Stats; public class StatsUtils { @@ -163,7 +163,7 @@ static Stats getStatsLazzy() { static void htmlOutput(Stats stats) throws FileNotFoundException { PrintWriter pw = null; try { - pw = new PrintWriter("plantuml-stats.html"); + pw = SecurityUtils.createPrintWriter("plantuml-stats.html"); pw.print(new HtmlConverter(stats).toHtml()); } finally { if (pw != null) { @@ -172,11 +172,11 @@ static void htmlOutput(Stats stats) throws FileNotFoundException { } } - static void xmlOutput(Stats stats) throws FileNotFoundException, TransformerException, - ParserConfigurationException, IOException { + static void xmlOutput(Stats stats) + throws FileNotFoundException, TransformerException, ParserConfigurationException, IOException { OutputStream os = null; try { - os = new FileOutputStream("plantuml-stats.xml"); + os = SecurityUtils.createFileOutputStream("plantuml-stats.xml"); new XmlConverter(stats).createXml(os); } finally { if (os != null) { @@ -222,7 +222,7 @@ private static void clearScreen(PrintStream ps, int linesUsed) { if (linesUsed == 0) { return; } - if (File.separatorChar == '/') { + if (SFile.separatorChar == '/') { System.out.println(String.format("\033[%dA", linesUsed + 1)); // Move up } else { for (int i = 0; i < 20; i++) { diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsUtilsIncrement.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsUtilsIncrement.java index 4539bd52a..c8dd6b3b7 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsUtilsIncrement.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/StatsUtilsIncrement.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -56,6 +56,9 @@ public class StatsUtilsIncrement { final private static FormatCounter formatCounterEver = StatsUtils.formatCounterEver; public static void onceMoreParse(long duration, Class type) { + if (StatsUtils.fullEver == null || StatsUtils.historicalData == null) { + return; + } getByTypeCurrent(type).parsed().addValue(duration); final ParsedGenerated byTypeEver = getByTypeEver(type); byTypeEver.parsed().addValue(duration); @@ -69,6 +72,12 @@ public static void onceMoreParse(long duration, Class type) { } public static void onceMoreGenerate(long duration, Class type, FileFormat fileFormat) { + if (StatsUtils.fullEver == null || StatsUtils.historicalData == null) { + return; + } + if (formatCounterCurrent == null || formatCounterEver == null) { + return; + } getByTypeCurrent(type).generated().addValue(duration); final ParsedGenerated byTypeEver = getByTypeEver(type); byTypeEver.generated().addValue(duration); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/TextConverter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/TextConverter.java index caa89b107..5e29fdfde 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/TextConverter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/TextConverter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/TextTable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/TextTable.java index 335728cd8..148fb9c39 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/TextTable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/TextTable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/XmlConverter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/XmlConverter.java index e9735a581..0665814dc 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/XmlConverter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/XmlConverter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -46,15 +46,15 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.stats.api.Stats; import net.sourceforge.plantuml.stats.api.StatsColumn; import net.sourceforge.plantuml.stats.api.StatsLine; import net.sourceforge.plantuml.stats.api.StatsTable; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - public class XmlConverter { private final DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM); diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/api/Stats.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/api/Stats.java index 9c5d76322..09f06f4e1 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/api/Stats.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/api/Stats.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/api/StatsColumn.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/api/StatsColumn.java index 110edb687..2e88ab649 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/api/StatsColumn.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/api/StatsColumn.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/api/StatsLine.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/api/StatsLine.java index 6e74f3ceb..d7d9cfc9b 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/api/StatsLine.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/api/StatsLine.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/api/StatsTable.java b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/api/StatsTable.java index 7eaab4ede..13238cc4c 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/stats/api/StatsTable.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/stats/api/StatsTable.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/style/AutomaticCounter.java b/src/plantuml-asl/src/net/sourceforge/plantuml/style/AutomaticCounter.java index 04743f044..69ff50295 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/style/AutomaticCounter.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/style/AutomaticCounter.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/style/ClockwiseTopRightBottomLeft.java b/src/plantuml-asl/src/net/sourceforge/plantuml/style/ClockwiseTopRightBottomLeft.java index 62dadd7a4..2bc6c4a68 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/style/ClockwiseTopRightBottomLeft.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/style/ClockwiseTopRightBottomLeft.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -32,4 +32,83 @@ public class ClockwiseTopRightBottomLeft { + private final double top; + private final double right; + private final double bottom; + private final double left; + + public static ClockwiseTopRightBottomLeft same(double value) { + return new ClockwiseTopRightBottomLeft(value, value, value, value); + } + + public static ClockwiseTopRightBottomLeft none() { + return new ClockwiseTopRightBottomLeft(0, 0, 0, 0); + } + + public static ClockwiseTopRightBottomLeft read(String value) { + if (value.matches("[0-9 ]+")) { + final String split[] = value.split(" +"); + if (split.length == 1) { + final double first = Integer.parseInt(split[0]); + return new ClockwiseTopRightBottomLeft(first, first, first, first); + } + if (split.length == 2) { + final double first = Integer.parseInt(split[0]); + final double second = Integer.parseInt(split[1]); + return new ClockwiseTopRightBottomLeft(first, second, first, second); + } + if (split.length == 3) { + final double first = Integer.parseInt(split[0]); + final double second = Integer.parseInt(split[1]); + final double third = Integer.parseInt(split[2]); + return new ClockwiseTopRightBottomLeft(first, second, third, second); + } + if (split.length == 4) { + final double first = Integer.parseInt(split[0]); + final double second = Integer.parseInt(split[1]); + final double third = Integer.parseInt(split[2]); + final double forth = Integer.parseInt(split[3]); + return new ClockwiseTopRightBottomLeft(first, second, third, forth); + } + } + return none(); + } + + public static ClockwiseTopRightBottomLeft margin1margin2(double margin1, double margin2) { + return new ClockwiseTopRightBottomLeft(margin1, margin2, margin2, margin1); + } + + private ClockwiseTopRightBottomLeft(double top, double right, double bottom, double left) { + this.top = top; + this.right = right; + this.bottom = bottom; + this.left = left; + } + + @Override + public String toString() { + return "" + top + ":" + right + ":" + bottom + ":" + left; + } + + public final double getTop() { + return top; + } + + public final double getRight() { + return right; + } + + public final double getBottom() { + return bottom; + } + + public final double getLeft() { + return left; + } + + public static ClockwiseTopRightBottomLeft marginForDocument(StyleBuilder styleBuilder) { + final Style style = StyleSignature.of(SName.root, SName.document).getMergedStyle(styleBuilder); + return style.getMargin(); + } + } diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/style/CommandStyleImport.java b/src/plantuml-asl/src/net/sourceforge/plantuml/style/CommandStyleImport.java new file mode 100644 index 000000000..b9ebd570a --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/style/CommandStyleImport.java @@ -0,0 +1,95 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.style; + +import java.io.IOException; +import java.io.InputStream; + +import net.sourceforge.plantuml.FileSystem; +import net.sourceforge.plantuml.LineLocation; +import net.sourceforge.plantuml.UmlDiagram; +import net.sourceforge.plantuml.command.BlocLines; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.SingleLineCommand2; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.security.SFile; + +public class CommandStyleImport extends SingleLineCommand2 { + + public CommandStyleImport() { + super(getRegexConcat()); + } + + static IRegex getRegexConcat() { + return RegexConcat.build(CommandStyleImport.class.getName(), // + RegexLeaf.start(), // + new RegexLeaf("\\"), RegexLeaf.end()); // + } + + @Override + protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) { + final String path = arg.get("PATH", 0); + try { + final SFile f = FileSystem.getInstance().getFile(path); + BlocLines lines = null; + if (f.exists()) { + lines = BlocLines.load(f, location); + } else { + final InputStream internalIs = StyleLoader.class.getResourceAsStream("/skin/" + path); + if (internalIs != null) { + lines = BlocLines.load(internalIs, location); + } + } + if (lines == null) { + return CommandExecutionResult.error("Cannot read: " + path); + } + final StyleBuilder styleBuilder = diagram.getSkinParam().getCurrentStyleBuilder(); + for (Style modifiedStyle : StyleLoader.getDeclaredStyles(lines, styleBuilder)) { + diagram.getSkinParam().muteStyle(modifiedStyle); + } + } catch (IOException e) { + return CommandExecutionResult.error("Cannot read: " + path); + } + return CommandExecutionResult.ok(); + } +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/style/CommandStyleMultilines.java b/src/plantuml-asl/src/net/sourceforge/plantuml/style/CommandStyleMultilines.java deleted file mode 100644 index 10d93e951..000000000 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/style/CommandStyleMultilines.java +++ /dev/null @@ -1,120 +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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - * Original Author: Arnaud Roques - */ -package net.sourceforge.plantuml.style; - -import java.util.EnumMap; -import java.util.Map; - -import net.sourceforge.plantuml.SkinParam; -import net.sourceforge.plantuml.StringLocated; -import net.sourceforge.plantuml.UmlDiagram; -import net.sourceforge.plantuml.command.BlocLines; -import net.sourceforge.plantuml.command.CommandExecutionResult; -import net.sourceforge.plantuml.command.CommandMultilines2; -import net.sourceforge.plantuml.command.MultilinesStrategy; -import net.sourceforge.plantuml.command.regex.IRegex; -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.command.regex.RegexConcat; -import net.sourceforge.plantuml.command.regex.RegexLeaf; -import net.sourceforge.plantuml.command.regex.RegexResult; - -public class CommandStyleMultilines extends CommandMultilines2 { - - public CommandStyleMultilines() { - super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE); - } - - @Override - public String getPatternEnd() { - return "(?i)^[%s]*\\}[%s]*$"; - } - - private static IRegex getRegexConcat() { - return RegexConcat.build(CommandStyleMultilines.class.getName(), RegexLeaf.start(), // - new RegexLeaf("TYPE", "(style|stereotype)"), // - RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("NAME", "(\\w+(?:\\+\\w+)*)"), // - RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("\\{"), // - RegexLeaf.end() // - ); - } - - @Override - public boolean syntaxWithFinalBracket() { - return true; - } - - protected CommandExecutionResult executeNow(UmlDiagram diagram, BlocLines lines) { - if (SkinParam.USE_STYLES()) { - lines = lines.trimSmart(1); - final Style modifiedStyle = getDeclaredStyle(lines, diagram.getSkinParam().getCurrentStyleBuilder()); - diagram.getSkinParam().muteStyle(modifiedStyle); - } - - return CommandExecutionResult.ok(); - } - - public final static Pattern2 p1 = MyPattern.cmpile("^([\\w]+)[%s]+(.*)$"); - - public Style getDeclaredStyle(BlocLines lines, AutomaticCounter counter) { - lines = lines.trimSmart(1); - final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); - final String name = line0.get("NAME", 0); - final String kind = line0.get("TYPE", 0).toUpperCase(); - // System.err.println("name=" + name); - if (lines.size() > 1) { - lines = lines.subExtract(1, 1); - } - lines = lines.trim(true); - - final Map map = new EnumMap(PName.class); - for (StringLocated s : lines) { - assert s.getString().length() > 0; - - final Matcher2 m = p1.matcher(s.getString()); - if (m.find() == false) { - throw new IllegalStateException(); - } - final PName key = PName.getFromName(m.group(1)); - final String value = m.group(2); - // System.err.println("key=" + key + " " + value); - if (key != null) { - map.put(key, new ValueImpl(value, counter)); - } - } - - return new Style(StyleKind.valueOf(kind), name, map); - } - -} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/style/CommandStyleMultilinesCSS.java b/src/plantuml-asl/src/net/sourceforge/plantuml/style/CommandStyleMultilinesCSS.java new file mode 100644 index 000000000..511f1a375 --- /dev/null +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/style/CommandStyleMultilinesCSS.java @@ -0,0 +1,73 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: https://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Original Author: Arnaud Roques + */ +package net.sourceforge.plantuml.style; + +import net.sourceforge.plantuml.SkinParam; +import net.sourceforge.plantuml.UmlDiagram; +import net.sourceforge.plantuml.command.BlocLines; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.CommandMultilines2; +import net.sourceforge.plantuml.command.MultilinesStrategy; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; + +public class CommandStyleMultilinesCSS extends CommandMultilines2 { + + public CommandStyleMultilinesCSS() { + super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE); + } + + @Override + public String getPatternEnd() { + return "(?i)^[%s]*\\[%s]*$"; + } + + private static IRegex getRegexConcat() { + return RegexConcat.build(CommandStyleMultilinesCSS.class.getName(), RegexLeaf.start(), // + new RegexLeaf("\\"), // + RegexLeaf.end() // + ); + } + + protected CommandExecutionResult executeNow(UmlDiagram diagram, BlocLines lines) { + SkinParam.setBetaStyle(true); + if (SkinParam.USE_STYLES() == false) { + return CommandExecutionResult.ok(); + } + final StyleBuilder styleBuilder = diagram.getSkinParam().getCurrentStyleBuilder(); + for (Style modifiedStyle : StyleLoader.getDeclaredStyles(lines.subExtract(1, 1), styleBuilder)) { + diagram.getSkinParam().muteStyle(modifiedStyle); + } + return CommandExecutionResult.ok(); + } + +} diff --git a/src/plantuml-asl/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java b/src/plantuml-asl/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java index bbcf04d41..4dda9c0d6 100644 --- a/src/plantuml-asl/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java +++ b/src/plantuml-asl/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java @@ -4,12 +4,12 @@ * * (C) Copyright 2009-2020, Arnaud Roques * - * Project Info: http://plantuml.com + * Project Info: https://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 + * https://plantuml.com/patreon (only 1$ per month!) + * https://plantuml.com/paypal * * This file is part of PlantUML. * @@ -30,48 +30,201 @@ */ package net.sourceforge.plantuml.style; +import java.util.ArrayList; +import java.util.Collections; import java.util.EnumMap; +import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.StringTokenizer; public class FromSkinparamToStyle { - private Style style; + static class Data { + final private PName propertyName; + final private SName[] styleNames; - public FromSkinparamToStyle(String key, String value, AutomaticCounter counter) { + Data(PName propertyName, SName[] styleNames) { + this.propertyName = propertyName; + this.styleNames = styleNames; + } + } + + private static final Map> knowlegde = new HashMap>(); + + static { + addConvert("participantClickableBackgroundColor", PName.BackGroundColor, SName.participant, SName.clickable); + addConvert("participantClickableBorderColor", PName.LineColor, SName.participant, SName.clickable); + addConvert("participantBackgroundColor", PName.BackGroundColor, SName.participant); + addConvert("participantBorderColor", PName.LineColor, SName.participant); + addConvert("participantBorderThickness", PName.LineThickness, SName.participant); + addConFont("participant", SName.participant); + addConvert("boundaryBackgroundColor", PName.BackGroundColor, SName.boundary); + addConvert("boundaryBorderColor", PName.LineColor, SName.boundary); + addConvert("boundaryBorderThickness", PName.LineThickness, SName.boundary); + addConFont("boundary", SName.boundary); + addConvert("controlBackgroundColor", PName.BackGroundColor, SName.control); + addConvert("controlBorderColor", PName.LineColor, SName.control); + addConvert("controlBorderThickness", PName.LineThickness, SName.control); + addConFont("control", SName.control); + addConvert("collectionsBackgroundColor", PName.BackGroundColor, SName.collections); + addConvert("collectionsBorderColor", PName.LineColor, SName.collections); + addConvert("collectionsBorderThickness", PName.LineThickness, SName.collections); + addConFont("collections", SName.collections); + addConvert("actorBackgroundColor", PName.BackGroundColor, SName.actor); + addConvert("actorBorderColor", PName.LineColor, SName.actor); + addConvert("actorBorderThickness", PName.LineThickness, SName.actor); + addConFont("actor", SName.actor); + addConvert("databaseBackgroundColor", PName.BackGroundColor, SName.database); + addConvert("databaseBorderColor", PName.LineColor, SName.database); + addConvert("databaseBorderThickness", PName.LineThickness, SName.database); + addConFont("database", SName.database); + addConvert("entityBackgroundColor", PName.BackGroundColor, SName.entity); + addConvert("entityBorderColor", PName.LineColor, SName.entity); + addConvert("entityBorderThickness", PName.LineThickness, SName.entity); + addConFont("entity", SName.entity); + addConFont("footer", SName.footer); + + addConvert("sequenceStereotypeFontSize", PName.FontSize, SName.stereotype); + addConvert("sequenceStereotypeFontStyle", PName.FontStyle, SName.stereotype); + addConvert("sequenceStereotypeFontColor", PName.FontColor, SName.stereotype); + addConvert("sequenceStereotypeFontName", PName.FontName, SName.stereotype); + addConvert("SequenceReferenceBorderColor", PName.LineColor, SName.reference); + addConvert("SequenceReferenceBorderColor", PName.LineColor, SName.referenceHeader); + addConvert("SequenceReferenceBackgroundColor", PName.BackGroundColor, SName.reference); + addConvert("sequenceReferenceHeaderBackgroundColor", PName.BackGroundColor, SName.referenceHeader); + addConFont("sequenceReference", SName.reference); + addConFont("sequenceReference", SName.referenceHeader); + addConvert("sequenceGroupBorderThickness", PName.LineThickness, SName.group); + addConvert("SequenceGroupBorderColor", PName.LineColor, SName.group); + addConvert("SequenceGroupBorderColor", PName.LineColor, SName.groupHeader); + addConvert("SequenceGroupBackgroundColor", PName.BackGroundColor, SName.groupHeader); + addConFont("SequenceGroup", SName.group); + addConFont("SequenceGroupHeader", SName.groupHeader); + addConvert("SequenceBoxBorderColor", PName.LineColor, SName.box); + addConvert("SequenceBoxBackgroundColor", PName.BackGroundColor, SName.box); + addConvert("SequenceLifeLineBorderColor", PName.LineColor, SName.lifeLine); + addConvert("SequenceLifeLineBackgroundColor", PName.BackGroundColor, SName.lifeLine); + addConvert("sequenceDividerBackgroundColor", PName.BackGroundColor, SName.separator); + addConvert("sequenceDividerBorderColor", PName.LineColor, SName.separator); + addConFont("sequenceDivider", SName.separator); + addConvert("sequenceDividerBorderThickness", PName.LineThickness, SName.separator); + addConvert("SequenceMessageAlignment", PName.HorizontalAlignment, SName.arrow); + + addConFont("note", SName.note); + addConvert("noteBorderThickness", PName.LineThickness, SName.note); + addConvert("noteBackgroundColor", PName.BackGroundColor, SName.note); + addConvert("packageBackgroundColor", PName.BackGroundColor, SName.group); + addConvert("packageBorderColor", PName.LineColor, SName.group); + 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("activityBarColor", PName.LineColor, SName.activityBar); + addConvert("activityBorderColor", PName.LineColor, SName.activity); + addConvert("activityBorderThickness", PName.LineThickness, SName.activity); + addConvert("activityBackgroundColor", PName.BackGroundColor, SName.activity); + addConFont("activity", SName.activity); + addConvert("activityDiamondBackgroundColor", PName.BackGroundColor, SName.diamond); + addConvert("activityDiamondBorderColor", PName.LineColor, SName.diamond); + addConFont("activityDiamond", SName.diamond); + addConvert("arrowColor", PName.LineColor, SName.arrow); + + addConFont("arrow", SName.arrow); + addConvert("arrowThickness", PName.LineThickness, SName.arrow); + addConvert("arrowColor", PName.LineColor, SName.arrow); + addConvert("arrowStyle", PName.LineStyle, SName.arrow); + + addConvert("defaulttextalignment", PName.HorizontalAlignment, SName.root); + addConvert("defaultFontName", PName.FontName, SName.root); + addConFont("SwimlaneTitle", SName.swimlane); + addConvert("SwimlaneTitleBackgroundColor", PName.BackGroundColor, SName.swimlane); + addConvert("SwimlaneBorderColor", PName.LineColor, SName.swimlane); + addConvert("SwimlaneBorderThickness", PName.LineThickness, SName.swimlane); + addConvert("roundCorner", PName.RoundCorner, SName.root); + addConvert("titleBorderThickness", PName.LineThickness, SName.title); + addConvert("titleBorderColor", PName.LineColor, SName.title); + addConvert("titleBackgroundColor", PName.BackGroundColor, SName.title); + addConvert("titleBorderRoundCorner", PName.RoundCorner, SName.title); + addConFont("title", SName.title); + addConvert("legendBorderThickness", PName.LineThickness, SName.legend); + addConvert("legendBorderColor", PName.LineColor, SName.legend); + addConvert("legendBackgroundColor", PName.BackGroundColor, SName.legend); + addConvert("legendBorderRoundCorner", PName.RoundCorner, SName.legend); + addConFont("legend", SName.legend); + addConvert("noteTextAlignment", PName.HorizontalAlignment, SName.note); + + addConvert("BackgroundColor", PName.BackGroundColor, SName.document); + + + } + + private final List