mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
version 8026
This commit is contained in:
parent
f35a3a00df
commit
dd45415e20
@ -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;
|
||||
|
||||
|
@ -51,7 +51,7 @@ import net.sourceforge.plantuml.utils.StartUtils;
|
||||
final public class BlockUmlBuilder {
|
||||
|
||||
private final List<BlockUml> blocks = new ArrayList<BlockUml>();
|
||||
private final Set<File> usedFiles = new HashSet<File>();
|
||||
private Set<File> usedFiles = new HashSet<File>();
|
||||
private final UncommentReadLine reader2;
|
||||
|
||||
public BlockUmlBuilder(List<String> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -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<ActivityDiagram3> {
|
||||
public class CommandEnd3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
public CommandStopLegacy1() {
|
||||
public CommandEnd3() {
|
||||
super(getRegexConcat());
|
||||
}
|
||||
|
||||
@ -55,11 +55,7 @@ public class CommandStopLegacy1 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@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();
|
||||
}
|
||||
|
@ -55,11 +55,7 @@ public class CommandStop3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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<Swimlane> getSwimlanes() {
|
||||
return Collections.emptySet();
|
||||
final Set<Swimlane> result = new HashSet<Swimlane>();
|
||||
if (swimlaneIn != null) {
|
||||
result.add(swimlaneIn);
|
||||
}
|
||||
if (swimlaneOut != null) {
|
||||
result.add(swimlaneOut);
|
||||
}
|
||||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -95,4 +95,8 @@ public class UGraphicInterceptorOneSwimlane extends UGraphicDelegator {
|
||||
return new UGraphicInterceptorOneSwimlane(getUg().apply(change), swimlane);
|
||||
}
|
||||
|
||||
public final Swimlane getSwimlane() {
|
||||
return swimlane;
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -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<Swimlane> 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);
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
@ -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());
|
||||
|
||||
|
@ -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<ClassDiagram> {
|
||||
if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field.charAt(0))) {
|
||||
system.setVisibilityModifierPresent(true);
|
||||
}
|
||||
entity.addFieldOrMethod(field);
|
||||
entity.getBodier().addFieldOrMethod(field);
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
if (s.length() > 0 && VisibilityModifier.isVisibilityCharacter(s.charAt(0))) {
|
||||
diagram.setVisibilityModifierPresent(true);
|
||||
}
|
||||
entity.addFieldOrMethod(s);
|
||||
entity.getBodier().addFieldOrMethod(s);
|
||||
}
|
||||
if (url != null) {
|
||||
entity.addUrl(url);
|
||||
|
@ -105,8 +105,8 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
||||
}
|
||||
|
||||
private static String getClassIdentifier() {
|
||||
return "(" + getSeparator() + "?[\\p{L}0-9_]+(?:" + getSeparator()
|
||||
+ "[\\p{L}0-9_]+)*|[%g][^%g]+[%g])[%s]*(\\<\\<.*\\>\\>)?";
|
||||
return "(" + getSeparator() + "?[\\p{L}0-9_$]+(?:" + getSeparator()
|
||||
+ "[\\p{L}0-9_$]+)*|[%g][^%g]+[%g])[%s]*(\\<\\<.*\\>\\>)?";
|
||||
}
|
||||
|
||||
private static String getSeparator() {
|
||||
|
@ -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<ClassDiagram> {
|
||||
|
||||
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<String> 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<String, RegexPartialMatch> 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;
|
||||
// }
|
||||
|
||||
}
|
@ -64,7 +64,8 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket<UmlDiag
|
||||
}
|
||||
}
|
||||
|
||||
private final static Pattern p1 = MyPattern.cmpile("^([\\w.]*(?:\\<\\<.*\\>\\>)?[\\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<UmlDiag
|
||||
@Override
|
||||
protected boolean isLineConsistent(String line, int level) {
|
||||
line = StringUtils.trin(line);
|
||||
if (hasStartingQuote(line)) {
|
||||
return true;
|
||||
}
|
||||
return p1.matcher(line).matches();
|
||||
}
|
||||
|
||||
private boolean hasStartingQuote(String line) {
|
||||
return MyPattern.mtches(line, "[%s]*[%q].*");
|
||||
}
|
||||
|
||||
public CommandExecutionResult execute(UmlDiagram diagram, List<String> 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<UmlDiag
|
||||
|
||||
for (String s : lines) {
|
||||
assert s.length() > 0;
|
||||
if (hasStartingQuote(s)) {
|
||||
continue;
|
||||
}
|
||||
if (s.equals("}")) {
|
||||
context.pop();
|
||||
continue;
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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<Stripe> stripes;
|
||||
@ -129,6 +131,12 @@ public class SheetBlock1 implements TextBlock, Atom, Stencil {
|
||||
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());
|
||||
if (padding > 0) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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<Member> members = new ArrayList<Member>();
|
||||
|
||||
public BlockMemberImpl(List<Member> members) {
|
||||
this.members.addAll(members);
|
||||
}
|
||||
|
||||
public List<Member> 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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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<Url> getUrls() {
|
||||
return Collections.unmodifiableList(urls);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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<Member> getFieldsToDisplay() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
public List<Member> 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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<Member> getFieldsToDisplay();
|
||||
|
||||
public List<Member> 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);
|
||||
|
||||
|
@ -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;
|
||||
@ -157,11 +164,16 @@ public class MethodsOrFieldsArea implements TextBlockWidth, TextBlock {
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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<String> 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<String> 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;
|
||||
|
@ -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<String> mouseOver = new ArrayList<String>();
|
||||
|
||||
// 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<Member> getFieldsToDisplay() {
|
||||
// checkNotGroup();
|
||||
return bodier.getFieldsToDisplay();
|
||||
}
|
||||
|
||||
public List<Member> getMethodsToDisplay() {
|
||||
// checkNotGroup();
|
||||
return bodier.getMethodsToDisplay();
|
||||
}
|
||||
|
||||
public void addFieldOrMethod(String s) {
|
||||
// checkNotGroup();
|
||||
bodier.addFieldOrMethod(s);
|
||||
public Bodier getBodier() {
|
||||
return bodier;
|
||||
}
|
||||
|
||||
public EntityPosition getEntityPosition() {
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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<Tile, ActivityBox> tilesBoxes = new HashMap<Tile, ActivityBox>();
|
||||
private Tile lastTile;
|
||||
|
||||
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public DiagramDescription getDescription() {
|
||||
return new DiagramDescriptionImpl("Flow Diagram", getClass());
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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 TextBlock asTextBlock(FontParam fontParam, ISkinParam skinParam);
|
||||
|
||||
public Rectangle2D getPosition(String member, StringBounder stringBounder, FontParam fontParam, ISkinParam skinParam);
|
||||
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) {
|
||||
throw new UnsupportedOperationException(getClass().toString());
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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<? extends CharSequence> lines;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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<TextBlock> blocs = new ArrayList<TextBlock>();
|
||||
private final HorizontalAlignment horizontalAlignment;
|
||||
|
@ -28,12 +28,13 @@
|
||||
*
|
||||
* 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;
|
||||
|
||||
@ -41,4 +42,7 @@ public interface TextBlock extends UDrawable, UShape {
|
||||
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder);
|
||||
|
||||
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder);
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
@ -81,4 +82,9 @@ public class TextBlockLineBefore implements TextBlock {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) {
|
||||
return textBlock.getInnerPosition(member, stringBounder);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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<Line> lines2;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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<TextBlock> blocks = new ArrayList<TextBlock>();
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -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();
|
||||
|
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -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());
|
||||
|
@ -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();
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
|
@ -134,12 +134,12 @@ public final class CucaDiagramHtmlMaker {
|
||||
}
|
||||
|
||||
pw.println("<hr>");
|
||||
if (entity.getFieldsToDisplay().size() == 0) {
|
||||
if (entity.getBodier().getFieldsToDisplay().size() == 0) {
|
||||
pw.println("<h2>No fields</h2>");
|
||||
} else {
|
||||
pw.println("<h2>Fields:</h2>");
|
||||
pw.println("<ul>");
|
||||
for (Member m : entity.getFieldsToDisplay()) {
|
||||
for (Member m : entity.getBodier().getFieldsToDisplay()) {
|
||||
pw.println("<li>");
|
||||
pw.println(StringUtils.unicodeForHtml(m.getDisplay(true)));
|
||||
pw.println("</li>");
|
||||
@ -148,12 +148,12 @@ public final class CucaDiagramHtmlMaker {
|
||||
}
|
||||
|
||||
pw.println("<hr>");
|
||||
if (entity.getMethodsToDisplay().size() == 0) {
|
||||
if (entity.getBodier().getMethodsToDisplay().size() == 0) {
|
||||
pw.println("<h2>No methods</h2>");
|
||||
} else {
|
||||
pw.println("<h2>Methods:</h2>");
|
||||
pw.println("<ul>");
|
||||
for (Member m : entity.getMethodsToDisplay()) {
|
||||
for (Member m : entity.getBodier().getMethodsToDisplay()) {
|
||||
pw.println("<li>");
|
||||
pw.println(StringUtils.unicodeForHtml(m.getDisplay(true)));
|
||||
pw.println("</li>");
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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<GTile> tiles;
|
||||
private final double space;
|
||||
|
@ -56,7 +56,7 @@ public class CommandAddData extends SingleLineCommand<ObjectDiagram> {
|
||||
if (field.length() > 0 && VisibilityModifier.isVisibilityCharacter(field.charAt(0))) {
|
||||
diagram.setVisibilityModifierPresent(true);
|
||||
}
|
||||
entity.addFieldOrMethod(field);
|
||||
entity.getBodier().addFieldOrMethod(field);
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class CommandCreateEntityObjectMultilines extends CommandMultilines2<Obje
|
||||
if (VisibilityModifier.isVisibilityCharacter(s.charAt(0))) {
|
||||
diagram.setVisibilityModifierPresent(true);
|
||||
}
|
||||
entity.addFieldOrMethod(s);
|
||||
entity.getBodier().addFieldOrMethod(s);
|
||||
}
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
@ -130,7 +131,7 @@ public class OpenIcon {
|
||||
}
|
||||
|
||||
public TextBlock asTextBlock(final HtmlColor color, final double factor) {
|
||||
return new TextBlock() {
|
||||
return new AbstractTextBlock() {
|
||||
public void drawU(UGraphic ug) {
|
||||
svgPath.drawMe(ug.apply(new UChangeColor(color)), factor);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 14321 $
|
||||
* Revision $Revision: 16305 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.preproc;
|
||||
@ -36,14 +36,16 @@ package net.sourceforge.plantuml.preproc;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.command.regex.MyPattern;
|
||||
import net.sourceforge.plantuml.utils.StartUtils;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
|
||||
public class Preprocessor implements ReadLine {
|
||||
|
||||
@ -59,10 +61,10 @@ public class Preprocessor implements ReadLine {
|
||||
private final PreprocessorInclude rawSource;
|
||||
private final ReadLineInsertable source;
|
||||
|
||||
public Preprocessor(ReadLine reader, String charset, Defines defines, Set<File> 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<File> getFilesUsed() {
|
||||
return Collections.unmodifiableSet(rawSource.getFilesUsedGlobal());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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<File> filesUsed;
|
||||
private final Set<File> filesUsedCurrent;
|
||||
private final Set<File> filesUsedGlobal;
|
||||
|
||||
public PreprocessorInclude(ReadLine reader, Defines defines, String charset, Set<File> filesUsed, File newCurrentDir) {
|
||||
public PreprocessorInclude(ReadLine reader, Defines defines, String charset, File newCurrentDir) {
|
||||
this(reader, defines, charset, newCurrentDir, new HashSet<File>(), new HashSet<File>());
|
||||
}
|
||||
|
||||
public Set<File> getFilesUsedGlobal() {
|
||||
return Collections.unmodifiableSet(filesUsedGlobal);
|
||||
}
|
||||
|
||||
private PreprocessorInclude(ReadLine reader, Defines defines, String charset, File newCurrentDir,
|
||||
Set<File> filesUsedCurrent, Set<File> 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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user