From dd45415e206603d85ba2463bfae4afddefb40c7c Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Sun, 7 Jun 2015 12:23:10 +0200 Subject: [PATCH] version 8026 --- .../sourceforge/plantuml/AbstractPSystem.java | 3 +- .../sourceforge/plantuml/BlockUmlBuilder.java | 5 +- .../activitydiagram3/ActivityDiagram3.java | 9 +- .../ActivityDiagramFactory3.java | 4 +- .../activitydiagram3/InstructionEnd.java | 71 ++++++++++ .../activitydiagram3/InstructionGroup.java | 6 +- ...mmandStopLegacy1.java => CommandEnd3.java} | 10 +- .../command/CommandStop3.java | 4 - .../activitydiagram3/ftile/AbstractFtile.java | 3 +- .../ftile/EntityImageLegend.java | 3 +- .../ftile/FtileAssemblySimple.java | 3 +- .../activitydiagram3/ftile/FtileEmpty.java | 12 +- .../activitydiagram3/ftile/FtileFactory.java | 2 + .../ftile/FtileFactoryDelegator.java | 4 + .../ftile/GotoInterceptor.java | 3 +- .../activitydiagram3/ftile/Swimlanes.java | 3 +- .../ftile/TextBlockInterceptorUDrawable.java | 3 +- .../ftile/vcompact/FloatingNote.java | 3 +- .../FtileFactoryDelegatorCreateSplit.java | 12 ++ .../UGraphicInterceptorOneSwimlane.java | 4 + .../ftile/vcompact/VCompactFactory.java | 6 + .../ftile/vertical/FtileCircleEnd.java | 108 ++++++++++++++++ .../ftile/vertical/FtileDecorate.java | 3 +- .../classdiagram/ClassDiagramFactory.java | 4 +- .../command/CommandAddMethod.java | 4 +- .../command/CommandCreateClassMultilines.java | 2 +- .../command/CommandLinkClass.java | 4 +- .../command/CommandMouseOver.java | 122 ------------------ .../command/CommandSkinParamMultilines.java | 13 +- .../plantuml/command/Position.java | 13 +- .../note/FactoryTipOnEntityCommand.java | 12 +- .../plantuml/creole/SheetBlock1.java | 10 +- .../plantuml/creole/SheetBlock2.java | 9 +- .../plantuml/cucadiagram/BlockMemberImpl.java | 75 ----------- .../plantuml/cucadiagram/Bodier.java | 56 ++++---- .../plantuml/cucadiagram/BodyEnhanced.java | 5 +- .../plantuml/cucadiagram/BodyEnhanced2.java | 5 +- .../cucadiagram/EntityGenderUtils.java | 8 +- .../plantuml/cucadiagram/GroupRoot.java | 32 +---- .../plantuml/cucadiagram/IEntity.java | 13 +- .../cucadiagram/MethodsOrFieldsArea.java | 69 +++++----- .../cucadiagram/dot/CucaDiagramTxtMaker.java | 12 +- .../cucadiagram/entity/EntityImpl.java | 112 +--------------- .../plantuml/donors/PSystemDonors.java | 2 +- .../plantuml/flowdiagram/ActivityBox.java | 3 +- .../plantuml/flowdiagram/FlowDiagram.java | 7 +- src/net/sourceforge/plantuml/golem/Tile.java | 3 +- .../plantuml/golem/TilesField.java | 3 +- .../AbstractTextBlock.java} | 19 +-- .../plantuml/graphic/CircledCharacter.java | 4 +- .../plantuml/graphic/DateEventUtils.java | 2 +- .../plantuml/graphic/EmbededSystemLine.java | 2 +- .../plantuml/graphic/GraphicStrings.java | 4 +- .../plantuml/graphic/SingleLine.java | 4 +- .../plantuml/graphic/TextBlock.java | 6 +- .../plantuml/graphic/TextBlockArrow.java | 2 +- .../plantuml/graphic/TextBlockBordered.java | 2 +- .../plantuml/graphic/TextBlockCompressed.java | 2 +- .../graphic/TextBlockCompressed2.java | 2 +- .../plantuml/graphic/TextBlockEmpty.java | 4 +- .../plantuml/graphic/TextBlockGeneric.java | 2 +- .../plantuml/graphic/TextBlockHorizontal.java | 2 +- .../plantuml/graphic/TextBlockLineBefore.java | 8 +- .../plantuml/graphic/TextBlockMarged.java | 16 ++- .../plantuml/graphic/TextBlockMinWidth.java | 2 +- .../plantuml/graphic/TextBlockRecentred.java | 2 +- .../plantuml/graphic/TextBlockSimple.java | 4 +- .../plantuml/graphic/TextBlockUtils.java | 29 ++++- .../plantuml/graphic/TextBlockVertical2.java | 25 +++- .../graphic/TextBlockWidthAdapter.java | 2 +- .../plantuml/graphic/TileImage.java | 4 +- .../plantuml/graphic/TileImageSvg.java | 2 +- .../plantuml/graphic/TileText.java | 4 +- .../plantuml/graphic/USymbolArtifact.java | 4 +- .../plantuml/graphic/USymbolCard.java | 4 +- .../plantuml/graphic/USymbolCloud.java | 4 +- .../plantuml/graphic/USymbolComponent1.java | 2 +- .../plantuml/graphic/USymbolComponent2.java | 6 +- .../plantuml/graphic/USymbolDatabase.java | 4 +- .../plantuml/graphic/USymbolFolder.java | 4 +- .../plantuml/graphic/USymbolFrame.java | 4 +- .../plantuml/graphic/USymbolNode.java | 4 +- .../plantuml/graphic/USymbolQueue.java | 2 +- .../plantuml/graphic/USymbolRect.java | 4 +- .../graphic/USymbolSimpleAbstract.java | 2 +- .../plantuml/graphic/USymbolStorage.java | 4 +- .../plantuml/hector2/graphic/Foo2.java | 3 +- .../plantuml/html/CucaDiagramHtmlMaker.java | 8 +- .../plantuml/jungle/GTileLeftRight.java | 3 +- .../plantuml/jungle/GTileNode.java | 3 +- .../plantuml/jungle/GTileStack.java | 3 +- .../objectdiagram/command/CommandAddData.java | 2 +- .../CommandCreateEntityObjectMultilines.java | 2 +- .../plantuml/openiconic/OpenIcon.java | 3 +- .../plantuml/preproc/Preprocessor.java | 14 +- .../plantuml/preproc/PreprocessorInclude.java | 34 +++-- .../plantuml/project2/RowMerge.java | 5 +- .../plantuml/project2/RowOverwrite.java | 3 +- .../plantuml/project2/RowSimple.java | 3 +- .../plantuml/project2/TimeHeaderDay.java | 3 +- .../plantuml/project2/TimeHeaderMonth.java | 3 +- .../sourceforge/plantuml/real/RealLine.java | 2 + .../plantuml/sequencediagram/LifeEvent.java | 7 +- .../teoz/CommunicationExoTile.java | 3 +- .../teoz/ComponentAdapter.java | 3 +- .../sequencediagram/teoz/ElseTile.java | 43 +++--- .../sequencediagram/teoz/EventsHistory.java | 5 +- .../sequencediagram/teoz/GroupingTile.java | 66 +++++++++- .../sequencediagram/teoz/IntegerColored.java | 3 + .../sequencediagram/teoz/LiveBoxes.java | 3 +- .../sequencediagram/teoz/LivingSpace.java | 2 +- .../sequencediagram/teoz/MainTile.java | 14 +- .../sequencediagram/teoz/MainTileAdapter.java | 3 +- .../sequencediagram/teoz/Stairs2.java | 8 ++ .../sequencediagram/teoz/TeozLayer.java | 3 +- .../sourceforge/plantuml/skin/StickMan.java | 5 +- .../plantuml/skin/VisibilityModifier.java | 3 +- .../statediagram/command/CommandAddField.java | 4 +- .../command/CommandCreateState.java | 4 +- .../plantuml/svek/AbstractEntityImage.java | 3 +- .../sourceforge/plantuml/svek/Boundary.java | 8 +- .../plantuml/svek/CircleInterface2.java | 3 +- .../sourceforge/plantuml/svek/Cluster.java | 2 +- .../sourceforge/plantuml/svek/Control.java | 3 +- .../svek/CucaDiagramFileMakerSvek2.java | 6 +- ...ucaDiagramFileMakerSvek2InternalImage.java | 3 +- .../plantuml/svek/DecorateEntityImage.java | 3 +- .../plantuml/svek/DecorateEntityImage3.java | 3 +- .../plantuml/svek/DecorateTextBlock.java | 3 +- .../plantuml/svek/EntityDomain.java | 3 +- .../plantuml/svek/EntityImageProtected.java | 9 +- .../plantuml/svek/GraphvizCrash.java | 3 +- .../plantuml/svek/GroupPngMakerState.java | 2 +- .../plantuml/svek/InnerActivity.java | 3 +- .../plantuml/svek/InnerStateAutonom.java | 3 +- src/net/sourceforge/plantuml/svek/Line.java | 3 +- .../sourceforge/plantuml/svek/SvekResult.java | 4 +- .../plantuml/svek/image/EntityImageClass.java | 56 +++----- .../svek/image/EntityImageNoteLink.java | 3 +- .../svek/image/EntityImageObject.java | 35 ++--- .../plantuml/svek/image/EntityImageState.java | 2 +- .../svek/image/EntityImageState2.java | 2 +- .../EntityImageStateEmptyDescription.java | 2 +- .../plantuml/svek/image/EntityImageTips.java | 42 +++--- .../plantuml/svek/image/Opale.java | 3 +- .../plantuml/ugraphic/SpriteImage.java | 3 +- .../plantuml/ugraphic/SpriteMonochrome.java | 3 +- .../plantuml/ugraphic/TextBlockInEllipse.java | 3 +- .../plantuml/ugraphic/UGraphicCompress.java | 11 +- .../plantuml/ugraphic/ULayoutGroup.java | 18 ++- .../plantuml/ugraphic/UTranslate.java | 5 + .../sourceforge/plantuml/version/Version.java | 6 +- .../plantuml/xmi/XmiClassDiagramArgo.java | 4 +- .../plantuml/xmi/XmiClassDiagramStandard.java | 4 +- .../plantuml/xmi/XmiClassDiagramStar.java | 4 +- 155 files changed, 887 insertions(+), 744 deletions(-) create mode 100644 src/net/sourceforge/plantuml/activitydiagram3/InstructionEnd.java rename src/net/sourceforge/plantuml/activitydiagram3/command/{CommandStopLegacy1.java => CommandEnd3.java} (88%) create mode 100644 src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java delete mode 100644 src/net/sourceforge/plantuml/classdiagram/command/CommandMouseOver.java delete mode 100644 src/net/sourceforge/plantuml/cucadiagram/BlockMemberImpl.java rename src/net/sourceforge/plantuml/{cucadiagram/BlockMember.java => graphic/AbstractTextBlock.java} (71%) diff --git a/src/net/sourceforge/plantuml/AbstractPSystem.java b/src/net/sourceforge/plantuml/AbstractPSystem.java index acd0cd9c1..336141ab4 100644 --- a/src/net/sourceforge/plantuml/AbstractPSystem.java +++ b/src/net/sourceforge/plantuml/AbstractPSystem.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 14028 $ + * Revision $Revision: 16265 $ * */ package net.sourceforge.plantuml; @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.command.ProtectedCommand; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.version.License; import net.sourceforge.plantuml.version.Version; diff --git a/src/net/sourceforge/plantuml/BlockUmlBuilder.java b/src/net/sourceforge/plantuml/BlockUmlBuilder.java index 7c4788c39..bdee637b3 100644 --- a/src/net/sourceforge/plantuml/BlockUmlBuilder.java +++ b/src/net/sourceforge/plantuml/BlockUmlBuilder.java @@ -51,7 +51,7 @@ import net.sourceforge.plantuml.utils.StartUtils; final public class BlockUmlBuilder { private final List blocks = new ArrayList(); - private final Set usedFiles = new HashSet(); + private Set usedFiles = new HashSet(); private final UncommentReadLine reader2; public BlockUmlBuilder(List config, String charset, Defines defines, Reader reader, File newCurrentDir) @@ -59,11 +59,12 @@ final public class BlockUmlBuilder { Preprocessor includer = null; try { reader2 = new UncommentReadLine(new ReadLineReader(reader)); - includer = new Preprocessor(reader2, charset, defines, usedFiles, newCurrentDir); + includer = new Preprocessor(reader2, charset, defines, newCurrentDir); init(includer, config); } finally { if (includer != null) { includer.close(); + usedFiles = includer.getFilesUsed(); } } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java index a47ff6391..31acc5ab6 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java @@ -34,10 +34,8 @@ package net.sourceforge.plantuml.activitydiagram3; import java.awt.geom.Dimension2D; -import java.awt.image.BufferedImage; import java.io.IOException; import java.io.OutputStream; -import java.util.List; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; @@ -147,6 +145,11 @@ public class ActivityDiagram3 extends UmlDiagram { current().add(new InstructionStop(swinlanes.getCurrentSwimlane(), nextLinkRenderer())); } + public void end() { + manageSwimlaneStrategy(); + current().add(new InstructionEnd(swinlanes.getCurrentSwimlane(), nextLinkRenderer())); + } + public DiagramDescription getDescription() { return new DiagramDescriptionImpl("activity3", getClass()); } @@ -382,7 +385,7 @@ public class ActivityDiagram3 extends UmlDiagram { public void startGroup(Display name, HtmlColor backColor, HtmlColor titleColor) { manageSwimlaneStrategy(); - final InstructionGroup instructionGroup = new InstructionGroup(current(), name, backColor, titleColor); + final InstructionGroup instructionGroup = new InstructionGroup(current(), name, backColor, titleColor, swinlanes.getCurrentSwimlane()); current().add(instructionGroup); setCurrent(instructionGroup); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java index f2a87a75b..6a8a0b471 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java @@ -69,7 +69,7 @@ import net.sourceforge.plantuml.activitydiagram3.command.CommandSplitAgain3; import net.sourceforge.plantuml.activitydiagram3.command.CommandSplitEnd3; import net.sourceforge.plantuml.activitydiagram3.command.CommandStart3; import net.sourceforge.plantuml.activitydiagram3.command.CommandStop3; -import net.sourceforge.plantuml.activitydiagram3.command.CommandStopLegacy1; +import net.sourceforge.plantuml.activitydiagram3.command.CommandEnd3; import net.sourceforge.plantuml.activitydiagram3.command.CommandSwimlane; import net.sourceforge.plantuml.activitydiagram3.command.CommandSwimlane2; import net.sourceforge.plantuml.activitydiagram3.command.CommandWhile3; @@ -122,7 +122,7 @@ public class ActivityDiagramFactory3 extends UmlDiagramFactory { // cmds.add(new CommandGroupEnd3()); cmds.add(new CommandStart3()); cmds.add(new CommandStop3()); - cmds.add(new CommandStopLegacy1()); + cmds.add(new CommandEnd3()); cmds.add(new CommandKill3()); cmds.add(new CommandLink3()); cmds.add(new CommandNote3()); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionEnd.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionEnd.java new file mode 100644 index 000000000..45f3bbbb9 --- /dev/null +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionEnd.java @@ -0,0 +1,71 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2014, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 9786 $ + * + */ +package net.sourceforge.plantuml.activitydiagram3; + +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.cucadiagram.Display; +import net.sourceforge.plantuml.sequencediagram.NotePosition; + +public class InstructionEnd extends MonoSwimable implements Instruction { + + private final LinkRendering inlinkRendering; + + public InstructionEnd(Swimlane swimlane, LinkRendering inlinkRendering) { + super(swimlane); + this.inlinkRendering = inlinkRendering; + } + + public Ftile createFtile(FtileFactory factory) { + return factory.end(getSwimlaneIn()); + } + + public void add(Instruction other) { + throw new UnsupportedOperationException(); + } + + final public boolean kill() { + return false; + } + + public LinkRendering getInLinkRendering() { + return inlinkRendering; + } + + public void addNote(Display note, NotePosition position) { + throw new UnsupportedOperationException(); + } + +} diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java index 4cec74be3..28739ccd6 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java @@ -44,7 +44,7 @@ import net.sourceforge.plantuml.sequencediagram.NotePosition; public class InstructionGroup implements Instruction { - private final InstructionList list = new InstructionList(); + private final InstructionList list; private final Instruction parent; private final HtmlColor backColor; private final HtmlColor titleColor; @@ -52,7 +52,9 @@ public class InstructionGroup implements Instruction { private final Display test; private Display headerNote; - public InstructionGroup(Instruction parent, Display test, HtmlColor backColor, HtmlColor titleColor) { + public InstructionGroup(Instruction parent, Display test, HtmlColor backColor, HtmlColor titleColor, + Swimlane swimlane) { + this.list = new InstructionList(swimlane); this.parent = parent; this.test = test; this.backColor = backColor; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStopLegacy1.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEnd3.java similarity index 88% rename from src/net/sourceforge/plantuml/activitydiagram3/command/CommandStopLegacy1.java rename to src/net/sourceforge/plantuml/activitydiagram3/command/CommandEnd3.java index 5f653c491..0262bf823 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStopLegacy1.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEnd3.java @@ -40,9 +40,9 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -public class CommandStopLegacy1 extends SingleLineCommand2 { +public class CommandEnd3 extends SingleLineCommand2 { - public CommandStopLegacy1() { + public CommandEnd3() { super(getRegexConcat()); } @@ -55,11 +55,7 @@ public class CommandStopLegacy1 extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) { - // if (getSystem().getLastEntityConsulted() == null) { - // return CommandExecutionResult.error("No if for this endif"); - // } - diagram.stop(); - + diagram.end(); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStop3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStop3.java index 981afbc51..7cac396c3 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStop3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandStop3.java @@ -55,11 +55,7 @@ public class CommandStop3 extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) { - // if (getSystem().getLastEntityConsulted() == null) { - // return CommandExecutionResult.error("No if for this endif"); - // } diagram.stop(); - return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java index 9cd460dab..91a42bce2 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java @@ -37,10 +37,11 @@ import java.util.Collection; import java.util.Collections; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UTranslate; -public abstract class AbstractFtile implements Ftile { +public abstract class AbstractFtile extends AbstractTextBlock implements Ftile { private final boolean shadowing; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java index 54455f996..4d06c71fb 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java @@ -40,6 +40,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; 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; @@ -54,7 +55,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class EntityImageLegend implements TextBlock { +public class EntityImageLegend extends AbstractTextBlock implements TextBlock { private final int cornersize = 10; private final HtmlColor noteBackgroundColor; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java index 798d8a38c..b374f6855 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java @@ -40,11 +40,12 @@ import java.util.HashSet; import java.util.Set; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class FtileAssemblySimple implements Ftile { +public class FtileAssemblySimple extends AbstractTextBlock implements Ftile { private final Ftile tile1; private final Ftile tile2; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileEmpty.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileEmpty.java index 0b5dc09f1..06ce93905 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileEmpty.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileEmpty.java @@ -34,6 +34,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile; import java.util.Collections; +import java.util.HashSet; import java.util.Set; import net.sourceforge.plantuml.graphic.StringBounder; @@ -88,7 +89,14 @@ public class FtileEmpty extends AbstractFtile { } public Set getSwimlanes() { - return Collections.emptySet(); + final Set result = new HashSet(); + if (swimlaneIn != null) { + result.add(swimlaneIn); + } + if (swimlaneOut != null) { + result.add(swimlaneOut); + } + return Collections.unmodifiableSet(result); } - + } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java index 6f68bc44e..63975cb9f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java @@ -54,6 +54,8 @@ public interface FtileFactory extends ISkinSimple { public Ftile stop(Swimlane swimlane); + public Ftile end(Swimlane swimlane); + public Ftile activity(Display label, HtmlColor color, Swimlane swimlane, BoxStyle style); public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java index 9c074f048..9639f85d9 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java @@ -81,6 +81,10 @@ public class FtileFactoryDelegator implements FtileFactory { return factory.start(swimlane); } + public Ftile end(Swimlane swimlane) { + return factory.end(swimlane); + } + public Ftile stop(Swimlane swimlane) { return factory.stop(swimlane); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/GotoInterceptor.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/GotoInterceptor.java index 7c6430f08..d795cc2b6 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/GotoInterceptor.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/GotoInterceptor.java @@ -36,11 +36,12 @@ package net.sourceforge.plantuml.activitydiagram3.ftile; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.UGraphicInterceptorGoto; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UGraphic; -public class GotoInterceptor implements TextBlock { +public class GotoInterceptor extends AbstractTextBlock implements TextBlock { private final TextBlock swinlanes; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java index 41f60987e..ba77b6ce3 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java @@ -55,6 +55,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileFactoryDele 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.HtmlColor; @@ -80,7 +81,7 @@ import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class Swimlanes implements TextBlock { +public class Swimlanes extends AbstractTextBlock implements TextBlock { private final ISkinParam skinParam;; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/TextBlockInterceptorUDrawable.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/TextBlockInterceptorUDrawable.java index fa85f770b..c540d5cdb 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/TextBlockInterceptorUDrawable.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/TextBlockInterceptorUDrawable.java @@ -36,13 +36,14 @@ package net.sourceforge.plantuml.activitydiagram3.ftile; import java.awt.geom.Dimension2D; import java.util.HashMap; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class TextBlockInterceptorUDrawable implements TextBlock { +public class TextBlockInterceptorUDrawable extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java index 92122d72f..e523b417f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.creole.SheetBlock2; import net.sourceforge.plantuml.creole.Stencil; 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; @@ -55,7 +56,7 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; -public class FloatingNote implements Stencil, TextBlock { +public class FloatingNote extends AbstractTextBlock implements Stencil, TextBlock { private final Opale opale; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java index 706c8ef22..ae1a5f90b 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java @@ -281,6 +281,18 @@ public class FtileFactoryDelegatorCreateSplit extends FtileFactoryDelegator { 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) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorOneSwimlane.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorOneSwimlane.java index df4e4ae06..45bf5fc24 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorOneSwimlane.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/UGraphicInterceptorOneSwimlane.java @@ -95,4 +95,8 @@ public class UGraphicInterceptorOneSwimlane extends UGraphicDelegator { return new UGraphicInterceptorOneSwimlane(getUg().apply(change), swimlane); } + public final Swimlane getSwimlane() { + return swimlane; + } + } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java index f3accaaf5..3388aa2ac 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java @@ -48,6 +48,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox; +import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileCircleEnd; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileCircleStart; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileCircleStop; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateIn; @@ -85,6 +86,11 @@ public class VCompactFactory implements FtileFactory { return new FtileCircleStop(shadowing(), color, swimlane); } + public Ftile end(Swimlane swimlane) { + final HtmlColor color = rose.getHtmlColor(skinParam, ColorParam.activityEnd); + return new FtileCircleEnd(shadowing(), color, swimlane); + } + public Ftile activity(Display label, final HtmlColor color, Swimlane swimlane, BoxStyle style) { final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.activityBorder); final HtmlColor backColor = color == null ? rose.getHtmlColor(skinParam, ColorParam.activityBackground) : color; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java new file mode 100644 index 000000000..46c8b5488 --- /dev/null +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java @@ -0,0 +1,108 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2014, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 5183 $ + * + */ +package net.sourceforge.plantuml.activitydiagram3.ftile.vertical; + +import java.util.Collections; +import java.util.Set; + +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.HtmlColorUtils; +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.ULine; +import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.UTranslate; + +public class FtileCircleEnd extends AbstractFtile { + + private static final int SIZE = 20; + + private final HtmlColor backColor; + private final Swimlane swimlane; + + public FtileCircleEnd(boolean shadowing, HtmlColor backColor, Swimlane swimlane) { + super(shadowing); + this.backColor = backColor; + this.swimlane = swimlane; + } + + public Set getSwimlanes() { + if (swimlane == null) { + return Collections.emptySet(); + } + return Collections.singleton(swimlane); + } + + public Swimlane getSwimlaneIn() { + return swimlane; + } + + public Swimlane getSwimlaneOut() { + return swimlane; + } + + public void drawU(UGraphic ug) { + double xTheoricalPosition = 0; + double yTheoricalPosition = 0; + xTheoricalPosition = Math.round(xTheoricalPosition); + yTheoricalPosition = Math.round(yTheoricalPosition); + + final UEllipse circle = new UEllipse(SIZE, SIZE); + if (shadowing()) { + circle.setDeltaShadow(3); + } + ug = ug.apply(new UChangeColor(backColor)); + ug.apply(new UChangeBackColor(HtmlColorUtils.WHITE)) + .apply(new UTranslate(xTheoricalPosition, yTheoricalPosition)).draw(circle); + + final double thickness = 2.5; + final double size2 = (SIZE - thickness) / Math.sqrt(2); + final double delta = (SIZE - size2) / 2; + ug = ug.apply(new UStroke(thickness)); + ug.apply(new UTranslate(delta, delta)).draw(new ULine(size2, size2)); + ug.apply(new UTranslate(delta, SIZE - delta)).draw(new ULine(size2, -size2)); + + } + + public FtileGeometry calculateDimension(StringBounder stringBounder) { + return new FtileGeometry(SIZE, SIZE, SIZE / 2, 0); + } + +} diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java index 3f555212b..6523e35b7 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java @@ -41,11 +41,12 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; 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.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public abstract class FtileDecorate implements Ftile { +public abstract class FtileDecorate extends AbstractTextBlock implements Ftile { final private Ftile ftile; diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java index 50ebf29f4..99c12e6ca 100644 --- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java +++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java @@ -50,7 +50,6 @@ 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; -import net.sourceforge.plantuml.classdiagram.command.CommandMouseOver; import net.sourceforge.plantuml.classdiagram.command.CommandNamespaceSeparator; import net.sourceforge.plantuml.classdiagram.command.CommandStereotype; import net.sourceforge.plantuml.classdiagram.command.CommandUrl; @@ -108,7 +107,7 @@ public class ClassDiagramFactory extends UmlDiagramFactory { cmds.add(new CommandLinkLollipop(UmlDiagramType.CLASS)); cmds.add(new CommandImport()); - + final FactoryTipOnEntityCommand factoryTipOnEntityCommand = new FactoryTipOnEntityCommand(new RegexLeaf( "ENTITY", "(" + CommandCreateClass.CODE_NO_DOTDOT + "|[%g][^%g]+[%g])::([^%s]+)")); cmds.add(factoryTipOnEntityCommand.createMultiLine()); @@ -128,7 +127,6 @@ public class ClassDiagramFactory extends UmlDiagramFactory { cmds.add(factoryNoteOnLinkCommand.createMultiLine()); cmds.add(new CommandDiamondAssociation()); - cmds.add(new CommandMouseOver()); cmds.add(new CommandHideShowSpecificClass()); diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java index a9129e1dc..3ae54ccd8 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandAddMethod.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 12821 $ + * Revision $Revision: 16273 $ * */ package net.sourceforge.plantuml.classdiagram.command; @@ -56,7 +56,7 @@ public class CommandAddMethod extends SingleLineCommand { if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field.charAt(0))) { system.setVisibilityModifierPresent(true); } - entity.addFieldOrMethod(field); + entity.getBodier().addFieldOrMethod(field); return CommandExecutionResult.ok(); } } diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java index 6d3ee957a..07c8af61f 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java @@ -131,7 +131,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2 0 && VisibilityModifier.isVisibilityCharacter(s.charAt(0))) { diagram.setVisibilityModifierPresent(true); } - entity.addFieldOrMethod(s); + entity.getBodier().addFieldOrMethod(s); } if (url != null) { entity.addUrl(url); diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java index d8ccfda38..db47924a8 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java @@ -105,8 +105,8 @@ final public class CommandLinkClass extends SingleLineCommand2\\>)?"; + return "(" + getSeparator() + "?[\\p{L}0-9_$]+(?:" + getSeparator() + + "[\\p{L}0-9_$]+)*|[%g][^%g]+[%g])[%s]*(\\<\\<.*\\>\\>)?"; } private static String getSeparator() { diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandMouseOver.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandMouseOver.java deleted file mode 100644 index 0eb464deb..000000000 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandMouseOver.java +++ /dev/null @@ -1,122 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2014, Arnaud Roques - * - * Project Info: http://plantuml.sourceforge.net - * - * This file is part of PlantUML. - * - * PlantUML is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PlantUML distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - * License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - * - * [Java is a trademark or registered trademark of Sun Microsystems, Inc. - * in the United States and other countries.] - * - * Original Author: Arnaud Roques - * - * Revision $Revision: 4161 $ - * - */ -package net.sourceforge.plantuml.classdiagram.command; - -import java.util.List; - -import net.sourceforge.plantuml.classdiagram.ClassDiagram; -import net.sourceforge.plantuml.command.CommandExecutionResult; -import net.sourceforge.plantuml.command.CommandMultilines2; -import net.sourceforge.plantuml.command.MultilinesStrategy; -import net.sourceforge.plantuml.command.regex.RegexConcat; -import net.sourceforge.plantuml.command.regex.RegexLeaf; -import net.sourceforge.plantuml.command.regex.RegexOr; -import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.cucadiagram.Code; -import net.sourceforge.plantuml.cucadiagram.IEntity; -import net.sourceforge.plantuml.StringUtils; - -public class CommandMouseOver extends CommandMultilines2 { - - public CommandMouseOver() { - super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE); - } - - @Override - public String getPatternEnd() { - return "(?i)^[%s]*\\}[%s]*$"; - } - - private static RegexConcat getRegexConcat() { - return new RegexConcat(new RegexLeaf("^"), // - new RegexLeaf("mouseover[%s]+"), // - new RegexOr(// - new RegexLeaf("NAME1", "(\\.?[\\p{L}0-9_]+(?:\\.[\\p{L}0-9_]+)*)"), // - new RegexLeaf("NAME3", "[%g]([^%g]+)[%g]")), // - new RegexLeaf("[%s]*\\{[%s]*$")); - } - - public CommandExecutionResult executeNow(ClassDiagram system, List lines) { - StringUtils.trim(lines, false); - final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.get(0))); - Code code = Code.of(line0.get("NAME1", 0)); - if (code == null) { - code = Code.of(line0.get("NAME3", 0)); - } - if (system.leafExist(code) == false) { - return CommandExecutionResult.error("No such entity"); - } - final IEntity entity = system.getLeafsget(code); - for (String s : lines.subList(1, lines.size() - 1)) { - entity.mouseOver(s); - } - - return CommandExecutionResult.ok(); - } - - // private Entity executeArg0(Map arg) { - // - // final EntityType type = EntityType.getEntityType(arg.get("TYPE").get(0).goUpperCase()); - // final String code; - // final String display; - // if (arg.get("NAME1").get(1) != null) { - // code = arg.get("NAME1").get(1); - // display = arg.get("NAME1").get(0); - // } else if (arg.get("NAME3").get(0) != null) { - // code = arg.get("NAME3").get(0); - // display = arg.get("NAME3").get(0); - // } else { - // code = arg.get("NAME2").get(0); - // display = arg.get("NAME2").get(1); - // } - // final String stereotype = arg.get("STEREO").get(0); - // final String generic = arg.get("GENERIC").get(0); - // - // if (system.entityExist(code)) { - // final Entity result = (Entity) system.getOrCreateClass(code); - // result.muteToType(type); - // return result; - // } - // final Entity entity = system.createEntity(code, display, type); - // if (stereotype != null) { - // entity.setStereotype(new Stereotype(stereotype, system.getSkinParam().getCircledCharacterRadius(), - // system.getSkinParam().getFont(FontParam.CIRCLED_CHARACTER, null))); - // } - // if (generic != null) { - // entity.setGeneric(generic); - // } - // return entity; - // } - -} diff --git a/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java b/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java index a9b0276c8..70e5de3d0 100644 --- a/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java +++ b/src/net/sourceforge/plantuml/command/CommandSkinParamMultilines.java @@ -64,7 +64,8 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket\\>)?[\\w.]*)[%s]+(?:(\\{)|(.*))$|^\\}?$"); + private final static Pattern p1 = MyPattern + .cmpile("^([\\w.]*(?:\\<\\<.*\\>\\>)?[\\w.]*)[%s]+(?:(\\{)|(.*))$|^\\}?$"); public CommandSkinParamMultilines() { super("(?i)^skinparam[%s]*(?:[%s]+([\\w.]*(?:\\<\\<.*\\>\\>)?[\\w.]*))?[%s]*\\{$"); @@ -73,9 +74,16 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket lines) { final Context context = new Context(); final Matcher mStart = getStartingPattern().matcher(StringUtils.trin(lines.get(0))); @@ -91,6 +99,9 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket 0; + if (hasStartingQuote(s)) { + continue; + } if (s.equals("}")) { context.pop(); continue; diff --git a/src/net/sourceforge/plantuml/command/Position.java b/src/net/sourceforge/plantuml/command/Position.java index 5bafa505d..e99d766dc 100644 --- a/src/net/sourceforge/plantuml/command/Position.java +++ b/src/net/sourceforge/plantuml/command/Position.java @@ -28,11 +28,12 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 12235 $ + * Revision $Revision: 16285 $ * */ package net.sourceforge.plantuml.command; +import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.cucadiagram.Rankdir; public enum Position { @@ -60,4 +61,14 @@ public enum Position { } throw new IllegalStateException(); } + + public Direction reverseDirection() { + if (this == LEFT) { + return Direction.RIGHT; + } + if (this == RIGHT) { + return Direction.LEFT; + } + throw new UnsupportedOperationException(); + } } diff --git a/src/net/sourceforge/plantuml/command/note/FactoryTipOnEntityCommand.java b/src/net/sourceforge/plantuml/command/note/FactoryTipOnEntityCommand.java index c58cef1e6..30b4418d9 100644 --- a/src/net/sourceforge/plantuml/command/note/FactoryTipOnEntityCommand.java +++ b/src/net/sourceforge/plantuml/command/note/FactoryTipOnEntityCommand.java @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandMultilines2; import net.sourceforge.plantuml.command.MultilinesStrategy; +import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; @@ -120,13 +121,20 @@ public final class FactoryTipOnEntityCommand implements SingleMultiFactoryComman return CommandExecutionResult.error("Nothing to note to"); } final IEntity cl1 = diagram.getOrCreateLeaf(code, null, null); + final Position position = Position.valueOf(StringUtils.goUpperCase(pos)).withRankdir( + diagram.getSkinParam().getRankdir()); - final Code codeTip = code.addSuffix("$$$right"); + final Code codeTip = code.addSuffix("$$$" + position.name()); IEntity tips = diagram.getLeafsget(codeTip); if (tips == null) { tips = diagram.getOrCreateLeaf(codeTip, LeafType.TIPS, null); final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getInvisible(); - final Link link = new Link(cl1, (IEntity) tips, type, null, 1); + final Link link; + if (position == Position.RIGHT) { + link = new Link(cl1, (IEntity) tips, type, null, 1); + } else { + link = new Link((IEntity) tips, cl1, type, null, 1); + } diagram.addLink(link); } tips.putTip(member, Display.create(s)); diff --git a/src/net/sourceforge/plantuml/creole/SheetBlock1.java b/src/net/sourceforge/plantuml/creole/SheetBlock1.java index a0295ccaf..c6506526a 100644 --- a/src/net/sourceforge/plantuml/creole/SheetBlock1.java +++ b/src/net/sourceforge/plantuml/creole/SheetBlock1.java @@ -34,12 +34,14 @@ package net.sourceforge.plantuml.creole; import java.awt.geom.Dimension2D; +import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -47,7 +49,7 @@ import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class SheetBlock1 implements TextBlock, Atom, Stencil { +public class SheetBlock1 extends AbstractTextBlock implements TextBlock, Atom, Stencil { private final Sheet sheet; private List stripes; @@ -128,6 +130,12 @@ public class SheetBlock1 implements TextBlock, Atom, Stencil { initMap(stringBounder); return Dimension2DDouble.delta(minMax.getDimension(), 2 * padding); } + + @Override + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) { + return null; + } + public void drawU(UGraphic ug) { initMap(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/creole/SheetBlock2.java b/src/net/sourceforge/plantuml/creole/SheetBlock2.java index e871554e8..e7f246d5e 100644 --- a/src/net/sourceforge/plantuml/creole/SheetBlock2.java +++ b/src/net/sourceforge/plantuml/creole/SheetBlock2.java @@ -34,14 +34,16 @@ package net.sourceforge.plantuml.creole; import java.awt.geom.Dimension2D; +import java.awt.geom.Rectangle2D; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.UStroke; -public class SheetBlock2 implements TextBlock, Atom { +public class SheetBlock2 extends AbstractTextBlock implements TextBlock, Atom { private final SheetBlock1 block; private final UStroke defaultStroke; @@ -70,4 +72,9 @@ public class SheetBlock2 implements TextBlock, Atom { public double getStartingAltitude(StringBounder stringBounder) { return 0; } + + @Override + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) { + return block.getInnerPosition(member, stringBounder); + } } diff --git a/src/net/sourceforge/plantuml/cucadiagram/BlockMemberImpl.java b/src/net/sourceforge/plantuml/cucadiagram/BlockMemberImpl.java deleted file mode 100644 index eb69cdd0e..000000000 --- a/src/net/sourceforge/plantuml/cucadiagram/BlockMemberImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2014, Arnaud Roques - * - * Project Info: http://plantuml.sourceforge.net - * - * This file is part of PlantUML. - * - * PlantUML is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PlantUML distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - * License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - * - * [Java is a trademark or registered trademark of Sun Microsystems, Inc. - * in the United States and other countries.] - * - * Original Author: Arnaud Roques - * - * Revision $Revision: 4749 $ - * - */ -package net.sourceforge.plantuml.cucadiagram; - -import java.awt.geom.Rectangle2D; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import net.sourceforge.plantuml.FontParam; -import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockLineBefore; -import net.sourceforge.plantuml.graphic.TextBlockUtils; - -public class BlockMemberImpl implements BlockMember { - - private final List members = new ArrayList(); - - public BlockMemberImpl(List members) { - this.members.addAll(members); - } - - public List getAll() { - return Collections.unmodifiableList(members); - } - - public TextBlock asTextBlock(FontParam fontParam, ISkinParam skinParam) { - final MethodsOrFieldsArea methodsOrFieldsArea = new MethodsOrFieldsArea(members, fontParam, skinParam); - return new TextBlockLineBefore(TextBlockUtils.withMargin((TextBlock) methodsOrFieldsArea, 6, 4)); - } - - public Rectangle2D getPosition(String member, StringBounder stringBounder, FontParam fontParam, ISkinParam skinParam) { - final MethodsOrFieldsArea methodsOrFieldsArea = new MethodsOrFieldsArea(members, fontParam, skinParam); - return methodsOrFieldsArea.getPosition(member, stringBounder); - } - - public boolean contains(String member, FontParam fontParam, ISkinParam skinParam) { - final MethodsOrFieldsArea methodsOrFieldsArea = new MethodsOrFieldsArea(members, fontParam, skinParam); - return methodsOrFieldsArea.contains(member); - } - -} diff --git a/src/net/sourceforge/plantuml/cucadiagram/Bodier.java b/src/net/sourceforge/plantuml/cucadiagram/Bodier.java index 50f0ef47f..b83a47e4c 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Bodier.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Bodier.java @@ -33,7 +33,6 @@ */ package net.sourceforge.plantuml.cucadiagram; -import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -42,8 +41,9 @@ import java.util.Set; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.TextBlockVertical2; import net.sourceforge.plantuml.skin.VisibilityModifier; public class Bodier { @@ -68,7 +68,7 @@ public class Bodier { rawBody.add(s); } - public boolean isBodyEnhanced() { + private boolean isBodyEnhanced() { for (String s : rawBody) { if (BodyEnhanced.isBlockSeparator(s)) { return true; @@ -77,26 +77,9 @@ public class Bodier { return false; } - public BlockMember getBodyEnhanced() { - return new BlockMember() { - public TextBlock asTextBlock(FontParam fontParam, ISkinParam skinParam) { - final BodyEnhanced result = new BodyEnhanced(rawBody, fontParam, skinParam, manageModifier); - return result; - } - public Rectangle2D getPosition(String member, StringBounder stringBounder, FontParam fontParam, ISkinParam skinParam) { - throw new UnsupportedOperationException(); - } - }; - } - - private LeafType getEntityType() { - return type; - } - private boolean isMethod(String s) { - if (getEntityType() == LeafType.ANNOTATION || getEntityType() == LeafType.ABSTRACT_CLASS - || getEntityType() == LeafType.CLASS || getEntityType() == LeafType.INTERFACE - || getEntityType() == LeafType.ENUM) { + if (type == LeafType.ANNOTATION || type == LeafType.ABSTRACT_CLASS || type == LeafType.CLASS + || type == LeafType.INTERFACE || type == LeafType.ENUM) { return StringUtils.isMethod(s); } return false; @@ -170,4 +153,33 @@ public class Bodier { } return true; } + + public TextBlock getBody(final FontParam fontParam, final ISkinParam skinParam, final boolean showMethods, + final boolean showFields) { + if (type.isLikeClass() && isBodyEnhanced()) { + if (showMethods && showFields) { + return new BodyEnhanced(rawBody, fontParam, skinParam, manageModifier); + } + return null; + } + final MethodsOrFieldsArea fields = new MethodsOrFieldsArea(getFieldsToDisplay(), fontParam, skinParam); + if (type == LeafType.OBJECT) { + return fields.asBlockMemberImpl(); + } + if (type.isLikeClass() == false) { + throw new UnsupportedOperationException(); + } + final MethodsOrFieldsArea methods = new MethodsOrFieldsArea(getMethodsToDisplay(), fontParam, skinParam); + if (showFields && showMethods == false) { + return fields.asBlockMemberImpl(); + } else if (showMethods && showFields == false) { + return methods.asBlockMemberImpl(); + } + assert showFields && showMethods; + + final TextBlock bb1 = fields.asBlockMemberImpl(); + final TextBlock bb2 = methods.asBlockMemberImpl(); + return new TextBlockVertical2(bb1, bb2, HorizontalAlignment.LEFT); + } + } diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java index 9042c0abd..9ad8bbe7f 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java +++ b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java @@ -34,6 +34,7 @@ package net.sourceforge.plantuml.cucadiagram; import java.awt.geom.Dimension2D; +import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -45,6 +46,7 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.creole.CreoleParser; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; @@ -55,7 +57,7 @@ import net.sourceforge.plantuml.graphic.TextBlockVertical2; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UGraphic; -public class BodyEnhanced implements TextBlock { +public class BodyEnhanced extends AbstractTextBlock implements TextBlock { private TextBlock area2; private final FontConfiguration titleConfig; @@ -214,5 +216,4 @@ public class BodyEnhanced implements TextBlock { public List getUrls() { return Collections.unmodifiableList(urls); } - } diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced2.java b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced2.java index 570833287..d70fabc05 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced2.java +++ b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced2.java @@ -40,18 +40,17 @@ import java.util.List; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.StringUtils; +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.graphic.TextBlockLineBefore; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockVertical2; -import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; -public class BodyEnhanced2 implements TextBlock { +public class BodyEnhanced2 extends AbstractTextBlock implements TextBlock { private TextBlock area2; private final FontConfiguration titleConfig; diff --git a/src/net/sourceforge/plantuml/cucadiagram/EntityGenderUtils.java b/src/net/sourceforge/plantuml/cucadiagram/EntityGenderUtils.java index 5fd835d32..b0aab600a 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/EntityGenderUtils.java +++ b/src/net/sourceforge/plantuml/cucadiagram/EntityGenderUtils.java @@ -87,7 +87,6 @@ public class EntityGenderUtils { }; } - static public EntityGender all() { return new EntityGender() { public boolean contains(IEntity test) { @@ -99,7 +98,7 @@ public class EntityGenderUtils { static public EntityGender emptyMethods() { return new EntityGender() { public boolean contains(IEntity test) { - return test.getMethodsToDisplay().size()==0; + return test.getBodier().getMethodsToDisplay().size() == 0; } }; } @@ -107,7 +106,7 @@ public class EntityGenderUtils { static public EntityGender emptyFields() { return new EntityGender() { public boolean contains(IEntity test) { - return test.getFieldsToDisplay().size()==0; + return test.getBodier().getFieldsToDisplay().size() == 0; } }; } @@ -115,7 +114,8 @@ public class EntityGenderUtils { static public EntityGender emptyMembers() { return new EntityGender() { public boolean contains(IEntity test) { - return test.getMethodsToDisplay().size()==0 && test.getFieldsToDisplay().size()==0; + return test.getBodier().getMethodsToDisplay().size() == 0 + && test.getBodier().getFieldsToDisplay().size() == 0; } }; } diff --git a/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java b/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java index 07998f49c..d9ab5a8c3 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java +++ b/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java @@ -40,9 +40,11 @@ import java.util.List; import java.util.Map; import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory; import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.svek.IEntityImage; import net.sourceforge.plantuml.svek.PackageStyle; @@ -106,17 +108,7 @@ public class GroupRoot implements IGroup { } - public List getFieldsToDisplay() { - throw new UnsupportedOperationException(); - - } - - public List getMethodsToDisplay() { - throw new UnsupportedOperationException(); - - } - - public BlockMember getBody(PortionShower portionShower) { + public TextBlock getBody(PortionShower portionShower, FontParam fontParam, ISkinParam skinParam) { throw new UnsupportedOperationException(); } @@ -129,20 +121,6 @@ public class GroupRoot implements IGroup { return null; } - public BlockMember getMouseOver() { - throw new UnsupportedOperationException(); - } - - public void addFieldOrMethod(String s) { - throw new UnsupportedOperationException(); - - } - - public void mouseOver(String s) { - throw new UnsupportedOperationException(); - - } - public void addUrl(Url url) { throw new UnsupportedOperationException(); @@ -286,4 +264,8 @@ public class GroupRoot implements IGroup { throw new UnsupportedOperationException(); } + public Bodier getBodier() { + throw new UnsupportedOperationException(); + } + } diff --git a/src/net/sourceforge/plantuml/cucadiagram/IEntity.java b/src/net/sourceforge/plantuml/cucadiagram/IEntity.java index ddd57ce13..54a5232eb 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/IEntity.java +++ b/src/net/sourceforge/plantuml/cucadiagram/IEntity.java @@ -33,7 +33,6 @@ */ package net.sourceforge.plantuml.cucadiagram; -import java.util.List; import java.util.Map; import net.sourceforge.plantuml.Hideable; @@ -69,17 +68,7 @@ public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, Li public void setStereotype(Stereotype stereotype); - public List getFieldsToDisplay(); - - public List getMethodsToDisplay(); - - public BlockMember getBody(PortionShower portionShower); - - public BlockMember getMouseOver(); - - public void addFieldOrMethod(String s); - - public void mouseOver(String s); + public Bodier getBodier(); public void addUrl(Url url); diff --git a/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java b/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java index 1ce6ccf81..a493f896e 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java +++ b/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java @@ -42,11 +42,13 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.Url; +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.graphic.TextBlockLineBefore; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockWidth; import net.sourceforge.plantuml.skin.VisibilityModifier; @@ -60,7 +62,11 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULayoutGroup; import net.sourceforge.plantuml.utils.CharHidder; -public class MethodsOrFieldsArea implements TextBlockWidth, TextBlock { +public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockWidth, TextBlock { + + public TextBlock asBlockMemberImpl() { + return new TextBlockLineBefore(TextBlockUtils.withMargin(this, 6, 4)); + } private final UFont font; private final ISkinParam skinParam; @@ -128,11 +134,12 @@ public class MethodsOrFieldsArea implements TextBlockWidth, TextBlock { if (m.isStatic()) { config = config.underline(); } - final TextBlock bloc = TextBlockUtils.create(Display.getWithNewlines(s), config, align, skinParam, true); + TextBlock bloc = TextBlockUtils.create(Display.getWithNewlines(s), config, align, skinParam, true); + bloc = TextBlockUtils.fullInnerPosition(bloc, m.getDisplay(false)); return new TextBlockTracer(m, bloc); } - static class TextBlockTracer implements TextBlock { + static class TextBlockTracer extends AbstractTextBlock implements TextBlock { private final TextBlock bloc; private final Url url; @@ -156,12 +163,17 @@ public class MethodsOrFieldsArea implements TextBlockWidth, TextBlock { final Dimension2D dim = bloc.calculateDimension(stringBounder); return dim; } + + @Override + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) { + return bloc.getInnerPosition(member, stringBounder); + } } private TextBlock getUBlock(final VisibilityModifier modifier) { if (modifier == null) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { } @@ -180,30 +192,7 @@ public class MethodsOrFieldsArea implements TextBlockWidth, TextBlock { } public TextBlock asTextBlock(final double widthToUse) { - return new TextBlock() { - - public void drawU(UGraphic ug) { - MethodsOrFieldsArea.this.drawU(ug); - } - - public Dimension2D calculateDimension(StringBounder stringBounder) { - return MethodsOrFieldsArea.this.calculateDimension(stringBounder); - } - }; - } - - public Rectangle2D getPosition(String member, StringBounder stringBounder) { - double x = 0; - double y = 0; - for (Member att : members) { - final TextBlock bloc = createTextBlock(att); - final Dimension2D dim = bloc.calculateDimension(stringBounder); - if (att.getDisplay(false).startsWith(member)) { - return new Rectangle2D.Double(x, y, dim.getWidth(), dim.getHeight()); - } - y += dim.getHeight(); - } - throw new IllegalArgumentException(); + return this; } public boolean contains(String member) { @@ -215,11 +204,17 @@ public class MethodsOrFieldsArea implements TextBlockWidth, TextBlock { return false; } - public void drawU(UGraphic ug) { - final Dimension2D dim = calculateDimension(ug.getStringBounder()); + @Override + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) { + final ULayoutGroup group = getLayout(stringBounder); + final Dimension2D dim = calculateDimension(stringBounder); + return group.getInnerPosition(member, dim.getWidth(), dim.getHeight(), stringBounder); + } + + private ULayoutGroup getLayout(final StringBounder stringBounder) { final ULayoutGroup group; if (hasSmallIcon()) { - group = new ULayoutGroup(new PlacementStrategyVisibility(ug.getStringBounder(), + group = new ULayoutGroup(new PlacementStrategyVisibility(stringBounder, skinParam.getCircledCharacterRadius() + 3)); for (Member att : members) { final TextBlock bloc = createTextBlock(att); @@ -230,9 +225,9 @@ public class MethodsOrFieldsArea implements TextBlockWidth, TextBlock { } else { final PlacementStrategy placementStrategy; if (align == HorizontalAlignment.LEFT) { - placementStrategy = new PlacementStrategyY1Y2Left(ug.getStringBounder()); + placementStrategy = new PlacementStrategyY1Y2Left(stringBounder); } else if (align == HorizontalAlignment.CENTER) { - placementStrategy = new PlacementStrategyY1Y2Center(ug.getStringBounder()); + placementStrategy = new PlacementStrategyY1Y2Center(stringBounder); } else { throw new IllegalStateException(); } @@ -242,7 +237,13 @@ public class MethodsOrFieldsArea implements TextBlockWidth, TextBlock { group.add(bloc); } } - group.drawU(ug, 0, 0, dim.getWidth(), dim.getHeight()); + return group; + } + + public void drawU(UGraphic ug) { + final ULayoutGroup group = getLayout(ug.getStringBounder()); + final Dimension2D dim = calculateDimension(ug.getStringBounder()); + group.drawU(ug, dim.getWidth(), dim.getHeight()); } } diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java b/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java index 32459173e..0e8417121 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/CucaDiagramTxtMaker.java @@ -123,14 +123,14 @@ public final class CucaDiagramTxtMaker { int y = 2; ug.getCharArea().drawHLine('-', y, 1, w - 1); y++; - for (Member att : ent.getFieldsToDisplay()) { + for (Member att : ent.getBodier().getFieldsToDisplay()) { final List disp = StringUtils.getWithNewlines2(att.getDisplay(true)); ug.getCharArea().drawStringsLR(disp, 1, y); y += StringUtils.getHeight(disp); } ug.getCharArea().drawHLine('-', y, 1, w - 1); y++; - for (Member att : ent.getMethodsToDisplay()) { + for (Member att : ent.getBodier().getMethodsToDisplay()) { final List disp = StringUtils.getWithNewlines2(att.getDisplay(true)); ug.getCharArea().drawStringsLR(disp, 1, y); y += StringUtils.getHeight(disp); @@ -148,10 +148,10 @@ public final class CucaDiagramTxtMaker { private int getHeight(IEntity entity) { int result = StringUtils.getHeight(entity.getDisplay()); - for (Member att : entity.getMethodsToDisplay()) { + for (Member att : entity.getBodier().getMethodsToDisplay()) { result += StringUtils.getHeight(Display.getWithNewlines(att.getDisplay(true))); } - for (Member att : entity.getFieldsToDisplay()) { + for (Member att : entity.getBodier().getFieldsToDisplay()) { result += StringUtils.getHeight(Display.getWithNewlines(att.getDisplay(true))); } return result + 4; @@ -159,13 +159,13 @@ public final class CucaDiagramTxtMaker { private int getWidth(IEntity entity) { int result = StringUtils.getWidth(entity.getDisplay()); - for (Member att : entity.getMethodsToDisplay()) { + for (Member att : entity.getBodier().getMethodsToDisplay()) { final int w = StringUtils.getWidth(Display.getWithNewlines(att.getDisplay(true))); if (w > result) { result = w; } } - for (Member att : entity.getFieldsToDisplay()) { + for (Member att : entity.getBodier().getFieldsToDisplay()) { final int w = StringUtils.getWidth(Display.getWithNewlines(att.getDisplay(true))); if (w > result) { result = w; diff --git a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java index bed8f8114..c35c3ede0 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java +++ b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java @@ -33,7 +33,6 @@ */ package net.sourceforge.plantuml.cucadiagram.entity; -import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -42,16 +41,11 @@ import java.util.List; import java.util.Map; import net.sourceforge.plantuml.FontParam; -import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.cucadiagram.BlockMember; -import net.sourceforge.plantuml.cucadiagram.BlockMemberImpl; import net.sourceforge.plantuml.cucadiagram.Bodier; -import net.sourceforge.plantuml.cucadiagram.BodyEnhanced; import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.EntityPosition; import net.sourceforge.plantuml.cucadiagram.EntityUtils; import net.sourceforge.plantuml.cucadiagram.GroupRoot; @@ -61,15 +55,9 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LongCode; -import net.sourceforge.plantuml.cucadiagram.Member; -import net.sourceforge.plantuml.cucadiagram.PortionShower; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood; -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.TextBlockVertical2; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.svek.IEntityImage; import net.sourceforge.plantuml.svek.PackageStyle; @@ -98,8 +86,6 @@ final class EntityImpl implements ILeaf, IGroup { private boolean top; - private final List mouseOver = new ArrayList(); - // Group private Code namespace2; @@ -291,102 +277,8 @@ final class EntityImpl implements ILeaf, IGroup { return generic; } - public BlockMember getBody(final PortionShower portionShower) { - checkNotGroup(); - final boolean showMethods = portionShower.showPortion(EntityPortion.METHOD, EntityImpl.this); - final boolean showFields = portionShower.showPortion(EntityPortion.FIELD, EntityImpl.this); - if (getEntityType().isLikeClass() && bodier.isBodyEnhanced()) { - if (showMethods && showFields) { - return bodier.getBodyEnhanced(); - } - return new BlockMember() { - public TextBlock asTextBlock(FontParam fontParam, ISkinParam skinParam) { - return null; - } - - public Rectangle2D getPosition(String member, StringBounder stringBounder, FontParam fontParam, - ISkinParam skinParam) { - throw new UnsupportedOperationException(); - } - }; - } - return new BlockMember() { - public TextBlock asTextBlock(FontParam fontParam, ISkinParam skinParam) { - if (getEntityType().isLikeClass()) { - - if (showFields && showMethods) { - final BlockMemberImpl bb1 = new BlockMemberImpl(getFieldsToDisplay()); - final BlockMemberImpl bb2 = new BlockMemberImpl(getMethodsToDisplay()); - final TextBlock b1 = bb1.asTextBlock(fontParam, skinParam); - final TextBlock b2 = bb2.asTextBlock(fontParam, skinParam); - return new TextBlockVertical2(b1, b2, HorizontalAlignment.LEFT); - } else if (showFields) { - return new BlockMemberImpl(getFieldsToDisplay()).asTextBlock(fontParam, skinParam); - } else if (showMethods) { - return new BlockMemberImpl(getMethodsToDisplay()).asTextBlock(fontParam, skinParam); - } - return null; - } - if (getEntityType() == LeafType.OBJECT) { - return new BlockMemberImpl(getFieldsToDisplay()).asTextBlock(fontParam, skinParam); - } - throw new UnsupportedOperationException(); - } - - public Rectangle2D getPosition(String member, StringBounder stringBounder, FontParam fontParam, - ISkinParam skinParam) { - if (getEntityType().isLikeClass()) { - - if (showFields && showMethods) { - final BlockMemberImpl bb1 = new BlockMemberImpl(getFieldsToDisplay()); - final BlockMemberImpl bb2 = new BlockMemberImpl(getMethodsToDisplay()); - if (bb1.contains(member, fontParam, skinParam)) { - return bb1.getPosition(member, stringBounder, fontParam, skinParam); - } - if (bb2.contains(member, fontParam, skinParam)) { - return bb2.getPosition(member, stringBounder, fontParam, skinParam); - } - } - return null; - } - throw new UnsupportedOperationException(); - } - }; - } - - public BlockMember getMouseOver() { - if (mouseOver.size() == 0) { - return null; - } - return new BlockMember() { - public TextBlock asTextBlock(FontParam fontParam, ISkinParam skinParam) { - return new BodyEnhanced(mouseOver, fontParam, skinParam, leafType.manageModifier()); - } - - public Rectangle2D getPosition(String member, StringBounder stringBounder, FontParam fontParam, - ISkinParam skinParam) { - throw new UnsupportedOperationException(); - } - }; - } - - public void mouseOver(String s) { - mouseOver.add(s); - } - - public List getFieldsToDisplay() { - // checkNotGroup(); - return bodier.getFieldsToDisplay(); - } - - public List getMethodsToDisplay() { - // checkNotGroup(); - return bodier.getMethodsToDisplay(); - } - - public void addFieldOrMethod(String s) { - // checkNotGroup(); - bodier.addFieldOrMethod(s); + public Bodier getBodier() { + return bodier; } public EntityPosition getEntityPosition() { diff --git a/src/net/sourceforge/plantuml/donors/PSystemDonors.java b/src/net/sourceforge/plantuml/donors/PSystemDonors.java index 852796e78..3257c5764 100644 --- a/src/net/sourceforge/plantuml/donors/PSystemDonors.java +++ b/src/net/sourceforge/plantuml/donors/PSystemDonors.java @@ -58,7 +58,7 @@ import net.sourceforge.plantuml.version.PSystemVersion; public class PSystemDonors extends AbstractPSystem { - public static final String DONORS = "UDfTaisIsZ0Cn-zw2fypquT8IOTEO7SxIwU7taIY9LgCH6s7DddwYcs33JfPew_VNrRjg_z60RvHek1gIIgC7NodAfkUOAlP3H7gfHJti0uvH1FiQ8ynCOfxra6Wbbw3MokbcQxFjpVBMD9HO8l584dGyEAmXpgtrWlinemmmPghUnE5Tg4S8-mIdGSIjr8zcxvccKCHDgU7KWsmKi_YNdMC1Etu4A_UrOGipfdXgQ36K-dQgDhJ7vJUrhaQsBeUC4oczFKcMmxmNDAd6LuyNwoWuUvevBS82to9jzPIG5HqWMO-SGgJs-AWFK9xNVhF0QrzaLUHpzzbTfniJOB9yepFkDf_y7IyKoNzdVjHoTR8MzbBI3p3rnpk5Pwu6yYxpyX-AXNukOI9yH6j9PHFBNQ_Hegk6VS1xMjzblz3tnDrWzi4Z9YH3cGNMtpWx-kXMOhRw8NBk_cudB-jFS1F"; + public static final String DONORS = "UDfTaijIwp0CXlTw2gypmqE4XYcJbikqm8ATceX6rBMAxHIIfpygXzHkjR96j--NLThYpyZ3CqNofdHH76C3BrGaapqi9Ra-G3cLuWRcFeLeW3LjC4H6PnwbSr2wLhoP2yMHJi-F3ysOqj714hD1BaB5ayCMojHQZh3k4y80SoukpGdK4sKVO1tfq94pCv63wgkcEHHWiRyg5GypiUpCIlf0KFTNyU9JLCZa71WUCchSvwwEAYtze6jrdREEjUiM_Q1ALsVPRWkFENqSuSdoKGigRdPAVewmWxjmRkqoY8AEK8rxZdumI-oaHQXFIt_lKDjdUGNPz5rgkq7Nv31gdl8fL_qVddONgbnxuVvMiZQoMlRa8uzmdyAjm0Ct7LbpYso7N84TSvWGhj5gGdTJO_FLKp1Ll_6eNskJ_3VvZDHqPk4nO4BQabvize7VfqFJ5BEG8-Ttytivhqa_8wooMpwD-0UUmSRE"; public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { final GraphicStrings result = getGraphicStrings(); diff --git a/src/net/sourceforge/plantuml/flowdiagram/ActivityBox.java b/src/net/sourceforge/plantuml/flowdiagram/ActivityBox.java index 548ce2713..5aa636813 100644 --- a/src/net/sourceforge/plantuml/flowdiagram/ActivityBox.java +++ b/src/net/sourceforge/plantuml/flowdiagram/ActivityBox.java @@ -40,6 +40,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.golem.Tile; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColorUtils; @@ -55,7 +56,7 @@ import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class ActivityBox implements TextBlock { +public class ActivityBox extends AbstractTextBlock { private static final int CORNER = 25; private static final int MARGIN = 10; diff --git a/src/net/sourceforge/plantuml/flowdiagram/FlowDiagram.java b/src/net/sourceforge/plantuml/flowdiagram/FlowDiagram.java index b79f5f2c4..1fef240e1 100644 --- a/src/net/sourceforge/plantuml/flowdiagram/FlowDiagram.java +++ b/src/net/sourceforge/plantuml/flowdiagram/FlowDiagram.java @@ -35,11 +35,10 @@ package net.sourceforge.plantuml.flowdiagram; import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; -import java.awt.image.BufferedImage; +import java.awt.geom.Rectangle2D; import java.io.IOException; import java.io.OutputStream; import java.util.HashMap; -import java.util.List; import java.util.Map; import net.sourceforge.plantuml.Dimension2DDouble; @@ -79,6 +78,10 @@ public class FlowDiagram extends UmlDiagram implements TextBlock { private final Map tilesBoxes = new HashMap(); private Tile lastTile; + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) { + throw new UnsupportedOperationException(); + } + public DiagramDescription getDescription() { return new DiagramDescriptionImpl("Flow Diagram", getClass()); } diff --git a/src/net/sourceforge/plantuml/golem/Tile.java b/src/net/sourceforge/plantuml/golem/Tile.java index 2efafdd12..add9a33c2 100644 --- a/src/net/sourceforge/plantuml/golem/Tile.java +++ b/src/net/sourceforge/plantuml/golem/Tile.java @@ -42,6 +42,7 @@ import java.util.Map; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.SpriteContainerEmpty; 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.HtmlColorUtils; @@ -55,7 +56,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class Tile implements TextBlock { +public class Tile extends AbstractTextBlock implements TextBlock { private static double SIZE = 40; private final int num; diff --git a/src/net/sourceforge/plantuml/golem/TilesField.java b/src/net/sourceforge/plantuml/golem/TilesField.java index ac0fbcb0f..4c0c2dbfd 100644 --- a/src/net/sourceforge/plantuml/golem/TilesField.java +++ b/src/net/sourceforge/plantuml/golem/TilesField.java @@ -42,6 +42,7 @@ import java.util.List; import java.util.Map; 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; @@ -50,7 +51,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class TilesField implements TextBlock { +public class TilesField extends AbstractTextBlock implements TextBlock { private int size = 1; private final Tile root = new Tile(0); diff --git a/src/net/sourceforge/plantuml/cucadiagram/BlockMember.java b/src/net/sourceforge/plantuml/graphic/AbstractTextBlock.java similarity index 71% rename from src/net/sourceforge/plantuml/cucadiagram/BlockMember.java rename to src/net/sourceforge/plantuml/graphic/AbstractTextBlock.java index 8acdb11b0..ef923c044 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/BlockMember.java +++ b/src/net/sourceforge/plantuml/graphic/AbstractTextBlock.java @@ -28,22 +28,17 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 4749 $ + * Revision $Revision: 16264 $ * */ -package net.sourceforge.plantuml.cucadiagram; +package net.sourceforge.plantuml.graphic; import java.awt.geom.Rectangle2D; -import net.sourceforge.plantuml.FontParam; -import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.graphic.StringBounder; -import net.sourceforge.plantuml.graphic.TextBlock; +public abstract class AbstractTextBlock implements TextBlock { -public interface BlockMember { + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) { + throw new UnsupportedOperationException(getClass().toString()); + } - public TextBlock asTextBlock(FontParam fontParam, ISkinParam skinParam); - - public Rectangle2D getPosition(String member, StringBounder stringBounder, FontParam fontParam, ISkinParam skinParam); - -} +} \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/graphic/CircledCharacter.java b/src/net/sourceforge/plantuml/graphic/CircledCharacter.java index 1317c106a..901948c56 100644 --- a/src/net/sourceforge/plantuml/graphic/CircledCharacter.java +++ b/src/net/sourceforge/plantuml/graphic/CircledCharacter.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 12235 $ + * Revision $Revision: 16265 $ * */ package net.sourceforge.plantuml.graphic; @@ -44,7 +44,7 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class CircledCharacter implements TextBlock { +public class CircledCharacter extends AbstractTextBlock implements TextBlock { private final String c; private final UFont font; diff --git a/src/net/sourceforge/plantuml/graphic/DateEventUtils.java b/src/net/sourceforge/plantuml/graphic/DateEventUtils.java index ea3ab734b..84a9e0da8 100644 --- a/src/net/sourceforge/plantuml/graphic/DateEventUtils.java +++ b/src/net/sourceforge/plantuml/graphic/DateEventUtils.java @@ -79,7 +79,7 @@ public class DateEventUtils { } private static TextBlock addCharlie(TextBlock textBlock) { - final TextBlock charlie = new TextBlock() { + final TextBlock charlie = new AbstractTextBlock() { private final BufferedImage charlie = PSystemVersion.getCharlieImage(); public void drawU(UGraphic ug) { diff --git a/src/net/sourceforge/plantuml/graphic/EmbededSystemLine.java b/src/net/sourceforge/plantuml/graphic/EmbededSystemLine.java index 3775f267a..d9f263fd7 100644 --- a/src/net/sourceforge/plantuml/graphic/EmbededSystemLine.java +++ b/src/net/sourceforge/plantuml/graphic/EmbededSystemLine.java @@ -52,7 +52,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UShape; -class EmbededSystemLine implements Line { +class EmbededSystemLine extends AbstractTextBlock implements Line { final private List lines; diff --git a/src/net/sourceforge/plantuml/graphic/GraphicStrings.java b/src/net/sourceforge/plantuml/graphic/GraphicStrings.java index 215a0967f..04c62fc55 100644 --- a/src/net/sourceforge/plantuml/graphic/GraphicStrings.java +++ b/src/net/sourceforge/plantuml/graphic/GraphicStrings.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 14711 $ + * Revision $Revision: 16265 $ * */ package net.sourceforge.plantuml.graphic; @@ -52,7 +52,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class GraphicStrings implements IEntityImage { +public class GraphicStrings extends AbstractTextBlock implements IEntityImage { private final HtmlColor background; diff --git a/src/net/sourceforge/plantuml/graphic/SingleLine.java b/src/net/sourceforge/plantuml/graphic/SingleLine.java index adab1b181..947066a03 100644 --- a/src/net/sourceforge/plantuml/graphic/SingleLine.java +++ b/src/net/sourceforge/plantuml/graphic/SingleLine.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 12235 $ + * Revision $Revision: 16265 $ * */ package net.sourceforge.plantuml.graphic; @@ -44,7 +44,7 @@ import net.sourceforge.plantuml.ugraphic.Sprite; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -class SingleLine implements Line { +class SingleLine extends AbstractTextBlock implements Line { private final List blocs = new ArrayList(); private final HorizontalAlignment horizontalAlignment; diff --git a/src/net/sourceforge/plantuml/graphic/TextBlock.java b/src/net/sourceforge/plantuml/graphic/TextBlock.java index 5529db48f..f04e644e4 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlock.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlock.java @@ -28,17 +28,21 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 12323 $ + * Revision $Revision: 16264 $ * */ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; +import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.ugraphic.UShape; public interface TextBlock extends UDrawable, UShape { public Dimension2D calculateDimension(StringBounder stringBounder); + + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder); + } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockArrow.java b/src/net/sourceforge/plantuml/graphic/TextBlockArrow.java index f9b90f2d4..af7945e00 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockArrow.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockArrow.java @@ -43,7 +43,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class TextBlockArrow implements TextBlock { +public class TextBlockArrow extends AbstractTextBlock implements TextBlock { private final double size; private final Direction arrow; diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockBordered.java b/src/net/sourceforge/plantuml/graphic/TextBlockBordered.java index aac596ac3..d32d42156 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockBordered.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockBordered.java @@ -41,7 +41,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; -class TextBlockBordered implements TextBlock { +class TextBlockBordered extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; private final HtmlColor color; diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockCompressed.java b/src/net/sourceforge/plantuml/graphic/TextBlockCompressed.java index 50a4d66fb..9a6ddcee9 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockCompressed.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockCompressed.java @@ -42,7 +42,7 @@ import net.sourceforge.plantuml.ugraphic.SlotSet; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicCompress; -public class TextBlockCompressed implements TextBlock { +public class TextBlockCompressed extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockCompressed2.java b/src/net/sourceforge/plantuml/graphic/TextBlockCompressed2.java index cfc8a2941..fc2e7485a 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockCompressed2.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockCompressed2.java @@ -40,7 +40,7 @@ import net.sourceforge.plantuml.ugraphic.CompressionTransform; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicCompress2; -public class TextBlockCompressed2 implements TextBlock { +public class TextBlockCompressed2 extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; private final CompressionTransform compressionTransform; diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockEmpty.java b/src/net/sourceforge/plantuml/graphic/TextBlockEmpty.java index 002457ab8..dbde37525 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockEmpty.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockEmpty.java @@ -38,7 +38,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ugraphic.UGraphic; -public class TextBlockEmpty implements TextBlockWidth, TextBlock { +public class TextBlockEmpty extends AbstractTextBlock implements TextBlockWidth, TextBlock { private final double width; private final double height; @@ -60,7 +60,7 @@ public class TextBlockEmpty implements TextBlockWidth, TextBlock { } public TextBlock asTextBlock(final double widthToUse) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { } diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockGeneric.java b/src/net/sourceforge/plantuml/graphic/TextBlockGeneric.java index 692879baa..75b8b4dc8 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockGeneric.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockGeneric.java @@ -41,7 +41,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; -public class TextBlockGeneric implements TextBlock { +public class TextBlockGeneric extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; private final HtmlColor background; diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockHorizontal.java b/src/net/sourceforge/plantuml/graphic/TextBlockHorizontal.java index c0be2a598..ad6c856ec 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockHorizontal.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockHorizontal.java @@ -39,7 +39,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -class TextBlockHorizontal implements TextBlock { +class TextBlockHorizontal extends AbstractTextBlock implements TextBlock { private final TextBlock b1; private final TextBlock b2; diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockLineBefore.java b/src/net/sourceforge/plantuml/graphic/TextBlockLineBefore.java index 9f86720ca..9d93c15d9 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockLineBefore.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockLineBefore.java @@ -34,13 +34,14 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; +import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UHorizontalLine; -public class TextBlockLineBefore implements TextBlock { +public class TextBlockLineBefore extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; private final char separator; @@ -80,5 +81,10 @@ public class TextBlockLineBefore implements TextBlock { UHorizontalLine.infinite(1, 1, title, separator).drawMe(ug); } } + + @Override + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) { + return textBlock.getInnerPosition(member, stringBounder); + } } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockMarged.java b/src/net/sourceforge/plantuml/graphic/TextBlockMarged.java index 140fa01ea..1e1102d3d 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockMarged.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockMarged.java @@ -34,12 +34,13 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; +import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -class TextBlockMarged implements TextBlock { +class TextBlockMarged extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; private final double x1; @@ -61,7 +62,18 @@ class TextBlockMarged implements TextBlock { } public void drawU(UGraphic ug) { - textBlock.drawU(ug.apply(new UTranslate(x1, y1))); + final UTranslate translate = new UTranslate(x1, y1); + textBlock.drawU(ug.apply(translate)); + } + + @Override + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) { + final Rectangle2D parent = textBlock.getInnerPosition(member, stringBounder); + if (parent == null) { + return null; + } + final UTranslate translate = new UTranslate(x1, y1); + return translate.apply(parent); } } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockMinWidth.java b/src/net/sourceforge/plantuml/graphic/TextBlockMinWidth.java index c8aabbec0..a18e4bf77 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockMinWidth.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockMinWidth.java @@ -39,7 +39,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -class TextBlockMinWidth implements TextBlock { +class TextBlockMinWidth extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; private final double minWidth; diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockRecentred.java b/src/net/sourceforge/plantuml/graphic/TextBlockRecentred.java index c413a3b9a..6ff0810b8 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockRecentred.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockRecentred.java @@ -39,7 +39,7 @@ import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class TextBlockRecentred implements TextBlock { +public class TextBlockRecentred extends AbstractTextBlock implements TextBlock { private final TextBlock textBlock; diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockSimple.java b/src/net/sourceforge/plantuml/graphic/TextBlockSimple.java index a90a9e9f9..f0414f419 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockSimple.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockSimple.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15846 $ + * Revision $Revision: 16265 $ * */ package net.sourceforge.plantuml.graphic; @@ -49,7 +49,7 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -class TextBlockSimple implements TextBlock { +class TextBlockSimple extends AbstractTextBlock implements TextBlock { private List lines2; diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockUtils.java b/src/net/sourceforge/plantuml/graphic/TextBlockUtils.java index f5bc0fc63..c4a9f54a0 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockUtils.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockUtils.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15817 $ + * Revision $Revision: 16278 $ * */ package net.sourceforge.plantuml.graphic; @@ -40,6 +40,7 @@ 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.Dimension2DDouble; @@ -135,7 +136,8 @@ public class TextBlockUtils { return new TextBlockSpotted(circledCharacter, texts, fontConfiguration, horizontalAlignment, spriteContainer); } - return new TextBlockSimple(texts, fontConfiguration, horizontalAlignment, spriteContainer, 0, fontForStereotype, htmlColorForStereotype); + return new TextBlockSimple(texts, fontConfiguration, horizontalAlignment, spriteContainer, 0, + fontForStereotype, htmlColorForStereotype); } public static TextBlock withMargin(TextBlock textBlock, double marginX, double marginY) { @@ -152,7 +154,7 @@ public class TextBlockUtils { } public static TextBlock empty(final double width, final double height) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { } @@ -213,4 +215,25 @@ public class TextBlockUtils { return gg.getFontMetrics(font); } + public static TextBlock fullInnerPosition(final TextBlock bloc, final String display) { + return new TextBlock() { + + public void drawU(UGraphic ug) { + bloc.drawU(ug); + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + return bloc.calculateDimension(stringBounder); + } + + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) { + if (display.startsWith(member)) { + final Dimension2D dim = calculateDimension(stringBounder); + return new Rectangle2D.Double(0, 0, dim.getWidth(), dim.getHeight()); + } + return null; + } + }; + } + } diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockVertical2.java b/src/net/sourceforge/plantuml/graphic/TextBlockVertical2.java index 19f4919b9..a9c654042 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockVertical2.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockVertical2.java @@ -34,6 +34,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; +import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.List; @@ -41,7 +42,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class TextBlockVertical2 implements TextBlock { +public class TextBlockVertical2 extends AbstractTextBlock implements TextBlock { private final List blocks = new ArrayList(); private final HorizontalAlignment horizontalAlignment; @@ -71,13 +72,13 @@ public class TextBlockVertical2 implements TextBlock { public void drawU(UGraphic ug) { double y = 0; final Dimension2D dimtotal = calculateDimension(ug.getStringBounder()); - for (TextBlock b : blocks) { - final Dimension2D dimb = b.calculateDimension(ug.getStringBounder()); + for (TextBlock block : blocks) { + final Dimension2D dimb = block.calculateDimension(ug.getStringBounder()); if (horizontalAlignment == HorizontalAlignment.LEFT) { - b.drawU(ug.apply(new UTranslate(0, y))); + block.drawU(ug.apply(new UTranslate(0, y))); } else if (horizontalAlignment == HorizontalAlignment.CENTER) { final double dx = (dimtotal.getWidth() - dimb.getWidth()) / 2; - b.drawU(ug.apply(new UTranslate(dx, y))); + block.drawU(ug.apply(new UTranslate(dx, y))); } else { throw new UnsupportedOperationException(); } @@ -85,4 +86,18 @@ public class TextBlockVertical2 implements TextBlock { } } + @Override + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) { + double y = 0; + for (TextBlock block : blocks) { + final Dimension2D dimb = block.calculateDimension(stringBounder); + final Rectangle2D result = block.getInnerPosition(member, stringBounder); + if (result != null) { + return new UTranslate(0, y).apply(result); + } + y += dimb.getHeight(); + } + return null; + } + } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/graphic/TextBlockWidthAdapter.java b/src/net/sourceforge/plantuml/graphic/TextBlockWidthAdapter.java index 63cbe22a8..13b45df80 100644 --- a/src/net/sourceforge/plantuml/graphic/TextBlockWidthAdapter.java +++ b/src/net/sourceforge/plantuml/graphic/TextBlockWidthAdapter.java @@ -37,7 +37,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ugraphic.UGraphic; -public class TextBlockWidthAdapter implements TextBlock { +public class TextBlockWidthAdapter extends AbstractTextBlock implements TextBlock { private final TextBlockWidth textBlockWidth; private final double width; diff --git a/src/net/sourceforge/plantuml/graphic/TileImage.java b/src/net/sourceforge/plantuml/graphic/TileImage.java index c202cfffd..68b515ec4 100644 --- a/src/net/sourceforge/plantuml/graphic/TileImage.java +++ b/src/net/sourceforge/plantuml/graphic/TileImage.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 12235 $ + * Revision $Revision: 16265 $ * */ package net.sourceforge.plantuml.graphic; @@ -41,7 +41,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class TileImage implements TextBlock { +public class TileImage extends AbstractTextBlock implements TextBlock { private final BufferedImage image; private final int vspace; diff --git a/src/net/sourceforge/plantuml/graphic/TileImageSvg.java b/src/net/sourceforge/plantuml/graphic/TileImageSvg.java index 5f1d4724a..61f4c946d 100644 --- a/src/net/sourceforge/plantuml/graphic/TileImageSvg.java +++ b/src/net/sourceforge/plantuml/graphic/TileImageSvg.java @@ -43,7 +43,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImageSvg; -public class TileImageSvg implements TextBlock { +public class TileImageSvg extends AbstractTextBlock implements TextBlock { private final UImageSvg svg; diff --git a/src/net/sourceforge/plantuml/graphic/TileText.java b/src/net/sourceforge/plantuml/graphic/TileText.java index b38287b10..fdbb40a54 100644 --- a/src/net/sourceforge/plantuml/graphic/TileText.java +++ b/src/net/sourceforge/plantuml/graphic/TileText.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 12235 $ + * Revision $Revision: 16265 $ * */ package net.sourceforge.plantuml.graphic; @@ -44,7 +44,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UText; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class TileText implements TextBlock { +public class TileText extends AbstractTextBlock implements TextBlock { private final String text; private final FontConfiguration fontConfiguration; diff --git a/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java b/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java index bf6fcb962..4c6fb5fa5 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java @@ -87,7 +87,7 @@ class USymbolArtifact extends USymbol { } public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); @@ -108,7 +108,7 @@ class USymbolArtifact extends USymbol { public TextBlock asBig(final TextBlock title, final TextBlock stereotype, final double width, final double height, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolCard.java b/src/net/sourceforge/plantuml/graphic/USymbolCard.java index ca5ee078e..7fec53e6a 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolCard.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolCard.java @@ -71,7 +71,7 @@ class USymbolCard extends USymbol { } public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); @@ -92,7 +92,7 @@ class USymbolCard extends USymbol { public TextBlock asBig(final TextBlock title, final TextBlock stereotype, final double width, final double height, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolCloud.java b/src/net/sourceforge/plantuml/graphic/USymbolCloud.java index 4457d137b..2bf88db45 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolCloud.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolCloud.java @@ -87,7 +87,7 @@ class USymbolCloud extends USymbol { } public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); @@ -108,7 +108,7 @@ class USymbolCloud extends USymbol { public TextBlock asBig(final TextBlock title, final TextBlock stereotype, final double width, final double height, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java b/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java index c7d8e558f..4ab9b8141 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java @@ -70,7 +70,7 @@ class USymbolComponent1 extends USymbol { } public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java b/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java index e8d827120..8c1580857 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java @@ -35,9 +35,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; @@ -75,7 +73,7 @@ class USymbolComponent2 extends USymbol { } public TextBlock asSmall(final TextBlock label, TextBlock stereotype, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); @@ -94,7 +92,7 @@ class USymbolComponent2 extends USymbol { public TextBlock asBig(final TextBlock title, TextBlock stereotype, final double width, final double height, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java b/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java index 43a1c9d24..745f4ef7d 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java @@ -113,7 +113,7 @@ class USymbolDatabase extends USymbol { } public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); @@ -135,7 +135,7 @@ class USymbolDatabase extends USymbol { public TextBlock asBig(final TextBlock title, final TextBlock stereotype, final double width, final double height, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolFolder.java b/src/net/sourceforge/plantuml/graphic/USymbolFolder.java index a79687fa2..a188494c4 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolFolder.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolFolder.java @@ -102,7 +102,7 @@ public class USymbolFolder extends USymbol { } public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); @@ -124,7 +124,7 @@ public class USymbolFolder extends USymbol { public TextBlock asBig(final TextBlock title, final TextBlock stereotype, final double width, final double height, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolFrame.java b/src/net/sourceforge/plantuml/graphic/USymbolFrame.java index 6b479df87..04704d64e 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolFrame.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolFrame.java @@ -91,7 +91,7 @@ class USymbolFrame extends USymbol { } public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); @@ -112,7 +112,7 @@ class USymbolFrame extends USymbol { public TextBlock asBig(final TextBlock title, final TextBlock stereotype, final double width, final double height, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolNode.java b/src/net/sourceforge/plantuml/graphic/USymbolNode.java index 1f5431769..8b427c41d 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolNode.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolNode.java @@ -74,7 +74,7 @@ class USymbolNode extends USymbol { } public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); @@ -95,7 +95,7 @@ class USymbolNode extends USymbol { public TextBlock asBig(final TextBlock title, final TextBlock stereotype, final double width, final double height, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolQueue.java b/src/net/sourceforge/plantuml/graphic/USymbolQueue.java index e44d3449b..1dd94d90e 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolQueue.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolQueue.java @@ -115,7 +115,7 @@ class USymbolQueue extends USymbol { } public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolRect.java b/src/net/sourceforge/plantuml/graphic/USymbolRect.java index 7e4dec31a..223e862fc 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolRect.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolRect.java @@ -68,7 +68,7 @@ class USymbolRect extends USymbol { } public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); @@ -89,7 +89,7 @@ class USymbolRect extends USymbol { public TextBlock asBig(final TextBlock title, final TextBlock stereotype, final double width, final double height, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java b/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java index b1149385f..694e5a63e 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java @@ -46,7 +46,7 @@ abstract class USymbolSimpleAbstract extends USymbol { throw new IllegalArgumentException(); } final TextBlock stickman = getDrawing(symbolContext); - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolStorage.java b/src/net/sourceforge/plantuml/graphic/USymbolStorage.java index da25efe6f..6de92a1fc 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolStorage.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolStorage.java @@ -60,7 +60,7 @@ class USymbolStorage extends USymbol { } public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); @@ -81,7 +81,7 @@ class USymbolStorage extends USymbol { public TextBlock asBig(final TextBlock title, final TextBlock stereotype, final double width, final double height, final SymbolContext symbolContext) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java b/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java index 58dce0a57..1d08e32d0 100644 --- a/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java +++ b/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java @@ -39,6 +39,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.hector2.MinMax; @@ -49,7 +50,7 @@ import net.sourceforge.plantuml.svek.IEntityImage; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class Foo2 implements TextBlock { +public class Foo2 extends AbstractTextBlock implements TextBlock { private final Distribution distribution; private final CucaDiagram diagram; diff --git a/src/net/sourceforge/plantuml/html/CucaDiagramHtmlMaker.java b/src/net/sourceforge/plantuml/html/CucaDiagramHtmlMaker.java index 1b75d4835..0397a0d45 100644 --- a/src/net/sourceforge/plantuml/html/CucaDiagramHtmlMaker.java +++ b/src/net/sourceforge/plantuml/html/CucaDiagramHtmlMaker.java @@ -134,12 +134,12 @@ public final class CucaDiagramHtmlMaker { } pw.println("
"); - if (entity.getFieldsToDisplay().size() == 0) { + if (entity.getBodier().getFieldsToDisplay().size() == 0) { pw.println("

No fields

"); } else { pw.println("

Fields:

"); pw.println("
    "); - for (Member m : entity.getFieldsToDisplay()) { + for (Member m : entity.getBodier().getFieldsToDisplay()) { pw.println("
  • "); pw.println(StringUtils.unicodeForHtml(m.getDisplay(true))); pw.println("
  • "); @@ -148,12 +148,12 @@ public final class CucaDiagramHtmlMaker { } pw.println("
    "); - if (entity.getMethodsToDisplay().size() == 0) { + if (entity.getBodier().getMethodsToDisplay().size() == 0) { pw.println("

    No methods

    "); } else { pw.println("

    Methods:

    "); pw.println("
      "); - for (Member m : entity.getMethodsToDisplay()) { + for (Member m : entity.getBodier().getMethodsToDisplay()) { pw.println("
    • "); pw.println(StringUtils.unicodeForHtml(m.getDisplay(true))); pw.println("
    • "); diff --git a/src/net/sourceforge/plantuml/jungle/GTileLeftRight.java b/src/net/sourceforge/plantuml/jungle/GTileLeftRight.java index 3942d4013..29b7f2697 100644 --- a/src/net/sourceforge/plantuml/jungle/GTileLeftRight.java +++ b/src/net/sourceforge/plantuml/jungle/GTileLeftRight.java @@ -37,6 +37,7 @@ import java.awt.geom.Dimension2D; import java.util.Arrays; 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; @@ -44,7 +45,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class GTileLeftRight implements GTile { +public class GTileLeftRight extends AbstractTextBlock implements GTile { private final GTile left; private final GTile right; diff --git a/src/net/sourceforge/plantuml/jungle/GTileNode.java b/src/net/sourceforge/plantuml/jungle/GTileNode.java index 9b1b8fb1b..10a10b37d 100644 --- a/src/net/sourceforge/plantuml/jungle/GTileNode.java +++ b/src/net/sourceforge/plantuml/jungle/GTileNode.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.creole.CreoleParser; 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; @@ -56,7 +57,7 @@ import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; -public class GTileNode implements GTile { +public class GTileNode extends AbstractTextBlock implements GTile { private final TextBlock tb; diff --git a/src/net/sourceforge/plantuml/jungle/GTileStack.java b/src/net/sourceforge/plantuml/jungle/GTileStack.java index 5738c343d..41d2cbcf2 100644 --- a/src/net/sourceforge/plantuml/jungle/GTileStack.java +++ b/src/net/sourceforge/plantuml/jungle/GTileStack.java @@ -37,11 +37,12 @@ import java.awt.geom.Dimension2D; import java.util.ArrayList; import java.util.List; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class GTileStack implements GTile { +public class GTileStack extends AbstractTextBlock implements GTile { private final List tiles; private final double space; diff --git a/src/net/sourceforge/plantuml/objectdiagram/command/CommandAddData.java b/src/net/sourceforge/plantuml/objectdiagram/command/CommandAddData.java index ea11a90eb..5d4369131 100644 --- a/src/net/sourceforge/plantuml/objectdiagram/command/CommandAddData.java +++ b/src/net/sourceforge/plantuml/objectdiagram/command/CommandAddData.java @@ -56,7 +56,7 @@ public class CommandAddData extends SingleLineCommand { if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field.charAt(0))) { diagram.setVisibilityModifierPresent(true); } - entity.addFieldOrMethod(field); + entity.getBodier().addFieldOrMethod(field); return CommandExecutionResult.ok(); } } diff --git a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java index bbae5c7c6..ab7032bd2 100644 --- a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java +++ b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java @@ -89,7 +89,7 @@ public class CommandCreateEntityObjectMultilines extends CommandMultilines2 filesUsed, File newCurrentDir) { + public Preprocessor(ReadLine reader, String charset, Defines defines, File newCurrentDir) { this.defines = defines; this.defines.saveState(); - this.rawSource = new PreprocessorInclude(reader, defines, charset, filesUsed, newCurrentDir); + this.rawSource = new PreprocessorInclude(reader, defines, charset, newCurrentDir); this.source = new ReadLineInsertable(new IfManager(rawSource, defines)); } @@ -157,4 +159,8 @@ public class Preprocessor implements ReadLine { rawSource.close(); } + public Set getFilesUsed() { + return Collections.unmodifiableSet(rawSource.getFilesUsedGlobal()); + } + } diff --git a/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java b/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java index 9cf345185..01ca342d4 100644 --- a/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java +++ b/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java @@ -29,7 +29,7 @@ * Original Author: Arnaud Roques * Modified by: Nicolas Jouanin * - * Revision $Revision: 15993 $ + * Revision $Revision: 16305 $ * */ package net.sourceforge.plantuml.preproc; @@ -42,6 +42,8 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; +import java.util.Collections; +import java.util.HashSet; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -67,13 +69,24 @@ class PreprocessorInclude implements ReadLine { private PreprocessorInclude included = null; private final File oldCurrentDir; - private final Set filesUsed; + private final Set filesUsedCurrent; + private final Set filesUsedGlobal; - public PreprocessorInclude(ReadLine reader, Defines defines, String charset, Set filesUsed, File newCurrentDir) { + public PreprocessorInclude(ReadLine reader, Defines defines, String charset, File newCurrentDir) { + this(reader, defines, charset, newCurrentDir, new HashSet(), new HashSet()); + } + + public Set getFilesUsedGlobal() { + return Collections.unmodifiableSet(filesUsedGlobal); + } + + private PreprocessorInclude(ReadLine reader, Defines defines, String charset, File newCurrentDir, + Set filesUsedCurrent, Set filesUsedGlobal) { this.defines = defines; this.charset = charset; this.reader2 = reader; - this.filesUsed = filesUsed; + this.filesUsedCurrent = filesUsedCurrent; + this.filesUsedGlobal = filesUsedGlobal; if (newCurrentDir == null) { oldCurrentDir = null; } else { @@ -92,7 +105,7 @@ class PreprocessorInclude implements ReadLine { final String result = readLineInternal(); if (result != null && (StartUtils.isArobaseEndDiagram(result) || StartUtils.isArobaseStartDiagram(result))) { // http://plantuml.sourceforge.net/qa/?qa=3389/error-generating-when-same-file-included-different-diagram - filesUsed.clear(); + filesUsedCurrent.clear(); } return result; } @@ -138,7 +151,8 @@ class PreprocessorInclude implements ReadLine { } try { final URL url = new URL(urlString); - included = new PreprocessorInclude(getReaderInclude(url, suf), defines, charset, filesUsed, null); + included = new PreprocessorInclude(getReaderInclude(url, suf), defines, charset, null, filesUsedCurrent, + filesUsedGlobal); } catch (MalformedURLException e) { return "Cannot include url " + urlString; } @@ -157,11 +171,13 @@ class PreprocessorInclude implements ReadLine { final File f = FileSystem.getInstance().getFile(withEnvironmentVariable(fileName)); if (f.exists() == false) { return "Cannot include " + f.getAbsolutePath(); - } else if (filesUsed.contains(f)) { + } else if (filesUsedCurrent.contains(f)) { return "File already included " + f.getAbsolutePath(); } else { - filesUsed.add(f); - included = new PreprocessorInclude(getReaderInclude(f, suf), defines, charset, filesUsed, f.getParentFile()); + filesUsedCurrent.add(f); + filesUsedGlobal.add(f); + included = new PreprocessorInclude(getReaderInclude(f, suf), defines, charset, f.getParentFile(), + filesUsedCurrent, filesUsedGlobal); } return this.readLine(); } diff --git a/src/net/sourceforge/plantuml/project2/RowMerge.java b/src/net/sourceforge/plantuml/project2/RowMerge.java index 3b85e0452..ac4142f1e 100644 --- a/src/net/sourceforge/plantuml/project2/RowMerge.java +++ b/src/net/sourceforge/plantuml/project2/RowMerge.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.project2; 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.TextBlock; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -52,7 +53,7 @@ class RowMerge implements Row { } public TextBlock asTextBloc(final TimeConverter timeConverter) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { r1.asTextBloc(timeConverter).drawU(ug); @@ -80,7 +81,7 @@ class RowMerge implements Row { } public TextBlock header() { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { r1.header().drawU(ug); diff --git a/src/net/sourceforge/plantuml/project2/RowOverwrite.java b/src/net/sourceforge/plantuml/project2/RowOverwrite.java index a054fbfb6..7cc8f71c4 100644 --- a/src/net/sourceforge/plantuml/project2/RowOverwrite.java +++ b/src/net/sourceforge/plantuml/project2/RowOverwrite.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.project2; 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.TextBlock; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -52,7 +53,7 @@ class RowOverwrite implements Row { } public TextBlock asTextBloc(final TimeConverter timeConverter) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final double minX = getMinXwithoutHeader(timeConverter); diff --git a/src/net/sourceforge/plantuml/project2/RowSimple.java b/src/net/sourceforge/plantuml/project2/RowSimple.java index 79fe3f073..5c6ea07fc 100644 --- a/src/net/sourceforge/plantuml/project2/RowSimple.java +++ b/src/net/sourceforge/plantuml/project2/RowSimple.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.project2; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; @@ -75,7 +76,7 @@ public class RowSimple implements Row { } public TextBlock asTextBloc(final TimeConverter timeConverter) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { final double x1 = getMinXwithoutHeader(timeConverter) + 1; diff --git a/src/net/sourceforge/plantuml/project2/TimeHeaderDay.java b/src/net/sourceforge/plantuml/project2/TimeHeaderDay.java index a3e602e54..49effab05 100644 --- a/src/net/sourceforge/plantuml/project2/TimeHeaderDay.java +++ b/src/net/sourceforge/plantuml/project2/TimeHeaderDay.java @@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColorUtils; @@ -52,7 +53,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class TimeHeaderDay implements TextBlock { +public class TimeHeaderDay extends AbstractTextBlock implements TextBlock { private final Day start; private final Day end; diff --git a/src/net/sourceforge/plantuml/project2/TimeHeaderMonth.java b/src/net/sourceforge/plantuml/project2/TimeHeaderMonth.java index 33dac268d..a5efb3d15 100644 --- a/src/net/sourceforge/plantuml/project2/TimeHeaderMonth.java +++ b/src/net/sourceforge/plantuml/project2/TimeHeaderMonth.java @@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColorUtils; @@ -52,7 +53,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class TimeHeaderMonth implements TextBlock { +public class TimeHeaderMonth extends AbstractTextBlock implements TextBlock { private final Day start; private final Day end; diff --git a/src/net/sourceforge/plantuml/real/RealLine.java b/src/net/sourceforge/plantuml/real/RealLine.java index 8a3547dc2..1c130ad11 100644 --- a/src/net/sourceforge/plantuml/real/RealLine.java +++ b/src/net/sourceforge/plantuml/real/RealLine.java @@ -68,6 +68,8 @@ class RealLine { int cpt = 0; final Map counter = new HashMap(); do { + min = 0; + max = 0; boolean done = true; for (PositiveForce f : forces) { // System.err.println("force=" + f); diff --git a/src/net/sourceforge/plantuml/sequencediagram/LifeEvent.java b/src/net/sourceforge/plantuml/sequencediagram/LifeEvent.java index 049c4eb11..3809cea05 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/LifeEvent.java +++ b/src/net/sourceforge/plantuml/sequencediagram/LifeEvent.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15231 $ + * Revision $Revision: 16293 $ * */ package net.sourceforge.plantuml.sequencediagram; @@ -76,10 +76,15 @@ public class LifeEvent extends AbstractEvent implements Event { return type == LifeEventType.DEACTIVATE || type == LifeEventType.DESTROY; } + @Deprecated public boolean isDestroy() { return type == LifeEventType.DESTROY; } + public boolean isDestroy(Participant p) { + return this.p == p && type == LifeEventType.DESTROY; + } + // public double getStrangePos() { // return message.getPosYendLevel(); // } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java index 6e327350b..fa3843237 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java @@ -140,7 +140,8 @@ public class CommunicationExoTile implements TileWithUpdateStairs { if (message.getType().isRightBorder()) { return livingSpace.getPosC(stringBounder).getCurrentValue(); } - return tileArguments.getOrigin().getMinAbsolute().getCurrentValue(); + // return tileArguments.getOrigin().getMinAbsolute().getCurrentValue(); + return tileArguments.getOrigin().getCurrentValue(); } private Real getPoint2(final StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/ComponentAdapter.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/ComponentAdapter.java index 8379290e0..ce71e9eff 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/ComponentAdapter.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/ComponentAdapter.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.sequencediagram.teoz; 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.TextBlock; import net.sourceforge.plantuml.skin.Area; @@ -43,7 +44,7 @@ import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.SimpleContext2D; import net.sourceforge.plantuml.ugraphic.UGraphic; -public class ComponentAdapter implements TextBlock { +public class ComponentAdapter extends AbstractTextBlock implements TextBlock { private final Component component; diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/ElseTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/ElseTile.java index 02a9b5606..5fca4f8ca 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/ElseTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/ElseTile.java @@ -42,13 +42,10 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.sequencediagram.Event; import net.sourceforge.plantuml.sequencediagram.GroupingLeaf; -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.Skin; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UTranslate; public class ElseTile implements TileWithCallbackY { @@ -68,7 +65,7 @@ public class ElseTile implements TileWithCallbackY { this.parent = parent; } - private Component getComponent(StringBounder stringBounder) { + public Component getComponent(StringBounder stringBounder) { // final Display display = Display.create(anElse.getTitle()); final ISkinParam tmp = new SkinParamBackcolored(skinParam, anElse.getBackColorElement(), anElse.getBackColorGeneral()); @@ -79,21 +76,21 @@ public class ElseTile implements TileWithCallbackY { } public void drawU(UGraphic ug) { - final StringBounder stringBounder = ug.getStringBounder(); - final Component comp = getComponent(stringBounder); - final Dimension2D dim = comp.getPreferredDimension(stringBounder); - final Real min = getMinX(stringBounder); - final Real max = getMaxX(stringBounder); - final Context2D context = (Context2D) ug; - double height = dim.getHeight(); - if (context.isBackground() && parent instanceof GroupingTile) { - final double startingY = ((GroupingTile) parent).getStartY(); - final double totalParentHeight = parent.getPreferredHeight(stringBounder); - height = totalParentHeight - (startingY - y); - } - final Area area = new Area(max.getCurrentValue() - min.getCurrentValue(), height); - ug = ug.apply(new UTranslate(min.getCurrentValue(), 0)); - comp.drawU(ug, area, context); + // final StringBounder stringBounder = ug.getStringBounder(); + // final Component comp = getComponent(stringBounder); + // final Dimension2D dim = comp.getPreferredDimension(stringBounder); + // final Real min = getMinX(stringBounder); + // final Real max = getMaxX(stringBounder); + // final Context2D context = (Context2D) ug; + // double height = dim.getHeight(); + // // if (context.isBackground() && parent instanceof GroupingTile) { + // // final double startingY = ((GroupingTile) parent).getStartY(); + // // final double totalParentHeight = parent.getPreferredHeight(stringBounder); + // // height = totalParentHeight - (startingY - y); + // // } + // final Area area = new Area(max.getCurrentValue() - min.getCurrentValue(), height); + // ug = ug.apply(new UTranslate(min.getCurrentValue(), 0)); + // comp.drawU(ug, area, context); } public double getPreferredHeight(StringBounder stringBounder) { @@ -113,7 +110,9 @@ public class ElseTile implements TileWithCallbackY { } public Real getMaxX(StringBounder stringBounder) { - return parent.getMaxX(stringBounder); + final Component comp = getComponent(stringBounder); + final Dimension2D dim = comp.getPreferredDimension(stringBounder); + return getMinX(stringBounder).addFixed(dim.getWidth()); } private double y; @@ -122,4 +121,8 @@ public class ElseTile implements TileWithCallbackY { this.y = y; } + public double getCallbackY() { + return y; + } + } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java index ab2726c44..da039fde1 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java @@ -102,6 +102,9 @@ public class EventsHistory { } } + if (level < 0) { + return 0; + } // System.err.println("<-result1 is " + level); return level; } @@ -120,7 +123,7 @@ public class EventsHistory { final Event next = nextButSkippingNotes(it); if (next instanceof LifeEvent) { final LifeEvent le = (LifeEvent) next; - return le.isDestroy(); + return le.isDestroy(p); } } return false; diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java index 289034dac..769204916 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java @@ -84,15 +84,15 @@ public class GroupingTile implements TileWithCallbackY { 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(); - // this.max = min.addAtLeast(dim1.getWidth()); final List min2 = new ArrayList(); final List max2 = new ArrayList(); + final List allElses = new ArrayList(); while (it.hasNext()) { final Event ev = it.next(); - System.err.println("GroupingTile::ev=" + ev); if (ev instanceof GroupingLeaf && ((Grouping) ev).getType() == GroupingType.END) { break; } @@ -101,6 +101,7 @@ public class GroupingTile implements TileWithCallbackY { tiles.add(tile); bodyHeight += tile.getPreferredHeight(stringBounder); if (ev instanceof GroupingLeaf && ((Grouping) ev).getType() == GroupingType.ELSE) { + allElses.add(tile); continue; } min2.add(tile.getMinX(stringBounder).addFixed(-MARGINX)); @@ -114,6 +115,9 @@ public class GroupingTile implements TileWithCallbackY { min2.add(tileArgumentsOriginal.getOrigin()); } this.min = RealUtils.min(min2); + for (Tile anElse : allElses) { + max2.add(anElse.getMaxX(stringBounder)); + } max2.add(this.min.addFixed(width + 16)); this.max = RealUtils.max(max2); @@ -124,7 +128,7 @@ public class GroupingTile implements TileWithCallbackY { return comp; } - public Dimension2D getPreferredDimensionIfEmpty(StringBounder stringBounder) { + private Dimension2D getPreferredDimensionIfEmpty(StringBounder stringBounder) { return getComponent(stringBounder).getPreferredDimension(stringBounder); } @@ -133,11 +137,11 @@ public class GroupingTile implements TileWithCallbackY { final Component comp = getComponent(stringBounder); final Dimension2D dim1 = getPreferredDimensionIfEmpty(stringBounder); - final Area area = new Area(max.getCurrentValue() - min.getCurrentValue(), bodyHeight + dim1.getHeight() - + MARGINY / 2); + 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); + drawAllElses(ug); } // ug.apply(new UChangeBackColor(HtmlColorUtils.LIGHT_GRAY)).draw(new URectangle(area.getDimensionToUse())); @@ -149,6 +153,35 @@ public class GroupingTile implements TileWithCallbackY { } + private double getTotalHeight(StringBounder stringBounder) { + final Dimension2D dimIfEmpty = getPreferredDimensionIfEmpty(stringBounder); + return bodyHeight + dimIfEmpty.getHeight() + MARGINY / 2; + } + + private void drawAllElses(UGraphic ug) { + final StringBounder stringBounder = ug.getStringBounder(); + final double totalHeight = getTotalHeight(stringBounder); + final double suppHeight = getPreferredDimensionIfEmpty(stringBounder).getHeight() + MARGINY / 2; + final List ys = new ArrayList(); + for (Tile tile : tiles) { + if (tile instanceof ElseTile) { + final ElseTile elseTile = (ElseTile) tile; + ys.add(elseTile.getCallbackY() - y + suppHeight); + } + } + ys.add(totalHeight); + int i = 0; + for (Tile tile : tiles) { + if (tile instanceof ElseTile) { + final ElseTile elseTile = (ElseTile) tile; + final Component comp = elseTile.getComponent(stringBounder); + final Area area = new Area(max.getCurrentValue() - min.getCurrentValue(), ys.get(i + 1) - ys.get(i)); + comp.drawU(ug.apply(new UTranslate(min.getCurrentValue(), ys.get(i))), area, (Context2D) ug); + i++; + } + } + } + public double getPreferredHeight(StringBounder stringBounder) { final Dimension2D dim1 = getPreferredDimensionIfEmpty(stringBounder); return dim1.getHeight() + bodyHeight + MARGINY; @@ -174,7 +207,26 @@ public class GroupingTile implements TileWithCallbackY { this.y = y; } - public double getStartY() { - return y + MARGINY; + public static double fillPositionelTiles(StringBounder stringBounder, double y, List tiles, + final List positionedTiles) { + double lastY = y; + for (Tile tile : tiles) { + if (tile.getEvent().isParallel()) { + y = lastY; + } + positionedTiles.add(new YPositionedTile(tile, y)); + if (tile instanceof GroupingTile) { + final GroupingTile groupingTile = (GroupingTile) tile; + fillPositionelTiles(stringBounder, y, groupingTile.tiles, new ArrayList()); + } + lastY = y; + y += tile.getPreferredHeight(stringBounder); + } + return y; + } + + // public double getStartY() { + // return y + MARGINY; + // } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/IntegerColored.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/IntegerColored.java index 9a9653537..7ed3c2ae1 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/IntegerColored.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/IntegerColored.java @@ -41,6 +41,9 @@ public class IntegerColored { private final HtmlColor color; public IntegerColored(int value, HtmlColor color) { + if (value < 0) { + throw new IllegalArgumentException(); + } this.value = value; this.color = color; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxes.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxes.java index 329907a1d..56f321977 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxes.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxes.java @@ -38,6 +38,7 @@ import java.util.Map; import java.util.TreeMap; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.skin.Skin; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -50,7 +51,7 @@ public class LiveBoxes { private final ISkinParam skinParam; private final Map delays = new TreeMap(); - public LiveBoxes(EventsHistory eventsHistory, Skin skin, ISkinParam skinParam) { + public LiveBoxes(EventsHistory eventsHistory, Skin skin, ISkinParam skinParam, Participant participant) { this.eventsHistory = eventsHistory; this.skin = skin; this.skinParam = skinParam; diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java index 7a1c1b40c..688efa285 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java @@ -134,7 +134,7 @@ public class LivingSpace { // this.stairs2.addStep2(0, 0); this.useContinueLineBecauseOfDelay = useContinueLineBecauseOfDelay(events); this.mutingLine = new MutingLine(skin, skinParam, events); - this.liveBoxes = new LiveBoxes(eventsHistory, skin, skinParam); + this.liveBoxes = new LiveBoxes(eventsHistory, skin, skinParam, p); } private boolean useContinueLineBecauseOfDelay(List events) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/MainTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/MainTile.java index 9971ea31e..33b7d6bfb 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/MainTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/MainTile.java @@ -93,20 +93,8 @@ public class MainTile implements Tile { private double drawUInternal(UGraphic ug, boolean trace) { final StringBounder stringBounder = ug.getStringBounder(); - double y = 0; - double lastY = 0; final List positionedTiles = new ArrayList(); - for (Tile tile : tiles) { - if (tile.getEvent().isParallel()) { - y = lastY; - } - if (trace) { - System.err.println("MainTile::drawUInternal tile=" + tile + " y=" + y); - } - positionedTiles.add(new YPositionedTile(tile, y)); - lastY = y; - y += tile.getPreferredHeight(stringBounder); - } + final double y = GroupingTile.fillPositionelTiles(stringBounder, 0, tiles, positionedTiles); for (YPositionedTile tile : positionedTiles) { tile.drawU(ug); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/MainTileAdapter.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/MainTileAdapter.java index 6caec335a..5929042a4 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/MainTileAdapter.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/MainTileAdapter.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.sequencediagram.teoz; 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.TextBlock; import net.sourceforge.plantuml.graphic.VerticalAlignment; @@ -45,7 +46,7 @@ import net.sourceforge.plantuml.skin.SimpleContext2D; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class MainTileAdapter implements TextBlock { +public class MainTileAdapter extends AbstractTextBlock implements TextBlock { private final MainTile mainTile; private Dimension2D cacheDimension; diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/Stairs2.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/Stairs2.java index e180e519e..6657c1e3d 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/Stairs2.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/Stairs2.java @@ -47,7 +47,15 @@ public class Stairs2 { private final List values = new ArrayList(); private final Map cache = new HashMap(); + @Override + public String toString() { + return ys.toString() + " " + values; + } + public void addStep(StairsPosition position, int value, HtmlColor color) { + if (value < 0) { + throw new IllegalArgumentException(); + } // System.err.println("Stairs2::addStep " + position + " " + value + " color=" + color); assert ys.size() == values.size(); if (ys.size() > 0) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/TeozLayer.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/TeozLayer.java index 670f831c5..6519ed6e1 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/TeozLayer.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/TeozLayer.java @@ -37,12 +37,13 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.png.PngTitler; import net.sourceforge.plantuml.ugraphic.UGraphic; -public class TeozLayer implements TextBlock { +public class TeozLayer extends AbstractTextBlock implements TextBlock { private final PngTitler titler; private Dimension2D dimension; diff --git a/src/net/sourceforge/plantuml/skin/StickMan.java b/src/net/sourceforge/plantuml/skin/StickMan.java index 1676f2348..0e320722e 100644 --- a/src/net/sourceforge/plantuml/skin/StickMan.java +++ b/src/net/sourceforge/plantuml/skin/StickMan.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15957 $ + * Revision $Revision: 16265 $ * */ package net.sourceforge.plantuml.skin; @@ -36,6 +36,7 @@ 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.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; @@ -46,7 +47,7 @@ import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class StickMan implements TextBlock { +public class StickMan extends AbstractTextBlock implements TextBlock { private final double armsY = 8; private final double armsLenght = 13; diff --git a/src/net/sourceforge/plantuml/skin/VisibilityModifier.java b/src/net/sourceforge/plantuml/skin/VisibilityModifier.java index 94d3f37af..bd9e670d5 100644 --- a/src/net/sourceforge/plantuml/skin/VisibilityModifier.java +++ b/src/net/sourceforge/plantuml/skin/VisibilityModifier.java @@ -37,6 +37,7 @@ import java.awt.geom.Dimension2D; 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.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -76,7 +77,7 @@ public enum VisibilityModifier { } public TextBlock getUBlock(final int size, final HtmlColor foregroundColor, final HtmlColor backgoundColor) { - return new TextBlock() { + return new AbstractTextBlock() { public Dimension2D calculateDimension(StringBounder stringBounder) { return new Dimension2DDouble(size + 1, size + 1); diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandAddField.java b/src/net/sourceforge/plantuml/statediagram/command/CommandAddField.java index 6f938452d..a0a323956 100644 --- a/src/net/sourceforge/plantuml/statediagram/command/CommandAddField.java +++ b/src/net/sourceforge/plantuml/statediagram/command/CommandAddField.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 12842 $ + * Revision $Revision: 16273 $ * */ package net.sourceforge.plantuml.statediagram.command; @@ -66,7 +66,7 @@ public class CommandAddField extends SingleLineCommand2 { final IEntity entity = diagram.getOrCreateLeaf(Code.of(code), null, null); - entity.addFieldOrMethod(field); + entity.getBodier().addFieldOrMethod(field); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java b/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java index 8cb7bc2e6..b574030d0 100644 --- a/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java +++ b/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 13992 $ + * Revision $Revision: 16273 $ * */ package net.sourceforge.plantuml.statediagram.command; @@ -116,7 +116,7 @@ public class CommandCreateState extends SingleLineCommand2 { final String addFields = arg.get("ADDFIELD", 0); if (addFields != null) { - ent.addFieldOrMethod(addFields); + ent.getBodier().addFieldOrMethod(addFields); } return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/svek/AbstractEntityImage.java b/src/net/sourceforge/plantuml/svek/AbstractEntityImage.java index 4c172843e..8918c1f5f 100644 --- a/src/net/sourceforge/plantuml/svek/AbstractEntityImage.java +++ b/src/net/sourceforge/plantuml/svek/AbstractEntityImage.java @@ -36,9 +36,10 @@ package net.sourceforge.plantuml.svek; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HtmlColor; -public abstract class AbstractEntityImage implements IEntityImage { +public abstract class AbstractEntityImage extends AbstractTextBlock implements IEntityImage { private final IEntity entity; private final ISkinParam skinParam; diff --git a/src/net/sourceforge/plantuml/svek/Boundary.java b/src/net/sourceforge/plantuml/svek/Boundary.java index 0311862f0..cc13bfa1a 100644 --- a/src/net/sourceforge/plantuml/svek/Boundary.java +++ b/src/net/sourceforge/plantuml/svek/Boundary.java @@ -36,19 +36,15 @@ package net.sourceforge.plantuml.svek; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; -import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPath; -import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class Boundary implements TextBlock { +public class Boundary extends AbstractTextBlock { private final double margin = 4; diff --git a/src/net/sourceforge/plantuml/svek/CircleInterface2.java b/src/net/sourceforge/plantuml/svek/CircleInterface2.java index 1bb26b8f4..a8620f6f3 100644 --- a/src/net/sourceforge/plantuml/svek/CircleInterface2.java +++ b/src/net/sourceforge/plantuml/svek/CircleInterface2.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.svek; import java.awt.geom.Dimension2D; 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; @@ -46,7 +47,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class CircleInterface2 implements TextBlock { +public class CircleInterface2 extends AbstractTextBlock implements TextBlock { private final double margin = 1; diff --git a/src/net/sourceforge/plantuml/svek/Cluster.java b/src/net/sourceforge/plantuml/svek/Cluster.java index 7792420a4..7d809b394 100644 --- a/src/net/sourceforge/plantuml/svek/Cluster.java +++ b/src/net/sourceforge/plantuml/svek/Cluster.java @@ -451,7 +451,7 @@ public class Cluster implements Moveable { private TextBlockWidth getTextBlockAttribute(DotData dotData) { final TextBlockWidth attribute; - final List members = group.getFieldsToDisplay(); + final List members = group.getBodier().getFieldsToDisplay(); if (members.size() == 0) { attribute = new TextBlockEmpty(); } else { diff --git a/src/net/sourceforge/plantuml/svek/Control.java b/src/net/sourceforge/plantuml/svek/Control.java index cafd347e8..eb5a170b8 100644 --- a/src/net/sourceforge/plantuml/svek/Control.java +++ b/src/net/sourceforge/plantuml/svek/Control.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.svek; import java.awt.geom.Dimension2D; 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; @@ -48,7 +49,7 @@ import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class Control implements TextBlock { +public class Control extends AbstractTextBlock implements TextBlock { private final double margin = 4; diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2.java index dd9ec2d23..9da1b8b68 100644 --- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2.java +++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2.java @@ -390,7 +390,7 @@ public final class CucaDiagramFileMakerSvek2 { final Cluster stateParent = bibliotekon.getCluster(leaf.getParentContainer()); return new EntityImageStateBorder(leaf, skinParam, stateParent, bibliotekon); } - if (isHideEmptyDescriptionForState && leaf.getFieldsToDisplay().size() == 0) { + if (isHideEmptyDescriptionForState && leaf.getBodier().getFieldsToDisplay().size() == 0) { return new EntityImageStateEmptyDescription(leaf, skinParam); } if (leaf.getStereotype() != null && "<>".equals(leaf.getStereotype().getLabel(false))) { @@ -463,7 +463,7 @@ public final class CucaDiagramFileMakerSvek2 { return new EntityImagePseudoState(leaf, skinParam); } if (leaf.getEntityType() == LeafType.TIPS) { - return new EntityImageTips(leaf, skinParam, bibliotekon, portionShower); + return new EntityImageTips(leaf, skinParam, bibliotekon); } throw new UnsupportedOperationException(leaf.getEntityType().toString()); } @@ -514,7 +514,7 @@ public final class CucaDiagramFileMakerSvek2 { final TextBlock stereoAndTitle = TextBlockUtils.mergeTB(stereo, title, HorizontalAlignment.CENTER); final Dimension2D dimLabel = stereoAndTitle.calculateDimension(stringBounder); if (dimLabel.getWidth() > 0) { - final List members = ((IEntity) g).getFieldsToDisplay(); + final List members = ((IEntity) g).getBodier().getFieldsToDisplay(); final TextBlockWidth attribute; if (members.size() == 0) { attribute = new TextBlockEmpty(); diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java index e0f54c352..d82d3f82a 100644 --- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java +++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2InternalImage.java @@ -42,6 +42,7 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.ILeaf; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; @@ -52,7 +53,7 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; -public final class CucaDiagramFileMakerSvek2InternalImage implements IEntityImage { +public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBlock implements IEntityImage { private final List inners = new ArrayList(); private final Separator separator; diff --git a/src/net/sourceforge/plantuml/svek/DecorateEntityImage.java b/src/net/sourceforge/plantuml/svek/DecorateEntityImage.java index b5bc7c0d2..86a9c7858 100644 --- a/src/net/sourceforge/plantuml/svek/DecorateEntityImage.java +++ b/src/net/sourceforge/plantuml/svek/DecorateEntityImage.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.svek; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; @@ -44,7 +45,7 @@ import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class DecorateEntityImage implements TextBlockBackcolored { +public class DecorateEntityImage extends AbstractTextBlock implements TextBlockBackcolored { private final TextBlock original; private final HorizontalAlignment horizontal1; diff --git a/src/net/sourceforge/plantuml/svek/DecorateEntityImage3.java b/src/net/sourceforge/plantuml/svek/DecorateEntityImage3.java index b564f383d..a31f71d21 100644 --- a/src/net/sourceforge/plantuml/svek/DecorateEntityImage3.java +++ b/src/net/sourceforge/plantuml/svek/DecorateEntityImage3.java @@ -35,12 +35,13 @@ package net.sourceforge.plantuml.svek; import java.awt.geom.Dimension2D; +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; -public class DecorateEntityImage3 implements TextBlockBackcolored { +public class DecorateEntityImage3 extends AbstractTextBlock implements TextBlockBackcolored { private final TextBlock original; private final HtmlColor color; diff --git a/src/net/sourceforge/plantuml/svek/DecorateTextBlock.java b/src/net/sourceforge/plantuml/svek/DecorateTextBlock.java index 982bf26dd..57cec41f9 100644 --- a/src/net/sourceforge/plantuml/svek/DecorateTextBlock.java +++ b/src/net/sourceforge/plantuml/svek/DecorateTextBlock.java @@ -36,13 +36,14 @@ package net.sourceforge.plantuml.svek; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class DecorateTextBlock implements TextBlock { +public class DecorateTextBlock extends AbstractTextBlock implements TextBlock { private final TextBlock original; private final HorizontalAlignment horizontal1; diff --git a/src/net/sourceforge/plantuml/svek/EntityDomain.java b/src/net/sourceforge/plantuml/svek/EntityDomain.java index 4187e35a0..90a207b76 100644 --- a/src/net/sourceforge/plantuml/svek/EntityDomain.java +++ b/src/net/sourceforge/plantuml/svek/EntityDomain.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.svek; 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; @@ -44,7 +45,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class EntityDomain implements TextBlock { +public class EntityDomain extends AbstractTextBlock implements TextBlock { private final double margin = 4; diff --git a/src/net/sourceforge/plantuml/svek/EntityImageProtected.java b/src/net/sourceforge/plantuml/svek/EntityImageProtected.java index 735f3b306..a6fe863ea 100644 --- a/src/net/sourceforge/plantuml/svek/EntityImageProtected.java +++ b/src/net/sourceforge/plantuml/svek/EntityImageProtected.java @@ -34,20 +34,27 @@ package net.sourceforge.plantuml.svek; import java.awt.geom.Dimension2D; +import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class EntityImageProtected implements IEntityImage, Untranslated { +public class EntityImageProtected extends AbstractTextBlock implements IEntityImage, Untranslated { private final IEntityImage orig; private final double border; private final Bibliotekon bibliotekon; private final Neighborhood neighborhood; + + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) { + throw new UnsupportedOperationException(); + } + public EntityImageProtected(IEntityImage orig, double border, Neighborhood neighborhood, Bibliotekon bibliotekon) { this.orig = orig; diff --git a/src/net/sourceforge/plantuml/svek/GraphvizCrash.java b/src/net/sourceforge/plantuml/svek/GraphvizCrash.java index 763cd1874..ad43faacb 100644 --- a/src/net/sourceforge/plantuml/svek/GraphvizCrash.java +++ b/src/net/sourceforge/plantuml/svek/GraphvizCrash.java @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; import net.sourceforge.plantuml.flashcode.FlashCodeFactory; import net.sourceforge.plantuml.flashcode.FlashCodeUtils; import net.sourceforge.plantuml.fun.IconLoader; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.GraphicPosition; import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.graphic.HtmlColor; @@ -57,7 +58,7 @@ import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.version.Version; -public class GraphvizCrash implements IEntityImage { +public class GraphvizCrash extends AbstractTextBlock implements IEntityImage { private static final UFont font = new UFont("SansSerif", Font.PLAIN, 12); diff --git a/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java b/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java index 7f9fc8982..a1bd766ef 100644 --- a/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java +++ b/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java @@ -149,7 +149,7 @@ public final class GroupPngMakerState { final Stereotype stereo = group.getStereotype(); final HtmlColor backColor = group.getSpecificBackColor() == null ? getColor(ColorParam.stateBackground, stereo) : group.getSpecificBackColor(); - final List members = ((IEntity) group).getFieldsToDisplay(); + final List members = ((IEntity) group).getBodier().getFieldsToDisplay(); final TextBlockWidth attribute; if (members.size() == 0) { attribute = new TextBlockEmpty(); diff --git a/src/net/sourceforge/plantuml/svek/InnerActivity.java b/src/net/sourceforge/plantuml/svek/InnerActivity.java index 1b78e877c..6088fc121 100644 --- a/src/net/sourceforge/plantuml/svek/InnerActivity.java +++ b/src/net/sourceforge/plantuml/svek/InnerActivity.java @@ -35,6 +35,7 @@ package net.sourceforge.plantuml.svek; import java.awt.geom.Dimension2D; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -43,7 +44,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; -public final class InnerActivity implements IEntityImage { +public final class InnerActivity extends AbstractTextBlock implements IEntityImage { private final IEntityImage im; private final HtmlColor borderColor; diff --git a/src/net/sourceforge/plantuml/svek/InnerStateAutonom.java b/src/net/sourceforge/plantuml/svek/InnerStateAutonom.java index 4cc655f57..569eba445 100644 --- a/src/net/sourceforge/plantuml/svek/InnerStateAutonom.java +++ b/src/net/sourceforge/plantuml/svek/InnerStateAutonom.java @@ -37,6 +37,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -47,7 +48,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; -public final class InnerStateAutonom implements IEntityImage { +public final class InnerStateAutonom extends AbstractTextBlock implements IEntityImage { private final IEntityImage im; private final TextBlock title; diff --git a/src/net/sourceforge/plantuml/svek/Line.java b/src/net/sourceforge/plantuml/svek/Line.java index dbe2c530f..f09bbbd5d 100644 --- a/src/net/sourceforge/plantuml/svek/Line.java +++ b/src/net/sourceforge/plantuml/svek/Line.java @@ -56,6 +56,7 @@ import net.sourceforge.plantuml.cucadiagram.LinkHat; import net.sourceforge.plantuml.cucadiagram.LinkMiddleDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; @@ -137,7 +138,7 @@ public class Line implements Moveable, Hideable { return super.toString() + " color=" + lineColor; } - class DirectionalTextBlock implements TextBlock { + class DirectionalTextBlock extends AbstractTextBlock implements TextBlock { private final TextBlock right; private final TextBlock left; diff --git a/src/net/sourceforge/plantuml/svek/SvekResult.java b/src/net/sourceforge/plantuml/svek/SvekResult.java index e0c910bf3..7acd2f48c 100644 --- a/src/net/sourceforge/plantuml/svek/SvekResult.java +++ b/src/net/sourceforge/plantuml/svek/SvekResult.java @@ -38,8 +38,8 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.cucadiagram.dot.DotData; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.posimo.Moveable; import net.sourceforge.plantuml.skin.rose.Rose; @@ -49,7 +49,7 @@ import net.sourceforge.plantuml.ugraphic.UHidden; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; -public final class SvekResult implements IEntityImage, Moveable { +public final class SvekResult extends AbstractTextBlock implements IEntityImage, Moveable { private final Rose rose = new Rose(); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java b/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java index 4c677414a..ad66931f5 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java @@ -34,6 +34,7 @@ package net.sourceforge.plantuml.svek.image; import java.awt.geom.Dimension2D; +import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; @@ -44,11 +45,11 @@ import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.creole.Stencil; +import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.PortionShower; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion; import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.svek.AbstractEntityImage; @@ -68,7 +69,6 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil { final private int shield; final private EntityImageClassHeader2 header; final private Url url; - final private TextBlock mouseOver; final private double roundCorner; final private LineConfigurable lineConfig; @@ -78,16 +78,12 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil { this.lineConfig = entity; this.roundCorner = skinParam.getRoundCorner(); this.shield = version != null && version.useShield() && entity.hasNearDecoration() ? 16 : 0; - this.body = entity.getBody(portionShower).asTextBlock(FontParam.CLASS_ATTRIBUTE, skinParam); + final boolean showMethods = portionShower.showPortion(EntityPortion.METHOD, entity); + final boolean showFields = portionShower.showPortion(EntityPortion.FIELD, entity); + this.body = entity.getBodier().getBody(FontParam.CLASS_ATTRIBUTE, skinParam, showMethods, showFields); header = new EntityImageClassHeader2(entity, skinParam, portionShower); this.url = entity.getUrl99(); - if (entity.getMouseOver() == null) { - this.mouseOver = null; - } else { - this.mouseOver = entity.getMouseOver().asTextBlock(FontParam.CLASS_ATTRIBUTE, skinParam); - } - } // private int marginEmptyFieldsOrMethod = 13; @@ -103,36 +99,22 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil { return new Dimension2DDouble(width, height); } + @Override + public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) { + final Rectangle2D result = body.getInnerPosition(member, stringBounder); + if (result == null) { + return result; + } + final Dimension2D dimHeader = header.calculateDimension(stringBounder); + final UTranslate translate = new UTranslate(0, dimHeader.getHeight()); + return translate.apply(result); + } + final public void drawU(UGraphic ug) { if (url != null) { ug.startUrl(url); } drawInternal(ug); - if (mouseOver != null) { - // final UGroup g = ug.createGroup(); - // ug = ug.apply(new UChangeBackColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.classBackground, - // getStereo()))); - // final Dimension2D dim = mouseOver.calculateDimension(ug.getStringBounder()); - // final Shadowable rect = new URectangle(dim.getWidth(), dim.getHeight()); - // if (getSkinParam().shadowing()) { - // rect.setDeltaShadow(4); - // } - // - // final HtmlColor classBorder = SkinParamUtils.getColor(getSkinParam(), ColorParam.classBorder, - // getStereo()); - // ug = ug.apply( - // new UChangeBackColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.classBackground, - // getStereo()))).apply(new UChangeColor(classBorder)); - // - // final double x = 30; - // final double y = 30; - // // ug.getParam().setStroke(new UStroke(1.5)); - // // g.draw(x, y, rect); - // // ug.getParam().resetStroke(); - // final UGraphic ug2 = new UGraphicHorizontalLine(ug, x, x + dim.getWidth(), getStroke()); - // mouseOver.drawUNewWayINLINED(ug2.apply(new UTranslate(x, y))); - // g.close(); - } if (url != null) { ug.closeAction(); @@ -165,7 +147,8 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil { final UStroke stroke = getStroke(); ug.apply(stroke).draw(rect); - final HtmlColor headerBackcolor = getSkinParam().getHtmlColor(ColorParam.classHeaderBackground, getStereo(), false); + final HtmlColor headerBackcolor = getSkinParam().getHtmlColor(ColorParam.classHeaderBackground, getStereo(), + false); if (headerBackcolor != null) { final Shadowable rect2 = new URectangle(widthTotal, dimHeader.getHeight()); ug.apply(new UChangeBackColor(headerBackcolor)).apply(stroke).draw(rect2); @@ -174,7 +157,8 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil { if (body != null) { final UGraphic ug2 = new UGraphicStencil(ug, this, stroke); - body.drawU(ug2.apply(new UTranslate(0, dimHeader.getHeight()))); + final UTranslate translate = new UTranslate(0, dimHeader.getHeight()); + body.drawU(ug2.apply(translate)); } } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageNoteLink.java b/src/net/sourceforge/plantuml/svek/image/EntityImageNoteLink.java index b0335a465..96818b252 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageNoteLink.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageNoteLink.java @@ -39,6 +39,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; @@ -50,7 +51,7 @@ import net.sourceforge.plantuml.svek.IEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UGraphic; -public class EntityImageNoteLink implements IEntityImage { +public class EntityImageNoteLink extends AbstractTextBlock implements IEntityImage { private final Component comp; diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java b/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java index 8b50ecd11..4ecd9b9b6 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java @@ -86,33 +86,26 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil { this.lineConfig = entity; final Stereotype stereotype = entity.getStereotype(); this.roundCorner = skinParam.getRoundCorner(); - this.name = TextBlockUtils.withMargin(TextBlockUtils.create( - entity.getDisplay(), - new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), - FontParam.OBJECT, stereotype), SkinParamUtils.getFontColor(getSkinParam(), FontParam.OBJECT, - stereotype), getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam), 2, 2); + this.name = TextBlockUtils.withMargin(TextBlockUtils.create(entity.getDisplay(), + new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), FontParam.OBJECT, stereotype), + SkinParamUtils.getFontColor(getSkinParam(), FontParam.OBJECT, stereotype), getSkinParam() + .getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), + HorizontalAlignment.CENTER, skinParam), 2, 2); if (stereotype == null || stereotype.getLabel(false) == null) { this.stereo = null; } else { - this.stereo = TextBlockUtils.create( - Display.getWithNewlines(stereotype.getLabel(getSkinParam().useGuillemet())), - new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), - FontParam.OBJECT_STEREOTYPE, stereotype), SkinParamUtils.getFontColor(getSkinParam(), - FontParam.OBJECT_STEREOTYPE, stereotype), getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam); + this.stereo = TextBlockUtils + .create(Display.getWithNewlines(stereotype.getLabel(getSkinParam().useGuillemet())), + new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), FontParam.OBJECT_STEREOTYPE, + stereotype), SkinParamUtils.getFontColor(getSkinParam(), + FontParam.OBJECT_STEREOTYPE, stereotype), getSkinParam().getHyperlinkColor(), + getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam); } - if (entity.getFieldsToDisplay().size() == 0) { + if (entity.getBodier().getFieldsToDisplay().size() == 0) { this.fields = new TextBlockLineBefore(new TextBlockEmpty(10, 16)); } else { - // this.fields = - // entity.getFieldsToDisplay().asTextBlock(FontParam.OBJECT_ATTRIBUTE, - // skinParam); - this.fields = entity.getBody(new PortionShower() { - public boolean showPortion(EntityPortion portion, IEntity entity) { - return true; - } - }).asTextBlock(FontParam.OBJECT_ATTRIBUTE, skinParam); - + this.fields = entity.getBodier().getBody(FontParam.OBJECT_ATTRIBUTE, skinParam, false, true); } this.url = entity.getUrl99(); @@ -159,7 +152,7 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil { header.add(stereo); } header.add(name); - header.drawU(ug, 0, 0, dimTotal.getWidth(), dimTitle.getHeight()); + header.drawU(ug, dimTotal.getWidth(), dimTitle.getHeight()); final UGraphic ug2 = new UGraphicStencil(ug, this, stroke); fields.drawU(ug2.apply(new UTranslate(0, dimTitle.getHeight()))); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageState.java b/src/net/sourceforge/plantuml/svek/image/EntityImageState.java index 1438dd850..bd71878fb 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageState.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageState.java @@ -95,7 +95,7 @@ public class EntityImageState extends AbstractEntityImage { stereotype), getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam); Display list = Display.empty(); - for (Member att : entity.getFieldsToDisplay()) { + for (Member att : entity.getBodier().getFieldsToDisplay()) { list = list.addAll(Display.getWithNewlines(att.getDisplay(true))); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java index 407bbce92..a0c32728c 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java @@ -70,7 +70,7 @@ public class EntityImageState2 extends AbstractEntityImage { final Stereotype stereotype = entity.getStereotype(); Display list = Display.empty(); - for (Member att : entity.getFieldsToDisplay()) { + for (Member att : entity.getBodier().getFieldsToDisplay()) { list = list.addAll(Display.getWithNewlines(att.getDisplay(true))); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageStateEmptyDescription.java b/src/net/sourceforge/plantuml/svek/image/EntityImageStateEmptyDescription.java index 40502c43a..ea412da7b 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageStateEmptyDescription.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageStateEmptyDescription.java @@ -80,7 +80,7 @@ public class EntityImageStateEmptyDescription extends AbstractEntityImage { stereotype), getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam); Display list = Display.empty(); - for (Member att : entity.getFieldsToDisplay()) { + for (Member att : entity.getBodier().getFieldsToDisplay()) { list = list.addAll(Display.getWithNewlines(att.getDisplay(true))); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java b/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java index 1a019e184..aafc88e5b 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java @@ -43,7 +43,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.cucadiagram.BlockMember; +import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.cucadiagram.BodyEnhanced2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; @@ -72,15 +72,13 @@ public class EntityImageTips extends AbstractEntityImage { private final HtmlColor borderColor; private final Bibliotekon bibliotekon; - private PortionShower portionShower; private final double ySpacing = 10; - public EntityImageTips(ILeaf entity, ISkinParam skinParam, Bibliotekon bibliotekon, PortionShower portionShower) { + public EntityImageTips(ILeaf entity, ISkinParam skinParam, Bibliotekon bibliotekon) { super(entity, EntityImageNote.getSkin(skinParam, entity)); this.skinParam = skinParam; this.bibliotekon = bibliotekon; - this.portionShower = portionShower; if (entity.getSpecificBackColor() == null) { noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); @@ -90,6 +88,13 @@ public class EntityImageTips extends AbstractEntityImage { this.borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); } + private Position getPosition() { + if (getEntity().getCode().getFullName().endsWith(Position.RIGHT.name())) { + return Position.RIGHT; + } + return Position.LEFT; + } + public ShapeType getShapeType() { return ShapeType.RECTANGLE; } @@ -115,26 +120,33 @@ public class EntityImageTips extends AbstractEntityImage { final StringBounder stringBounder = ug.getStringBounder(); final IEntity other = bibliotekon.getOnlyOther(getEntity()); - final BlockMember otherBlockMember = other.getBody(portionShower); - // .asTextBlock(FontParam.CLASS_ATTRIBUTE, skinParam); final Shape shapeMe = bibliotekon.getShape(getEntity()); final Shape shapeOther = bibliotekon.getShape(other); -// System.err.println("shapeMe=" + shapeMe.getPosition() + " " + shapeMe.getSize()); -// System.err.println("shapeOther=" + shapeOther.getPosition() + " " + shapeOther.getSize()); + final Point2D positionMe = shapeMe.getPosition(); + final Point2D positionOther = shapeOther.getPosition(); bibliotekon.getShape(getEntity()); + final Position position = getPosition(); + double height = 0; for (Map.Entry ent : getEntity().getTips().entrySet()) { final Display display = ent.getValue(); - final Rectangle2D memberPosition = otherBlockMember.getPosition(ent.getKey(), stringBounder, - FontParam.CLASS_ATTRIBUTE, skinParam); -// System.err.println("memberPosition=" + memberPosition); + final Rectangle2D memberPosition = shapeOther.getImage().getInnerPosition(ent.getKey(), stringBounder); final Opale opale = getOpale(display); - final Point2D pp1 = shapeMe.getPoint2D(0, 0); - final Point2D pp2 = shapeOther.getPoint2D(0, 0); - opale.setOpale(Direction.LEFT, pp1, pp2); final Dimension2D dim = opale.calculateDimension(stringBounder); + final Point2D pp1 = new Point2D.Double(0, dim.getHeight() / 2); + double x = positionOther.getX() - positionMe.getX(); + if (position == Position.RIGHT) { + x += memberPosition.getMaxX(); + } else { + x += 4; + } + final double y = positionOther.getY() - positionMe.getY() - height + memberPosition.getCenterY(); + final Point2D pp2 = new Point2D.Double(x, y); + opale.setOpale(position.reverseDirection(), pp1, pp2); opale.drawU(ug); ug = ug.apply(new UTranslate(0, dim.getHeight() + ySpacing)); + height += dim.getHeight(); + height += ySpacing; } } @@ -146,7 +158,7 @@ public class EntityImageTips extends AbstractEntityImage { final TextBlock textBlock = new BodyEnhanced2(display, FontParam.NOTE, skinParam, HorizontalAlignment.LEFT, new FontConfiguration(fontNote, fontColor, skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink())); - final Opale opale = new Opale(borderColor, noteBackgroundColor, textBlock, skinParam.shadowing(), false); + final Opale opale = new Opale(borderColor, noteBackgroundColor, textBlock, skinParam.shadowing(), true); return opale; } diff --git a/src/net/sourceforge/plantuml/svek/image/Opale.java b/src/net/sourceforge/plantuml/svek/image/Opale.java index 4192bb7c7..fbad9463c 100644 --- a/src/net/sourceforge/plantuml/svek/image/Opale.java +++ b/src/net/sourceforge/plantuml/svek/image/Opale.java @@ -38,6 +38,7 @@ import java.awt.geom.Point2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Direction; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -50,7 +51,7 @@ import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.utils.MathUtils; -public class Opale implements TextBlock { +public class Opale extends AbstractTextBlock implements TextBlock { private final int cornersize = 10; private final HtmlColor noteBackgroundColor; diff --git a/src/net/sourceforge/plantuml/ugraphic/SpriteImage.java b/src/net/sourceforge/plantuml/ugraphic/SpriteImage.java index 1bd1eabb9..2160fcb9e 100644 --- a/src/net/sourceforge/plantuml/ugraphic/SpriteImage.java +++ b/src/net/sourceforge/plantuml/ugraphic/SpriteImage.java @@ -37,6 +37,7 @@ import java.awt.geom.Dimension2D; import java.awt.image.BufferedImage; 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; @@ -50,7 +51,7 @@ public class SpriteImage implements Sprite { } public TextBlock asTextBlock(final HtmlColor color) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { ug.draw(img); diff --git a/src/net/sourceforge/plantuml/ugraphic/SpriteMonochrome.java b/src/net/sourceforge/plantuml/ugraphic/SpriteMonochrome.java index 7dd385365..d35d0126c 100644 --- a/src/net/sourceforge/plantuml/ugraphic/SpriteMonochrome.java +++ b/src/net/sourceforge/plantuml/ugraphic/SpriteMonochrome.java @@ -38,6 +38,7 @@ import java.awt.geom.Dimension2D; import java.awt.image.BufferedImage; 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; @@ -103,7 +104,7 @@ public class SpriteMonochrome implements Sprite { } public TextBlock asTextBlock(final HtmlColor color) { - return new TextBlock() { + return new AbstractTextBlock() { public void drawU(UGraphic ug) { ug.draw(toUImage(ug.getColorMapper(), ug.getParam().getBackcolor(), color)); diff --git a/src/net/sourceforge/plantuml/ugraphic/TextBlockInEllipse.java b/src/net/sourceforge/plantuml/ugraphic/TextBlockInEllipse.java index ca5af0ba3..34f13ce03 100644 --- a/src/net/sourceforge/plantuml/ugraphic/TextBlockInEllipse.java +++ b/src/net/sourceforge/plantuml/ugraphic/TextBlockInEllipse.java @@ -36,12 +36,13 @@ package net.sourceforge.plantuml.ugraphic; import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; +import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.svek.image.ContainingEllipse; import net.sourceforge.plantuml.svek.image.Footprint; -public class TextBlockInEllipse implements TextBlock { +public class TextBlockInEllipse extends AbstractTextBlock implements TextBlock { private final TextBlock text; private final ContainingEllipse ellipse; diff --git a/src/net/sourceforge/plantuml/ugraphic/UGraphicCompress.java b/src/net/sourceforge/plantuml/ugraphic/UGraphicCompress.java index 006e3b0c5..9e38e3f74 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UGraphicCompress.java +++ b/src/net/sourceforge/plantuml/ugraphic/UGraphicCompress.java @@ -78,11 +78,20 @@ public class UGraphicCompress extends UGraphicDelegator { } private void drawLine(double x1, double y1, double x2, double y2) { + if (y1 > y2) { + drawLine(x2, y2, x1, y1); + return; + } + assert y1 <= y2; final double xmin = Math.min(x1, x2); final double xmax = Math.max(x1, x2); final double ymin = Math.min(y1, y2); final double ymax = Math.max(y1, y2); - getUg().apply(new UTranslate(xmin, ymin)).draw(new ULine(xmax - xmin, ymax - ymin)); + if (x2 >= x1) { + getUg().apply(new UTranslate(xmin, ymin)).draw(new ULine(xmax - xmin, ymax - ymin)); + } else { + getUg().apply(new UTranslate(xmax, ymin)).draw(new ULine(-(xmax - xmin), ymax - ymin)); + } } } diff --git a/src/net/sourceforge/plantuml/ugraphic/ULayoutGroup.java b/src/net/sourceforge/plantuml/ugraphic/ULayoutGroup.java index 8c95e77f7..eabd91259 100644 --- a/src/net/sourceforge/plantuml/ugraphic/ULayoutGroup.java +++ b/src/net/sourceforge/plantuml/ugraphic/ULayoutGroup.java @@ -34,8 +34,10 @@ package net.sourceforge.plantuml.ugraphic; import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; import java.util.Map; +import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; public class ULayoutGroup { @@ -46,11 +48,11 @@ public class ULayoutGroup { this.placementStrategy = placementStrategy; } - public void drawU(UGraphic ug, double x, double y, double width, double height) { + public void drawU(UGraphic ug, double width, double height) { for (Map.Entry ent : placementStrategy.getPositions(width, height).entrySet()) { final TextBlock block = ent.getKey(); final Point2D pos = ent.getValue(); - block.drawU(ug.apply(new UTranslate((x + pos.getX()), (y + pos.getY())))); + block.drawU(ug.apply(new UTranslate(pos))); } } @@ -59,4 +61,16 @@ public class ULayoutGroup { } + public Rectangle2D getInnerPosition(String member, double width, double height, StringBounder stringBounder) { + for (Map.Entry ent : placementStrategy.getPositions(width, height).entrySet()) { + final TextBlock block = ent.getKey(); + final Rectangle2D result = block.getInnerPosition(member, stringBounder); + if (result != null) { + final UTranslate translate = new UTranslate(ent.getValue()); + return translate.apply(result); + } + } + return null; + } + } diff --git a/src/net/sourceforge/plantuml/ugraphic/UTranslate.java b/src/net/sourceforge/plantuml/ugraphic/UTranslate.java index 6a2b14c47..fdb51c710 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UTranslate.java +++ b/src/net/sourceforge/plantuml/ugraphic/UTranslate.java @@ -34,6 +34,7 @@ package net.sourceforge.plantuml.ugraphic; import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; public class UTranslate implements UChange { @@ -85,4 +86,8 @@ public class UTranslate implements UChange { return new UTranslate(-dx, -dy); } + public Rectangle2D apply(Rectangle2D rect) { + return new Rectangle2D.Double(rect.getX() + dx, rect.getY() + dy, rect.getWidth(), rect.getHeight()); + } + } diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 6569f365c..1672f4c57 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16251 $ + * Revision $Revision: 16320 $ * */ package net.sourceforge.plantuml.version; @@ -39,7 +39,7 @@ import java.util.Date; public class Version { public static int version() { - return 8025; + return 8026; } public static String versionString() { @@ -63,7 +63,7 @@ public class Version { } private static long compileTime() { - return 1433095753149L; + return 1433668749193L; } public static String compileTimeString() { diff --git a/src/net/sourceforge/plantuml/xmi/XmiClassDiagramArgo.java b/src/net/sourceforge/plantuml/xmi/XmiClassDiagramArgo.java index fc47b4276..9d9c009d2 100644 --- a/src/net/sourceforge/plantuml/xmi/XmiClassDiagramArgo.java +++ b/src/net/sourceforge/plantuml/xmi/XmiClassDiagramArgo.java @@ -240,7 +240,7 @@ public class XmiClassDiagramArgo implements IXmiClassDiagram { final Element feature = document.createElement("UML:Classifier.feature"); cla.appendChild(feature); - for (Member m : entity.getFieldsToDisplay()) { + for (Member m : entity.getBodier().getFieldsToDisplay()) { //