mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
version 8028
This commit is contained in:
parent
1c21c4ddaf
commit
e7251d394d
@ -141,7 +141,6 @@ public class AnimatedGifEncoder {
|
||||
*
|
||||
* @param iter
|
||||
* int number of iterations.
|
||||
* @return
|
||||
*/
|
||||
public void setRepeat(int iter) {
|
||||
if (iter >= 0) {
|
||||
@ -263,7 +262,6 @@ public class AnimatedGifEncoder {
|
||||
*
|
||||
* @param quality
|
||||
* int greater than 0.
|
||||
* @return
|
||||
*/
|
||||
public void setQuality(int quality) {
|
||||
if (quality < 1)
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 16158 $
|
||||
* Revision $Revision: 16562 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -53,6 +53,7 @@ public class OptionFlags {
|
||||
static public final boolean USE_HECTOR = false;
|
||||
static public boolean ADD_NICE_FOR_DOT = false;
|
||||
static public final boolean STRICT_SELFMESSAGE_POSITION = true;
|
||||
static public final boolean USE_NEW_IF = true;
|
||||
static public final boolean FORCE_TEOZ = false;
|
||||
static public final boolean USE_INTERFACE_EYE1 = false;
|
||||
static public final boolean USE_INTERFACE_EYE2 = false;
|
||||
|
@ -390,10 +390,6 @@ public class StringUtils {
|
||||
return uid1 + String.format("%04d", uid2);
|
||||
}
|
||||
|
||||
public static boolean isMethod(String s) {
|
||||
return s.contains("(") || s.contains(")");
|
||||
}
|
||||
|
||||
public static <O> List<O> merge(List<O> l1, List<O> l2) {
|
||||
final List<O> result = new ArrayList<O>(l1);
|
||||
result.addAll(l2);
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 16441 $
|
||||
* Revision $Revision: 16549 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -92,10 +92,10 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram {
|
||||
|
||||
private int minwidth = Integer.MAX_VALUE;
|
||||
|
||||
private Display title;
|
||||
private Display header;
|
||||
private Display footer;
|
||||
private Display legend = null;
|
||||
private Display title = Display.NULL;
|
||||
private Display header = Display.NULL;
|
||||
private Display footer = Display.NULL;
|
||||
private Display legend = Display.NULL;
|
||||
private HorizontalAlignment legendAlignment = HorizontalAlignment.CENTER;
|
||||
private VerticalAlignment legendVerticalAlignment = VerticalAlignment.BOTTOM;
|
||||
|
||||
|
@ -65,6 +65,15 @@ public class Url implements EnsureVisible {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLatex(String pendingUrl) {
|
||||
return pendingUrl.startsWith("latex://");
|
||||
}
|
||||
|
||||
public boolean isLatex() {
|
||||
return isLatex(url);
|
||||
}
|
||||
|
||||
|
||||
public final String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
|
||||
private TextBlock addLegend(TextBlock original) {
|
||||
final Display legend = getLegend();
|
||||
if (legend == null) {
|
||||
if (Display.isNull(legend)) {
|
||||
return original;
|
||||
}
|
||||
final TextBlock text = EntityImageLegend.create(legend, getSkinParam());
|
||||
@ -207,10 +207,10 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
|
||||
private TextBlock addTitle(TextBlock original) {
|
||||
final Display title = getTitle();
|
||||
if (title == null) {
|
||||
if (Display.isNull(title)) {
|
||||
return original;
|
||||
}
|
||||
final TextBlock text = TextBlockUtils.create(title, new FontConfiguration(getFont(FontParam.TITLE),
|
||||
final TextBlock text = title.create(new FontConfiguration(getFont(FontParam.TITLE),
|
||||
getFontColor(FontParam.TITLE, null), getSkinParam().getHyperlinkColor(), getSkinParam()
|
||||
.useUnderlineForHyperlink()), HorizontalAlignment.CENTER, getSkinParam());
|
||||
|
||||
@ -220,13 +220,13 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
private TextBlock addHeaderAndFooter(TextBlock original) {
|
||||
final Display footer = getFooter();
|
||||
final Display header = getHeader();
|
||||
if (footer == null && header == null) {
|
||||
if (Display.isNull(footer) && Display.isNull(header)) {
|
||||
return original;
|
||||
}
|
||||
final TextBlock textFooter = footer == null ? null : TextBlockUtils.create(footer, new FontConfiguration(
|
||||
final TextBlock textFooter = Display.isNull(footer) ? null : footer.create(new FontConfiguration(
|
||||
getFont(FontParam.FOOTER), getFontColor(FontParam.FOOTER, null), getSkinParam().getHyperlinkColor(),
|
||||
getSkinParam().useUnderlineForHyperlink()), getFooterAlignment(), getSkinParam());
|
||||
final TextBlock textHeader = header == null ? null : TextBlockUtils.create(header, new FontConfiguration(
|
||||
final TextBlock textHeader = Display.isNull(header) ? null : header.create(new FontConfiguration(
|
||||
getFont(FontParam.HEADER), getFontColor(FontParam.HEADER, null), getSkinParam().getHyperlinkColor(),
|
||||
getSkinParam().useUnderlineForHyperlink()), getHeaderAlignment(), getSkinParam());
|
||||
|
||||
|
@ -44,6 +44,7 @@ import net.sourceforge.plantuml.activitydiagram3.command.CommandArrowLong3;
|
||||
import net.sourceforge.plantuml.activitydiagram3.command.CommandElse3;
|
||||
import net.sourceforge.plantuml.activitydiagram3.command.CommandElseIf2;
|
||||
import net.sourceforge.plantuml.activitydiagram3.command.CommandElseLegacy1;
|
||||
import net.sourceforge.plantuml.activitydiagram3.command.CommandEnd3;
|
||||
import net.sourceforge.plantuml.activitydiagram3.command.CommandEndPartition3;
|
||||
import net.sourceforge.plantuml.activitydiagram3.command.CommandEndif3;
|
||||
import net.sourceforge.plantuml.activitydiagram3.command.CommandFork3;
|
||||
@ -69,7 +70,6 @@ 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.CommandEnd3;
|
||||
import net.sourceforge.plantuml.activitydiagram3.command.CommandSwimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.command.CommandSwimlane2;
|
||||
import net.sourceforge.plantuml.activitydiagram3.command.CommandWhile3;
|
||||
@ -102,7 +102,6 @@ public class ActivityDiagramFactory3 extends UmlDiagramFactory {
|
||||
cmds.add(new CommandDecoratorMultine(new CommandIf2()));
|
||||
cmds.add(new CommandIfLegacy1());
|
||||
cmds.add(new CommandElseIf2());
|
||||
// cmds.add(new CommandDecoratorMultine(new CommandElseIf2()));
|
||||
cmds.add(new CommandElse3());
|
||||
cmds.add(new CommandDecoratorMultine(new CommandElse3()));
|
||||
cmds.add(new CommandElseLegacy1());
|
||||
@ -133,6 +132,7 @@ public class ActivityDiagramFactory3 extends UmlDiagramFactory {
|
||||
|
||||
cmds.add(new CommandLabel());
|
||||
cmds.add(new CommandGoto());
|
||||
cmds.add(new CommandDecoratorMultine(new CommandElseIf2()));
|
||||
|
||||
return cmds;
|
||||
}
|
||||
|
@ -58,6 +58,12 @@ public class Branch {
|
||||
}
|
||||
|
||||
public Branch(Swimlane swimlane, Display labelPositive, Display labelTest, HtmlColor color) {
|
||||
if (labelPositive == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (labelTest == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.list = new InstructionList(swimlane);
|
||||
this.labelTest = labelTest;
|
||||
this.labelPositive = labelPositive;
|
||||
@ -90,7 +96,7 @@ public class Branch {
|
||||
|
||||
public final Display getLabelPositive() {
|
||||
final LinkRendering in = ftile.getInLinkRendering();
|
||||
if (in != null && in.getDisplay() != null) {
|
||||
if (in != null && Display.isNull(in.getDisplay()) == false) {
|
||||
return in.getDisplay();
|
||||
}
|
||||
return labelPositive;
|
||||
|
@ -50,7 +50,7 @@ public class InstructionGroup implements Instruction {
|
||||
private final HtmlColor titleColor;
|
||||
|
||||
private final Display test;
|
||||
private Display headerNote;
|
||||
private Display headerNote = Display.NULL;
|
||||
|
||||
public InstructionGroup(Instruction parent, Display test, HtmlColor backColor, HtmlColor titleColor,
|
||||
Swimlane swimlane) {
|
||||
|
@ -84,7 +84,7 @@ public class InstructionIf implements Instruction {
|
||||
branch.updateFtile(factory);
|
||||
}
|
||||
if (elseBranch == null) {
|
||||
this.elseBranch = new Branch(swimlane, null, null, null);
|
||||
this.elseBranch = new Branch(swimlane, Display.NULL, Display.NULL, null);
|
||||
}
|
||||
elseBranch.updateFtile(factory);
|
||||
Ftile result = factory.createIf(swimlane, thens, elseBranch);
|
||||
@ -103,7 +103,7 @@ public class InstructionIf implements Instruction {
|
||||
return false;
|
||||
}
|
||||
this.current.setInlinkRendering(nextLinkRenderer);
|
||||
this.elseBranch = new Branch(swimlane, whenElse, null, null);
|
||||
this.elseBranch = new Branch(swimlane, whenElse, Display.NULL, null);
|
||||
this.current = elseBranch;
|
||||
return true;
|
||||
}
|
||||
@ -120,7 +120,7 @@ public class InstructionIf implements Instruction {
|
||||
|
||||
public void endif(LinkRendering nextLinkRenderer) {
|
||||
if (elseBranch == null) {
|
||||
this.elseBranch = new Branch(swimlane, null, null, null);
|
||||
this.elseBranch = new Branch(swimlane, Display.NULL, Display.NULL, null);
|
||||
}
|
||||
this.current.setInlinkRendering(nextLinkRenderer);
|
||||
}
|
||||
|
@ -50,9 +50,9 @@ public class InstructionRepeat implements Instruction {
|
||||
private final Swimlane swimlane;
|
||||
private final HtmlColor color;
|
||||
|
||||
private Display test;
|
||||
private Display yes;
|
||||
private Display out;
|
||||
private Display test = Display.NULL;
|
||||
private Display yes = Display.NULL;
|
||||
private Display out = Display.NULL;
|
||||
private LinkRendering endRepeatLinkRendering;
|
||||
private LinkRendering backRepeatLinkRendering;
|
||||
|
||||
@ -76,10 +76,20 @@ public class InstructionRepeat implements Instruction {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setTest(Display test, Display yes, Display out, LinkRendering endRepeatLinkRendering, LinkRendering backRepeatLinkRendering) {
|
||||
public void setTest(Display test, Display yes, Display out, LinkRendering endRepeatLinkRendering,
|
||||
LinkRendering backRepeatLinkRendering) {
|
||||
this.test = test;
|
||||
this.yes = yes;
|
||||
this.out = out;
|
||||
if (test == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (yes == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (out == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.endRepeatLinkRendering = endRepeatLinkRendering;
|
||||
this.backRepeatLinkRendering = backRepeatLinkRendering;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class InstructionWhile implements Instruction {
|
||||
|
||||
private final Display test;
|
||||
private final Display yes;
|
||||
private Display out;
|
||||
private Display out = Display.NULL;
|
||||
private LinkRendering endInlinkRendering;
|
||||
private LinkRendering afterEndwhile;
|
||||
private final Swimlane swimlane;
|
||||
@ -61,6 +61,12 @@ public class InstructionWhile implements Instruction {
|
||||
|
||||
public InstructionWhile(Swimlane swimlane, Instruction parent, Display test, LinkRendering nextLinkRenderer,
|
||||
Display yes, HtmlColor color, ISkinParam skinParam) {
|
||||
if (test == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (yes == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.parent = parent;
|
||||
this.test = test;
|
||||
this.nextLinkRenderer = nextLinkRenderer;
|
||||
@ -102,6 +108,9 @@ public class InstructionWhile implements Instruction {
|
||||
public void endwhile(LinkRendering nextLinkRenderer, Display out) {
|
||||
this.endInlinkRendering = nextLinkRenderer;
|
||||
this.out = out;
|
||||
if (out == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
public void afterEndwhile(LinkRendering linkRenderer) {
|
||||
|
@ -39,7 +39,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
public class LinkRendering {
|
||||
|
||||
private final HtmlColor color;
|
||||
private Display display;
|
||||
private Display display = Display.NULL;
|
||||
|
||||
public LinkRendering(HtmlColor color) {
|
||||
this.color = color;
|
||||
@ -78,7 +78,7 @@ public class LinkRendering {
|
||||
|
||||
public static Display getDisplay(LinkRendering linkRendering) {
|
||||
if (linkRendering == null) {
|
||||
return null;
|
||||
return Display.NULL;
|
||||
}
|
||||
return linkRendering.getDisplay();
|
||||
}
|
||||
|
@ -93,11 +93,11 @@ public class CommandRepeatWhile3Multilines extends CommandMultilines3<ActivityDi
|
||||
testDisplay = testDisplay.add(trailTest);
|
||||
}
|
||||
|
||||
Display yes = null;// Display.getWithNewlines("arg.getLazzy(\"WHEN\", 0)");
|
||||
final Display out = null; // Display.getWithNewlines("arg.getLazzy(\"OUT\", 0)");
|
||||
Display yes = Display.NULL;// Display.getWithNewlines("arg.getLazzy(\"WHEN\", 0)");
|
||||
final Display out = Display.NULL; // Display.getWithNewlines("arg.getLazzy(\"OUT\", 0)");
|
||||
final HtmlColor linkColor = null; // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR",
|
||||
// 0));
|
||||
final Display linkLabel = null; // Display.getWithNewlines("arg.get(\"LABEL\", 0)");
|
||||
final Display linkLabel = Display.NULL; // Display.getWithNewlines("arg.get(\"LABEL\", 0)");
|
||||
final List<Display> splitted = testDisplay.splitMultiline(MyPattern.cmpile("\\)[%s]*(is|equals?)[%s]*\\(",
|
||||
Pattern.CASE_INSENSITIVE));
|
||||
if (splitted.size() == 2) {
|
||||
|
@ -76,7 +76,7 @@ public class EntityImageLegend extends AbstractTextBlock implements TextBlock {
|
||||
final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.LEGEND);
|
||||
final UFont fontNote = skinParam.getFont(FontParam.LEGEND, null, false);
|
||||
|
||||
this.textBlock = TextBlockUtils.create(note, new FontConfiguration(fontNote, fontColor,
|
||||
this.textBlock = note.create(new FontConfiguration(fontNote, fontColor,
|
||||
skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink()), HorizontalAlignment.LEFT, skinParam);
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class FtileFactoryDelegator implements FtileFactory {
|
||||
protected Display getInLinkRenderingDisplay(Ftile tile) {
|
||||
final LinkRendering linkRendering = tile.getInLinkRendering();
|
||||
if (linkRendering == null) {
|
||||
return null;
|
||||
return Display.NULL;
|
||||
}
|
||||
return linkRendering.getDisplay();
|
||||
}
|
||||
|
@ -0,0 +1,87 @@
|
||||
/* ========================================================================
|
||||
* 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: 8475 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
|
||||
public class FtileMargedRight extends AbstractFtile {
|
||||
|
||||
private final Ftile tile;
|
||||
private final double maxX;
|
||||
|
||||
public FtileMargedRight(Ftile tile, double maxX) {
|
||||
super(tile.shadowing());
|
||||
this.tile = tile;
|
||||
this.maxX = maxX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkRendering getInLinkRendering() {
|
||||
return tile.getInLinkRendering();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkRendering getOutLinkRendering() {
|
||||
return tile.getOutLinkRendering();
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
return tile.getSwimlanes();
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneIn() {
|
||||
return tile.getSwimlaneIn();
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneOut() {
|
||||
return tile.getSwimlaneOut();
|
||||
}
|
||||
|
||||
public FtileGeometry calculateDimension(StringBounder stringBounder) {
|
||||
final FtileGeometry orig = tile.calculateDimension(stringBounder);
|
||||
if (orig.getWidth() > maxX) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return new FtileGeometry(maxX, orig.getHeight(), orig.getLeft(), orig.getInY(), orig.getOutY());
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
ug.draw(tile);
|
||||
}
|
||||
|
||||
}
|
@ -60,6 +60,10 @@ public class FtileUtils {
|
||||
return new FtileMargedVertically(ftile, marginTop, marginBottom);
|
||||
}
|
||||
|
||||
public static Ftile addHorizontalMargin(Ftile ftile, double margin) {
|
||||
return new FtileMarged(ftile, margin);
|
||||
}
|
||||
|
||||
private static Ftile neverNull(Ftile ftile) {
|
||||
if (ftile == null) {
|
||||
return new FtileEmpty(false);
|
||||
|
@ -42,6 +42,7 @@ import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.Direction;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.CompressionTransform;
|
||||
@ -50,6 +51,7 @@ import net.sourceforge.plantuml.ugraphic.UChangeColor;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
@ -150,9 +152,12 @@ public class Snake implements UShape {
|
||||
}
|
||||
if (textBlock != null) {
|
||||
final Point2D position = getTextBlockPosition(ug.getStringBounder());
|
||||
// double max = getMaxX(ug.getStringBounder());
|
||||
// ug.apply(new UChangeBackColor(HtmlColorUtils.LIGHT_GRAY)).apply(new UTranslate(0,
|
||||
// position.getY())).draw(new URectangle(max, 10));
|
||||
// final double max = getMaxX(ug.getStringBounder());
|
||||
// ug.apply(new UChangeBackColor(HtmlColorUtils.LIGHT_GRAY))
|
||||
// .apply(new UTranslate(position.getX(), position.getY()))
|
||||
// .draw(new URectangle(textBlock.calculateDimension(ug.getStringBounder())));
|
||||
// ug.apply(new UChangeBackColor(HtmlColorUtils.RED)).apply(new UTranslate(0, position.getY() + 10))
|
||||
// .draw(new URectangle(max, 10));
|
||||
textBlock.drawU(ug.apply(new UTranslate(position)));
|
||||
}
|
||||
}
|
||||
@ -355,7 +360,7 @@ public class Snake implements UShape {
|
||||
if (Arrays.asList(Direction.DOWN, Direction.RIGHT, Direction.DOWN, Direction.LEFT).equals(patternAt)) {
|
||||
final Point2D.Double p1 = points.get(i + 1);
|
||||
final Point2D.Double p4 = points.get(i + 4);
|
||||
if (p4.x < p1.x) {
|
||||
if (p4.x + 4 < p1.x) {
|
||||
final Point2D.Double newPoint = new Point2D.Double(points.get(i + 1).x, points.get(i + 3).y);
|
||||
points.remove(i + 3);
|
||||
points.remove(i + 2);
|
||||
|
@ -122,7 +122,7 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock {
|
||||
if (color != null) {
|
||||
currentSwimlane.setSpecificBackcolor(color);
|
||||
}
|
||||
if (label != null) {
|
||||
if (Display.isNull(label) == false) {
|
||||
currentSwimlane.setDisplay(label);
|
||||
}
|
||||
}
|
||||
@ -250,8 +250,7 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock {
|
||||
}
|
||||
|
||||
if (OptionFlags.SWI2 == false) {
|
||||
final TextBlock swTitle = TextBlockUtils.create(swimlane.getDisplay(), getFontConfiguration(),
|
||||
HorizontalAlignment.LEFT, skinParam);
|
||||
final TextBlock swTitle = swimlane.getDisplay().create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam);
|
||||
final double titleWidth = swTitle.calculateDimension(stringBounder).getWidth();
|
||||
final double posTitle = x2 + (swimlane.getTotalWidth() - titleWidth) / 2;
|
||||
swTitle.drawU(ug.apply(new UTranslate(posTitle, 0)));
|
||||
@ -283,8 +282,7 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock {
|
||||
final MinMax minMax = limitFinder.getMinMax();
|
||||
|
||||
final double drawingWidth = minMax.getWidth() + 2 * separationMargin;
|
||||
final TextBlock swTitle = TextBlockUtils.create(swimlane.getDisplay(), getFontConfiguration(),
|
||||
HorizontalAlignment.LEFT, skinParam);
|
||||
final TextBlock swTitle = swimlane.getDisplay().create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam);
|
||||
final double titleWidth = swTitle.calculateDimension(stringBounder).getWidth();
|
||||
final double totalWidth = Math.max(drawingWidth, titleWidth + 2 * separationMargin);
|
||||
|
||||
@ -299,8 +297,7 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock {
|
||||
private UTranslate getTitleHeightTranslate(final StringBounder stringBounder) {
|
||||
double titlesHeight = 0;
|
||||
for (Swimlane swimlane : swimlanes) {
|
||||
final TextBlock swTitle = TextBlockUtils.create(swimlane.getDisplay(), getFontConfiguration(),
|
||||
HorizontalAlignment.LEFT, skinParam);
|
||||
final TextBlock swTitle = swimlane.getDisplay().create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam);
|
||||
|
||||
titlesHeight = Math.max(titlesHeight, swTitle.calculateDimension(stringBounder).getHeight());
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ import java.awt.geom.Dimension2D;
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.creole.CreoleParser;
|
||||
import net.sourceforge.plantuml.creole.Sheet;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock1;
|
||||
@ -71,7 +72,7 @@ public class FloatingNote extends AbstractTextBlock implements Stencil, TextBloc
|
||||
|
||||
final FontConfiguration fc = new FontConfiguration(fontNote, fontColor, skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink());
|
||||
|
||||
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, false).createSheet(note);
|
||||
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(note);
|
||||
final SheetBlock2 sheetBlock2 = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this, new UStroke(1));
|
||||
this.opale = new Opale(borderColor, noteBackgroundColor, sheetBlock2, skinParam.shadowing(), false);
|
||||
|
||||
|
@ -41,9 +41,9 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMargedVertically;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMargedRight;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
@ -86,14 +86,20 @@ public class FtileFactoryDelegatorAssembly extends FtileFactoryDelegator {
|
||||
final ConnectionVerticalDown connection = new ConnectionVerticalDown(tile1, tile2, p1, p2, color, textBlock);
|
||||
result = FtileUtils.addConnection(result, connection);
|
||||
if (textBlock != null) {
|
||||
final double width = result.calculateDimension(stringBounder).getWidth();
|
||||
final FtileGeometry dim = result.calculateDimension(stringBounder);
|
||||
final double width = dim.getWidth();
|
||||
// System.err.println("width=" + width);
|
||||
// System.err.println("p1=" + p1);
|
||||
// System.err.println("p2=" + p2);
|
||||
final double maxX = connection.getMaxX(stringBounder);
|
||||
// System.err.println("FtileFactoryDelegatorAssembly dim=" + dim);
|
||||
// System.err.println("maxX=" + maxX);
|
||||
final double needed = (maxX - width) * 2;
|
||||
result = new FtileMinWidth(result, needed);
|
||||
// result = new FtileMinWidth(result, needed);
|
||||
if (width < maxX) {
|
||||
result = new FtileMargedRight(result, maxX);
|
||||
}
|
||||
// System.err.println("FtileFactoryDelegatorAssembly result=" + result.calculateDimension(stringBounder));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -102,7 +108,7 @@ public class FtileFactoryDelegatorAssembly extends FtileFactoryDelegator {
|
||||
|
||||
private TextBlock getTextBlock(Display display) {
|
||||
// DUP1433
|
||||
if (display == null) {
|
||||
if (Display.isNull(display)) {
|
||||
return null;
|
||||
}
|
||||
final ISkinParam skinParam = getSkinParam();
|
||||
@ -110,6 +116,6 @@ public class FtileFactoryDelegatorAssembly extends FtileFactoryDelegator {
|
||||
final HtmlColor color = rose.getFontColor(skinParam, FontParam.ACTIVITY_ARROW);
|
||||
final FontConfiguration fontConfiguration = new FontConfiguration(font, color, skinParam.getHyperlinkColor(),
|
||||
skinParam.useUnderlineForHyperlink());
|
||||
return TextBlockUtils.create(display, fontConfiguration, HorizontalAlignment.LEFT, null, true);
|
||||
return display.create(fontConfiguration, HorizontalAlignment.LEFT, null, CreoleMode.SIMPLE_LINE);
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMarged;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
@ -209,7 +210,7 @@ public class FtileFactoryDelegatorCreateSplit extends FtileFactoryDelegator {
|
||||
private TextBlock getTextBlock(LinkRendering linkRendering) {
|
||||
// DUP1433
|
||||
final Display display = LinkRendering.getDisplay(linkRendering);
|
||||
if (display == null) {
|
||||
if (Display.isNull(display)) {
|
||||
return null;
|
||||
}
|
||||
final ISkinParam skinParam = getSkinParam();
|
||||
@ -217,7 +218,7 @@ public class FtileFactoryDelegatorCreateSplit extends FtileFactoryDelegator {
|
||||
final HtmlColor color = rose.getFontColor(skinParam, FontParam.ACTIVITY_ARROW);
|
||||
final FontConfiguration fontConfiguration = new FontConfiguration(font, color, skinParam.getHyperlinkColor(),
|
||||
skinParam.useUnderlineForHyperlink());
|
||||
return TextBlockUtils.create(display, fontConfiguration, HorizontalAlignment.LEFT, null, true);
|
||||
return display.create(fontConfiguration, HorizontalAlignment.LEFT, null, CreoleMode.SIMPLE_LINE);
|
||||
}
|
||||
|
||||
private Ftile simpleSwimlanes(List<Ftile> all) {
|
||||
|
@ -38,11 +38,13 @@ import java.util.List;
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.OptionFlags;
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.ConditionalBuilder;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.svek.ConditionStyle;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
@ -59,7 +61,8 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
|
||||
final ConditionStyle conditionStyle = getSkinParam().getConditionStyle();
|
||||
final UFont fontArrow = getSkinParam().getFont(FontParam.ACTIVITY_ARROW, null, false);
|
||||
final UFont fontTest = getSkinParam().getFont(
|
||||
conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ACTIVITY_ARROW, null, false);
|
||||
conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ACTIVITY_ARROW, null,
|
||||
false);
|
||||
final Branch branch0 = thens.get(0);
|
||||
|
||||
final HtmlColor borderColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityBorder);
|
||||
@ -69,10 +72,16 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
|
||||
|
||||
if (thens.size() > 1) {
|
||||
return FtileIfLong2.create(swimlane, borderColor, backColor, fontArrow, arrowColor, getFactory(),
|
||||
conditionStyle, thens, elseBranch, getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink());
|
||||
conditionStyle, thens, elseBranch, getSkinParam().getHyperlinkColor(), getSkinParam()
|
||||
.useUnderlineForHyperlink());
|
||||
}
|
||||
if (OptionFlags.USE_NEW_IF) {
|
||||
return ConditionalBuilder.create(swimlane, borderColor, backColor, fontArrow, fontTest, arrowColor,
|
||||
getFactory(), conditionStyle, thens.get(0), elseBranch, getSkinParam(), getStringBounder());
|
||||
} else {
|
||||
return FtileIfOrigin.create(swimlane, borderColor, backColor, fontArrow, fontTest, arrowColor,
|
||||
getFactory(), conditionStyle, thens.get(0), elseBranch, getSkinParam(), getStringBounder());
|
||||
}
|
||||
return FtileIf.create(swimlane, borderColor, backColor, fontArrow, fontTest, arrowColor, getFactory(),
|
||||
conditionStyle, thens.get(0), elseBranch, getSkinParam(), getStringBounder());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -87,9 +87,9 @@ public class FtileGroup extends AbstractFtile {
|
||||
if (title == null) {
|
||||
this.name = TextBlockUtils.empty(0, 0);
|
||||
} else {
|
||||
this.name = TextBlockUtils.create(title, fc, HorizontalAlignment.LEFT, skinParam);
|
||||
this.name = title.create(fc, HorizontalAlignment.LEFT, skinParam);
|
||||
}
|
||||
if (displayNote == null) {
|
||||
if (Display.isNull(displayNote)) {
|
||||
this.headerNote = TextBlockUtils.empty(0, 0);
|
||||
} else {
|
||||
this.headerNote = new FloatingNote(displayNote, skinParam);
|
||||
|
@ -57,6 +57,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.creole.CreoleParser;
|
||||
import net.sourceforge.plantuml.creole.Sheet;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock1;
|
||||
@ -127,12 +128,12 @@ class FtileIfAndStop extends AbstractFtile {
|
||||
|
||||
final Ftile stopFtile = ftileFactory.stop(swimlane);
|
||||
|
||||
// final TextBlock tb1 = TextBlockUtils.create(branch1.getLabelPositive(), fcArrow, HorizontalAlignment.LEFT,
|
||||
// final TextBlock tb1 = Display.create(branch1.getLabelPositive(), fcArrow, HorizontalAlignment.LEFT,
|
||||
// ftileFactory);
|
||||
// final TextBlock tb2 = TextBlockUtils.create(branch2.getLabelPositive(), fcArrow, HorizontalAlignment.LEFT,
|
||||
// final TextBlock tb2 = Display.create(branch2.getLabelPositive(), fcArrow, HorizontalAlignment.LEFT,
|
||||
// ftileFactory);
|
||||
|
||||
final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, false).createSheet(labelTest);
|
||||
final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(labelTest);
|
||||
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding());
|
||||
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), new UStroke(1.5));
|
||||
|
||||
|
@ -56,13 +56,13 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside2;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.svek.ConditionStyle;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
@ -149,18 +149,15 @@ class FtileIfLong2 extends AbstractFtile {
|
||||
List<Ftile> diamonds = new ArrayList<Ftile>();
|
||||
final List<Connection> conns = new ArrayList<Connection>();
|
||||
for (Branch branch : thens) {
|
||||
final TextBlock tb1 = TextBlockUtils.create(branch.getLabelPositive(), fc, HorizontalAlignment.LEFT,
|
||||
ftileFactory);
|
||||
final TextBlock tbTest = TextBlockUtils.create(branch.getLabelTest(), fc, HorizontalAlignment.LEFT,
|
||||
ftileFactory);
|
||||
final TextBlock tb1 = branch.getLabelPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory);
|
||||
final TextBlock tbTest = branch.getLabelTest().create(fc, HorizontalAlignment.LEFT, ftileFactory);
|
||||
FtileDiamondInside2 diamond = new FtileDiamondInside2(branch.shadowing(), backColor, borderColor, swimlane,
|
||||
tbTest);
|
||||
diamond = diamond.withNorth(tb1);
|
||||
diamonds.add(diamond);
|
||||
}
|
||||
|
||||
final TextBlock tb2 = TextBlockUtils.create(branch2.getLabelPositive(), fc, HorizontalAlignment.LEFT,
|
||||
ftileFactory);
|
||||
final TextBlock tb2 = branch2.getLabelPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory);
|
||||
final int last = diamonds.size() - 1;
|
||||
diamonds.set(last, ((FtileDiamondInside2) diamonds.get(last)).withEast(tb2));
|
||||
|
||||
|
@ -55,19 +55,19 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.svek.ConditionStyle;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
class FtileIfLong extends AbstractFtile {
|
||||
class FtileIfLongUnused extends AbstractFtile {
|
||||
|
||||
private final double xSeparation = 20;
|
||||
|
||||
@ -77,7 +77,7 @@ class FtileIfLong extends AbstractFtile {
|
||||
|
||||
private final HtmlColor arrowColor;
|
||||
|
||||
private FtileIfLong(List<Ftile> diamonds, List<Ftile> tiles, Ftile tile2, HtmlColor arrowColor) {
|
||||
private FtileIfLongUnused(List<Ftile> diamonds, List<Ftile> tiles, Ftile tile2, HtmlColor arrowColor) {
|
||||
super(tiles.get(0).shadowing() || tile2.shadowing());
|
||||
this.diamonds = diamonds;
|
||||
this.tiles = tiles;
|
||||
@ -125,22 +125,19 @@ class FtileIfLong extends AbstractFtile {
|
||||
final List<Ftile> diamonds = new ArrayList<Ftile>();
|
||||
final List<Connection> conns = new ArrayList<Connection>();
|
||||
for (Branch branch : thens) {
|
||||
final TextBlock tb1 = TextBlockUtils.create(branch.getLabelPositive(), fc, HorizontalAlignment.LEFT,
|
||||
ftileFactory);
|
||||
final TextBlock tbTest = TextBlockUtils.create(branch.getLabelTest(), fc, HorizontalAlignment.LEFT,
|
||||
ftileFactory);
|
||||
final TextBlock tb1 = branch.getLabelPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory);
|
||||
final TextBlock tbTest = branch.getLabelTest().create(fc, HorizontalAlignment.LEFT, ftileFactory);
|
||||
FtileDiamondInside diamond = new FtileDiamondInside(branch.shadowing(), backColor, borderColor, swimlane,
|
||||
tbTest);
|
||||
diamond = diamond.withNorth(tb1);
|
||||
diamonds.add(diamond);
|
||||
}
|
||||
|
||||
final TextBlock tb2 = TextBlockUtils.create(branch2.getLabelPositive(), fc, HorizontalAlignment.LEFT,
|
||||
ftileFactory);
|
||||
final TextBlock tb2 = branch2.getLabelPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory);
|
||||
final int last = diamonds.size() - 1;
|
||||
diamonds.set(last, ((FtileDiamondInside) diamonds.get(last)).withEast(tb2));
|
||||
|
||||
final FtileIfLong result = new FtileIfLong(diamonds, tiles, tile2, arrowColor);
|
||||
final FtileIfLongUnused result = new FtileIfLongUnused(diamonds, tiles, tile2, arrowColor);
|
||||
|
||||
for (int i = 0; i < thens.size(); i++) {
|
||||
final Ftile ftile = tiles.get(i);
|
@ -63,6 +63,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.creole.CreoleParser;
|
||||
import net.sourceforge.plantuml.creole.Sheet;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock1;
|
||||
@ -81,7 +82,7 @@ import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
class FtileIf extends AbstractFtile {
|
||||
class FtileIfOrigin extends AbstractFtile {
|
||||
|
||||
private final Ftile tile1;
|
||||
private final Ftile tile2;
|
||||
@ -90,7 +91,7 @@ class FtileIf extends AbstractFtile {
|
||||
|
||||
private final HtmlColor arrowColor;
|
||||
|
||||
private FtileIf(Ftile diamond1, Ftile tile1, Ftile tile2, Ftile diamond2, HtmlColor arrowColor) {
|
||||
private FtileIfOrigin(Ftile diamond1, Ftile tile1, Ftile tile2, Ftile diamond2, HtmlColor arrowColor) {
|
||||
super(tile1.shadowing() || tile2.shadowing());
|
||||
this.diamond1 = diamond1;
|
||||
this.diamond2 = diamond2;
|
||||
@ -140,12 +141,10 @@ class FtileIf extends AbstractFtile {
|
||||
final FontConfiguration fcTest = new FontConfiguration(fontTest, fontColor, skinParam.getHyperlinkColor(),
|
||||
skinParam.useUnderlineForHyperlink());
|
||||
|
||||
final TextBlock tb1 = TextBlockUtils.create(branch1.getLabelPositive(), fcArrow, HorizontalAlignment.LEFT,
|
||||
ftileFactory, true);
|
||||
final TextBlock tb2 = TextBlockUtils.create(branch2.getLabelPositive(), fcArrow, HorizontalAlignment.LEFT,
|
||||
ftileFactory, true);
|
||||
final TextBlock tb1 = branch1.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, CreoleMode.SIMPLE_LINE);
|
||||
final TextBlock tb2 = branch2.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, CreoleMode.SIMPLE_LINE);
|
||||
|
||||
final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, false).createSheet(labelTest);
|
||||
final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(labelTest);
|
||||
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding());
|
||||
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), new UStroke(1.5));
|
||||
|
||||
@ -164,18 +163,16 @@ class FtileIf extends AbstractFtile {
|
||||
if (tile1.calculateDimension(stringBounder).hasPointOut()
|
||||
&& tile2.calculateDimension(stringBounder).hasPointOut()) {
|
||||
final Display out1 = LinkRendering.getDisplay(branch1.getFtile().getOutLinkRendering());
|
||||
final TextBlock tbout1 = out1 == null ? null : TextBlockUtils.create(out1, fcArrow,
|
||||
HorizontalAlignment.LEFT, ftileFactory, true);
|
||||
final TextBlock tbout1 = out1 == null ? null : out1.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, CreoleMode.SIMPLE_LINE);
|
||||
final Display out2 = LinkRendering.getDisplay(branch2.getFtile().getOutLinkRendering());
|
||||
final TextBlock tbout2 = out2 == null ? null : TextBlockUtils.create(out2, fcArrow,
|
||||
HorizontalAlignment.LEFT, ftileFactory, true);
|
||||
final TextBlock tbout2 = out2 == null ? null : out2.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, CreoleMode.SIMPLE_LINE);
|
||||
diamond2 = new FtileDiamond(tile1.shadowing(), backColor, borderColor, swimlane).withWest(tbout1).withEast(
|
||||
tbout2);
|
||||
} else {
|
||||
diamond2 = new FtileEmpty(tile1.shadowing(), Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2,
|
||||
swimlane, swimlane);
|
||||
}
|
||||
final FtileIf result = new FtileIf(diamond1, tile1, tile2, diamond2, arrowColor);
|
||||
final FtileIfOrigin result = new FtileIfOrigin(diamond1, tile1, tile2, diamond2, arrowColor);
|
||||
|
||||
final List<Connection> conns = new ArrayList<Connection>();
|
||||
conns.add(result.new ConnectionHorizontalThenVertical(tile1, branch1));
|
@ -57,6 +57,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondFoo1;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
@ -104,10 +105,10 @@ class FtileRepeat extends AbstractFtile {
|
||||
|
||||
final FontConfiguration fc = new FontConfiguration(fontTest, HtmlColorUtils.BLACK, hyperlinkColor,
|
||||
useUnderlineForHyperlink);
|
||||
final TextBlock tbTest = (test == null || test.isWhite()) ? TextBlockUtils.empty(0, 0) : TextBlockUtils.create(
|
||||
test, fc, HorizontalAlignment.LEFT, spriteContainer);
|
||||
final TextBlock yesTb = TextBlockUtils.create(yes, fc, HorizontalAlignment.LEFT, spriteContainer);
|
||||
final TextBlock outTb = TextBlockUtils.create(out, fc, HorizontalAlignment.LEFT, spriteContainer);
|
||||
final TextBlock tbTest = (Display.isNull(test) || test.isWhite()) ? TextBlockUtils.empty(0, 0) : test.create(
|
||||
fc, HorizontalAlignment.LEFT, spriteContainer);
|
||||
final TextBlock yesTb = yes.create(fc, HorizontalAlignment.LEFT, spriteContainer);
|
||||
final TextBlock outTb = out.create(fc, HorizontalAlignment.LEFT, spriteContainer);
|
||||
|
||||
final Ftile diamond1 = new FtileDiamond(repeat.shadowing(), backColor, borderColor, swimlane);
|
||||
final FtileRepeat result;
|
||||
@ -128,18 +129,19 @@ class FtileRepeat extends AbstractFtile {
|
||||
|
||||
final List<Connection> conns = new ArrayList<Connection>();
|
||||
final Display in1 = LinkRendering.getDisplay(repeat.getInLinkRendering());
|
||||
final TextBlock tbin1 = in1 == null ? null : TextBlockUtils.create(in1, fc, HorizontalAlignment.LEFT,
|
||||
spriteContainer, true);
|
||||
final TextBlock tbin1 = in1 == null ? null : in1.create(fc, HorizontalAlignment.LEFT, spriteContainer,
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
conns.add(result.new ConnectionIn(LinkRendering.getColor(repeat.getInLinkRendering(), arrowColor), tbin1));
|
||||
|
||||
final Display backLink1 = LinkRendering.getDisplay(backRepeatLinkRendering);
|
||||
final TextBlock tbbackLink1 = backLink1 == null ? null : TextBlockUtils.create(backLink1, fc,
|
||||
HorizontalAlignment.LEFT, spriteContainer, true);
|
||||
final TextBlock tbbackLink1 = backLink1 == null ? null : backLink1.create(fc, HorizontalAlignment.LEFT,
|
||||
spriteContainer, CreoleMode.SIMPLE_LINE);
|
||||
conns.add(result.new ConnectionBack(LinkRendering.getColor(backRepeatLinkRendering, arrowColor), tbbackLink1));
|
||||
|
||||
final Display out1 = LinkRendering.getDisplay(repeat.getOutLinkRendering());
|
||||
final TextBlock tbout1 = out1 == null ? null : TextBlockUtils.create(out1, fc, HorizontalAlignment.LEFT,
|
||||
spriteContainer, true);
|
||||
final TextBlock tbout1 = out1 == null ? null : out1.create(fc, HorizontalAlignment.LEFT, spriteContainer,
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
|
||||
conns.add(result.new ConnectionOut(LinkRendering.getColor(endRepeatLinkColor, arrowColor), tbout1));
|
||||
return FtileUtils.addConnection(result, conns);
|
||||
}
|
||||
@ -198,6 +200,9 @@ class FtileRepeat extends AbstractFtile {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
if (getFtile1().calculateDimension(stringBounder).hasPointOut() == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Snake snake = new Snake(arrowColor, Arrows.asToDown());
|
||||
snake.setLabel(tbout);
|
||||
@ -209,6 +214,9 @@ class FtileRepeat extends AbstractFtile {
|
||||
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
if (getFtile1().calculateDimension(stringBounder).hasPointOut() == false) {
|
||||
return;
|
||||
}
|
||||
final Snake snake = new Snake(arrowColor);
|
||||
snake.setLabel(tbout);
|
||||
final Point2D mp1a = translate1.getTranslated(getP1(stringBounder));
|
||||
|
@ -106,11 +106,11 @@ class FtileWhile extends AbstractFtile {
|
||||
HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) {
|
||||
final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, hyperlinkColor,
|
||||
useUnderlineForHyperlink);
|
||||
final TextBlock tmpb = TextBlockUtils.create(yes, fc, HorizontalAlignment.LEFT, spriteContainer);
|
||||
final TextBlock tmpb = yes.create(fc, HorizontalAlignment.LEFT, spriteContainer);
|
||||
if (test == null) {
|
||||
return tmpb;
|
||||
}
|
||||
return TextBlockUtils.mergeTB(TextBlockUtils.create(test, fc, HorizontalAlignment.LEFT, spriteContainer), tmpb,
|
||||
return TextBlockUtils.mergeTB(test.create(fc, HorizontalAlignment.LEFT, spriteContainer), tmpb,
|
||||
HorizontalAlignment.CENTER);
|
||||
}
|
||||
|
||||
@ -123,9 +123,9 @@ class FtileWhile extends AbstractFtile {
|
||||
useUnderlineForHyperlink);
|
||||
final FontConfiguration fcTest = new FontConfiguration(fontTest, HtmlColorUtils.BLACK, hyperlinkColor,
|
||||
useUnderlineForHyperlink);
|
||||
final TextBlock yesTb = TextBlockUtils.create(yes, fcArrow, HorizontalAlignment.LEFT, ftileFactory);
|
||||
final TextBlock testTb = TextBlockUtils.create(test, fcTest, HorizontalAlignment.LEFT, ftileFactory);
|
||||
final TextBlock out = TextBlockUtils.create(out2, fcArrow, HorizontalAlignment.LEFT, ftileFactory);
|
||||
final TextBlock yesTb = yes.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory);
|
||||
final TextBlock testTb = test.create(fcTest, HorizontalAlignment.LEFT, ftileFactory);
|
||||
final TextBlock out = out2.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory);
|
||||
|
||||
final Ftile diamond1;
|
||||
final TextBlock supplementarySouthText;
|
||||
|
@ -46,6 +46,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.creole.CreoleParser;
|
||||
import net.sourceforge.plantuml.creole.Sheet;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock1;
|
||||
@ -102,7 +103,7 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil {
|
||||
|
||||
final FontConfiguration fc = new FontConfiguration(fontNote, fontColor, skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink());
|
||||
|
||||
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, false).createSheet(note);
|
||||
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(note);
|
||||
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this, new UStroke(1));
|
||||
opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(), withLink);
|
||||
|
||||
|
@ -0,0 +1,200 @@
|
||||
/* ========================================================================
|
||||
* 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: 8475 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
||||
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.creole.CreoleParser;
|
||||
import net.sourceforge.plantuml.creole.Sheet;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock1;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock2;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.svek.ConditionStyle;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
|
||||
public class ConditionalBuilder {
|
||||
|
||||
private final Swimlane swimlane;
|
||||
private final HtmlColor borderColor;
|
||||
private final HtmlColor backColor;
|
||||
private final UFont fontArrow;
|
||||
private final UFont fontTest;
|
||||
private final HtmlColor arrowColor;
|
||||
private final FtileFactory ftileFactory;
|
||||
private final ConditionStyle conditionStyle;
|
||||
private final Branch branch1;
|
||||
private final Branch branch2;
|
||||
private final ISkinParam skinParam;
|
||||
private final StringBounder stringBounder;
|
||||
|
||||
private final Ftile tile1;
|
||||
private final Ftile tile2;
|
||||
|
||||
public ConditionalBuilder(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, UFont fontArrow,
|
||||
UFont fontTest, HtmlColor arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle,
|
||||
Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder) {
|
||||
this.swimlane = swimlane;
|
||||
this.borderColor = borderColor;
|
||||
this.backColor = backColor;
|
||||
this.fontArrow = fontArrow;
|
||||
this.fontTest = fontTest;
|
||||
this.arrowColor = arrowColor;
|
||||
this.ftileFactory = ftileFactory;
|
||||
this.conditionStyle = conditionStyle;
|
||||
this.branch1 = branch1;
|
||||
this.branch2 = branch2;
|
||||
this.skinParam = skinParam;
|
||||
this.stringBounder = stringBounder;
|
||||
|
||||
this.tile1 = new FtileMinWidth(branch1.getFtile(), 30);
|
||||
this.tile2 = new FtileMinWidth(branch2.getFtile(), 30);
|
||||
|
||||
}
|
||||
|
||||
static public Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, UFont fontArrow,
|
||||
UFont fontTest, HtmlColor arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle,
|
||||
Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder) {
|
||||
final ConditionalBuilder builder = new ConditionalBuilder(swimlane, borderColor, backColor, fontArrow,
|
||||
fontTest, arrowColor, ftileFactory, conditionStyle, branch1, branch2, skinParam, stringBounder);
|
||||
return builder.createWithLinks();
|
||||
// return builder.createWithDiamonds();
|
||||
// return builder.createNude();
|
||||
|
||||
}
|
||||
|
||||
private Ftile createNude() {
|
||||
return new FtileIfNude(tile1, tile2, swimlane);
|
||||
|
||||
}
|
||||
|
||||
private Ftile createWithDiamonds() {
|
||||
final Ftile diamond1 = getDiamond1();
|
||||
final Ftile diamond2 = getDiamond2();
|
||||
return new FtileIfWithDiamonds(diamond1, tile1, tile2, diamond2, swimlane, stringBounder);
|
||||
}
|
||||
|
||||
private Ftile createWithLinks() {
|
||||
final Ftile diamond1 = getDiamond1();
|
||||
final Ftile diamond2 = getDiamond2();
|
||||
final Ftile tmp1 = FtileUtils.addHorizontalMargin(tile1, 10);
|
||||
final Ftile tmp2 = FtileUtils.addHorizontalMargin(tile2, 10);
|
||||
return new FtileIfWithLinks(diamond1, tmp1, tmp2, diamond2, swimlane, arrowColor, stringBounder).addLinks(
|
||||
branch1, branch2, stringBounder);
|
||||
}
|
||||
|
||||
private Ftile getDiamond1() {
|
||||
final Display labelTest = branch1.getLabelTest();
|
||||
|
||||
final FontConfiguration fcArrow = fcArrow();
|
||||
|
||||
final TextBlock tb1 = branch1.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory,
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
final TextBlock tb2 = branch2.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory,
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
|
||||
final FontConfiguration fcTest = new FontConfiguration(fontTest, fontColor(), skinParam.getHyperlinkColor(),
|
||||
skinParam.useUnderlineForHyperlink());
|
||||
final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
|
||||
.createSheet(labelTest);
|
||||
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding());
|
||||
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), new UStroke(1.5));
|
||||
|
||||
final Ftile diamond1;
|
||||
if (conditionStyle == ConditionStyle.INSIDE) {
|
||||
diamond1 = new FtileDiamondInside(tile1.shadowing(), backColor, borderColor, swimlane, tbTest)
|
||||
.withWest(tb1).withEast(tb2);
|
||||
} else if (conditionStyle == ConditionStyle.DIAMOND) {
|
||||
diamond1 = new FtileDiamond(tile1.shadowing(), backColor, borderColor, swimlane).withWest(tb1)
|
||||
.withEast(tb2).withNorth(tbTest);
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
return diamond1;
|
||||
}
|
||||
|
||||
private Ftile getDiamond2() {
|
||||
final FontConfiguration fcArrow = fcArrow();
|
||||
|
||||
final Ftile diamond2;
|
||||
if (hasTwoBranches()) {
|
||||
final Display out1 = LinkRendering.getDisplay(branch1.getFtile().getOutLinkRendering());
|
||||
final TextBlock tbout1 = out1 == null ? null : out1.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory,
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
final Display out2 = LinkRendering.getDisplay(branch2.getFtile().getOutLinkRendering());
|
||||
final TextBlock tbout2 = out2 == null ? null : out2.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory,
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
diamond2 = new FtileDiamond(tile1.shadowing(), backColor, borderColor, swimlane).withWest(tbout1).withEast(
|
||||
tbout2);
|
||||
} else {
|
||||
// diamond2 = new FtileEmpty(tile1.shadowing(), Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2,
|
||||
// swimlane, swimlane);
|
||||
diamond2 = new FtileEmpty(tile1.shadowing(), 0, Diamond.diamondHalfSize / 2, swimlane, swimlane);
|
||||
}
|
||||
return diamond2;
|
||||
}
|
||||
|
||||
public boolean hasTwoBranches() {
|
||||
return tile1.calculateDimension(stringBounder).hasPointOut()
|
||||
&& tile2.calculateDimension(stringBounder).hasPointOut();
|
||||
}
|
||||
|
||||
private FontConfiguration fcArrow() {
|
||||
return new FontConfiguration(fontArrow, fontColor(), skinParam.getHyperlinkColor(),
|
||||
skinParam.useUnderlineForHyperlink());
|
||||
}
|
||||
|
||||
private HtmlColor fontColor() {
|
||||
return skinParam.getFontHtmlColor(FontParam.ACTIVITY_DIAMOND, null);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/* ========================================================================
|
||||
* 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: 8475 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
|
||||
public abstract class FtileDimensionMemoize extends AbstractFtile {
|
||||
|
||||
public FtileDimensionMemoize(boolean shadowing) {
|
||||
super(shadowing);
|
||||
}
|
||||
|
||||
private Dimension2D calculateDimensionInternal;
|
||||
|
||||
protected final Dimension2D calculateDimensionInternal(StringBounder stringBounder) {
|
||||
if (calculateDimensionInternal == null) {
|
||||
calculateDimensionInternal = calculateDimensionInternalSlow(stringBounder);
|
||||
}
|
||||
return calculateDimensionInternal;
|
||||
}
|
||||
|
||||
abstract protected Dimension2D calculateDimensionInternalSlow(StringBounder stringBounder);
|
||||
}
|
@ -0,0 +1,155 @@
|
||||
/* ========================================================================
|
||||
* 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: 8475 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
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.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class FtileIfNude extends FtileDimensionMemoize {
|
||||
|
||||
protected final Ftile tile1;
|
||||
protected final Ftile tile2;
|
||||
private final Swimlane in;
|
||||
|
||||
FtileIfNude(Ftile tile1, Ftile tile2, Swimlane in) {
|
||||
super(tile1.shadowing() || tile2.shadowing());
|
||||
this.tile1 = tile1;
|
||||
this.tile2 = tile2;
|
||||
this.in = in;
|
||||
}
|
||||
|
||||
public boolean hasTwoBranches(StringBounder stringBounder) {
|
||||
return tile1.calculateDimension(stringBounder).hasPointOut()
|
||||
&& tile2.calculateDimension(stringBounder).hasPointOut();
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
final Set<Swimlane> result = new HashSet<Swimlane>();
|
||||
if (getSwimlaneIn() != null) {
|
||||
result.add(getSwimlaneIn());
|
||||
}
|
||||
result.addAll(tile1.getSwimlanes());
|
||||
result.addAll(tile2.getSwimlanes());
|
||||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneIn() {
|
||||
return in;
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneOut() {
|
||||
return getSwimlaneIn();
|
||||
}
|
||||
|
||||
protected UTranslate getTranslate1(StringBounder stringBounder) {
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final Dimension2D dim1 = tile1.calculateDimension(stringBounder);
|
||||
|
||||
final double x1 = 0;
|
||||
final double y1 = 0;
|
||||
return new UTranslate(x1, y1);
|
||||
}
|
||||
|
||||
protected UTranslate getTranslate2(StringBounder stringBounder) {
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final Dimension2D dim2 = tile2.calculateDimension(stringBounder);
|
||||
|
||||
final double x2 = dimTotal.getWidth() - dim2.getWidth();
|
||||
final double y2 = 0;
|
||||
return new UTranslate(x2, y2);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
|
||||
if (child == tile1) {
|
||||
return getTranslate1(stringBounder);
|
||||
}
|
||||
if (child == tile2) {
|
||||
return getTranslate2(stringBounder);
|
||||
}
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
ug.apply(getTranslate1(stringBounder)).draw(tile1);
|
||||
ug.apply(getTranslate2(stringBounder)).draw(tile2);
|
||||
}
|
||||
|
||||
public FtileGeometry calculateDimension(StringBounder stringBounder) {
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
if (tile1.calculateDimension(stringBounder).hasPointOut()
|
||||
|| tile2.calculateDimension(stringBounder).hasPointOut()) {
|
||||
return new FtileGeometry(dimTotal, getLeft(stringBounder), 0, dimTotal.getHeight());
|
||||
}
|
||||
return new FtileGeometry(dimTotal, getLeft(stringBounder), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dimension2D calculateDimensionInternalSlow(StringBounder stringBounder) {
|
||||
final FtileGeometry dim1 = tile1.calculateDimension(stringBounder);
|
||||
final FtileGeometry dim2 = tile2.calculateDimension(stringBounder);
|
||||
|
||||
final double width = dim1.getLeft() + withInner(stringBounder) + (dim2.getWidth() - dim2.getLeft());
|
||||
|
||||
final Dimension2D dim12 = Dimension2DDouble.mergeLR(dim1, dim2);
|
||||
|
||||
return new Dimension2DDouble(width, dim12.getHeight());
|
||||
}
|
||||
|
||||
protected double withInner(StringBounder stringBounder) {
|
||||
final FtileGeometry dim1 = tile1.calculateDimension(stringBounder);
|
||||
final FtileGeometry dim2 = tile2.calculateDimension(stringBounder);
|
||||
return (dim1.getWidth() - dim1.getLeft()) + dim2.getLeft();
|
||||
}
|
||||
|
||||
protected double getLeft(StringBounder stringBounder) {
|
||||
final double left1 = tile1.calculateDimension(stringBounder).translate(getTranslate1(stringBounder)).getLeft();
|
||||
final double left2 = tile2.calculateDimension(stringBounder).translate(getTranslate2(stringBounder)).getLeft();
|
||||
return (left1 + left2) / 2;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
/* ========================================================================
|
||||
* 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: 8475 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
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.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.utils.MathUtils;
|
||||
|
||||
public class FtileIfWithDiamonds extends FtileIfNude {
|
||||
|
||||
private final double SUPP_WITH = 20;
|
||||
protected final Ftile diamond1;
|
||||
protected final Ftile diamond2;
|
||||
|
||||
public FtileIfWithDiamonds(Ftile diamond1, Ftile tile1, Ftile tile2, Ftile diamond2, Swimlane in,
|
||||
StringBounder stringBounder) {
|
||||
super(tile1, tile2, in);
|
||||
this.diamond1 = diamond1;
|
||||
this.diamond2 = diamond2;
|
||||
}
|
||||
|
||||
public int getYdelta1a(StringBounder stringBounder) {
|
||||
// if (getSwimlanes().size() > 1 && hasTwoBranches(stringBounder)) {
|
||||
if (getSwimlanes().size() > 1) {
|
||||
return 20;
|
||||
}
|
||||
return 10;
|
||||
// return hasTwoBranches(stringBounder) ? 6 : 6;
|
||||
}
|
||||
|
||||
public int getYdelta1b(StringBounder stringBounder) {
|
||||
// if (getSwimlanes().size() > 1 && hasTwoBranches(stringBounder)) {
|
||||
if (getSwimlanes().size() > 1) {
|
||||
return 10;
|
||||
}
|
||||
return hasTwoBranches(stringBounder) ? 6 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double withInner(StringBounder stringBounder) {
|
||||
final FtileGeometry dim1 = diamond1.calculateDimension(stringBounder);
|
||||
return Math.max(super.withInner(stringBounder), dim1.getWidth() + SUPP_WITH);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dimension2D calculateDimensionInternalSlow(StringBounder stringBounder) {
|
||||
final FtileGeometry dim1 = diamond1.calculateDimension(stringBounder);
|
||||
final FtileGeometry dim2 = diamond2.calculateDimension(stringBounder);
|
||||
|
||||
final Dimension2D dimNude = super.calculateDimensionInternalSlow(stringBounder);
|
||||
|
||||
final double width = MathUtils.max(dim1.getWidth(), dim2.getWidth(), dimNude.getWidth());
|
||||
final double height = dimNude.getHeight() + dim1.getHeight() + dim2.getHeight() + getYdelta1a(stringBounder)
|
||||
+ getYdelta1b(stringBounder);
|
||||
return new Dimension2DDouble(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1);
|
||||
super.drawU(ug);
|
||||
ug.apply(getTranslateDiamond2(stringBounder)).draw(diamond2);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UTranslate getTranslate1(StringBounder stringBounder) {
|
||||
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
return super.getTranslate1(stringBounder).compose(
|
||||
new UTranslate(0, dimDiamond1.getHeight() + getYdelta1a(stringBounder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UTranslate getTranslate2(StringBounder stringBounder) {
|
||||
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
return super.getTranslate2(stringBounder).compose(
|
||||
new UTranslate(0, dimDiamond1.getHeight() + getYdelta1a(stringBounder)));
|
||||
}
|
||||
|
||||
protected UTranslate getTranslateDiamond1(StringBounder stringBounder) {
|
||||
final double y1 = 0;
|
||||
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final double x1 = getLeft(stringBounder) - dimDiamond1.getWidth() / 2;
|
||||
return new UTranslate(x1, y1);
|
||||
}
|
||||
|
||||
protected UTranslate getTranslateDiamond2(StringBounder stringBounder) {
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||
final double y2 = dimTotal.getHeight() - dimDiamond2.getHeight();
|
||||
final double x2 = getLeft(stringBounder) - dimDiamond2.getWidth() / 2;
|
||||
return new UTranslate(x2, y2);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,381 @@
|
||||
/* ========================================================================
|
||||
* 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: 8475 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.Direction;
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class FtileIfWithLinks extends FtileIfWithDiamonds {
|
||||
|
||||
private final HtmlColor arrowColor;
|
||||
|
||||
public FtileIfWithLinks(Ftile diamond1, Ftile tile1, Ftile tile2, Ftile diamond2, Swimlane in,
|
||||
HtmlColor arrowColor, StringBounder stringBounder) {
|
||||
super(diamond1, tile1, tile2, diamond2, in, stringBounder);
|
||||
this.arrowColor = arrowColor;
|
||||
}
|
||||
|
||||
private HtmlColor getInColor(Branch branch) {
|
||||
if (branch.isEmpty()) {
|
||||
return LinkRendering.getColor(branch.getFtile().getOutLinkRendering(), arrowColor);
|
||||
}
|
||||
final LinkRendering linkIn = branch.getFtile().getInLinkRendering();
|
||||
final HtmlColor color = linkIn == null ? arrowColor : linkIn.getColor();
|
||||
return color;
|
||||
|
||||
}
|
||||
|
||||
class ConnectionHorizontalThenVertical extends AbstractConnection implements ConnectionTranslatable {
|
||||
|
||||
private final HtmlColor color;
|
||||
private final UPolygon usingArrow;
|
||||
|
||||
public ConnectionHorizontalThenVertical(Ftile tile, Branch branch) {
|
||||
super(diamond1, tile);
|
||||
color = getInColor(branch);
|
||||
usingArrow = branch.isEmpty() ? null : Arrows.asToDown();
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Point2D p1 = getP1(stringBounder);
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
final double x1 = p1.getX();
|
||||
final double y1 = p1.getY();
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = new Snake(color, usingArrow);
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x2, y1);
|
||||
snake.addPoint(x2, y2);
|
||||
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
private Point2D getP1(StringBounder stringBounder) {
|
||||
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final double diamondWidth = dimDiamond1.getWidth();
|
||||
final double x;
|
||||
if (getFtile2() == tile1) {
|
||||
x = 0;
|
||||
} else if (getFtile2() == tile2) {
|
||||
x = diamondWidth;
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return getTranslateDiamond1(stringBounder)
|
||||
.getTranslated(new Point2D.Double(x, dimDiamond1.getHeight() / 2));
|
||||
}
|
||||
|
||||
private Point2D getP2(final StringBounder stringBounder) {
|
||||
return translate(stringBounder).getTranslated(getFtile2().calculateDimension(stringBounder).getPointIn());
|
||||
}
|
||||
|
||||
private UTranslate translate(StringBounder stringBounder) {
|
||||
if (getFtile2() == tile1) {
|
||||
return getTranslate1(stringBounder);
|
||||
}
|
||||
if (getFtile2() == tile2) {
|
||||
return getTranslate2(stringBounder);
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
Point2D p1 = getP1(stringBounder);
|
||||
Point2D p2 = getP2(stringBounder);
|
||||
final Direction originalDirection = Direction.leftOrRight(p1, p2);
|
||||
p1 = translate1.getTranslated(p1);
|
||||
p2 = translate2.getTranslated(p2);
|
||||
final Direction newDirection = Direction.leftOrRight(p1, p2);
|
||||
if (originalDirection != newDirection) {
|
||||
final double delta = (originalDirection == Direction.RIGHT ? -1 : 1) * Diamond.diamondHalfSize;
|
||||
final Dimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
|
||||
final Snake small = new Snake(color);
|
||||
small.addPoint(p1);
|
||||
small.addPoint(p1.getX() + delta, p1.getY());
|
||||
small.addPoint(p1.getX() + delta, p1.getY() + dimDiamond1.getHeight() * .75);
|
||||
ug.draw(small);
|
||||
p1 = small.getLast();
|
||||
}
|
||||
final Snake snake = new Snake(color, usingArrow);
|
||||
snake.addPoint(p1);
|
||||
snake.addPoint(p2.getX(), p1.getY());
|
||||
snake.addPoint(p2);
|
||||
ug.draw(snake);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ConnectionVerticalThenHorizontal extends AbstractConnection implements ConnectionTranslatable {
|
||||
private final HtmlColor myArrowColor;
|
||||
private final boolean branchEmpty;
|
||||
|
||||
public ConnectionVerticalThenHorizontal(Ftile tile, HtmlColor myArrowColor, boolean branchEmpty) {
|
||||
super(tile, diamond2);
|
||||
this.myArrowColor = myArrowColor == null ? arrowColor : myArrowColor;
|
||||
this.branchEmpty = branchEmpty;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
|
||||
if (geo.hasPointOut() == false) {
|
||||
return;
|
||||
}
|
||||
final Point2D p1 = geo.translate(translate(stringBounder)).getPointOut();
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
|
||||
final double x1 = p1.getX();
|
||||
final double y1 = p1.getY();
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final UPolygon arrow = x2 > x1 ? Arrows.asToRight() : Arrows.asToLeft();
|
||||
final Snake snake = new Snake(myArrowColor, arrow);
|
||||
if (branchEmpty) {
|
||||
snake.emphasizeDirection(Direction.DOWN);
|
||||
}
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x1, y2);
|
||||
snake.addPoint(x2, y2);
|
||||
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
private Point2D getP2(StringBounder stringBounder) {
|
||||
final Dimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
|
||||
final double diamondWidth = dimDiamond2.getWidth();
|
||||
final double x;
|
||||
if (getFtile1() == tile1) {
|
||||
x = 0;
|
||||
} else if (getFtile1() == tile2) {
|
||||
x = diamondWidth;
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return getTranslateDiamond2(stringBounder)
|
||||
.getTranslated(new Point2D.Double(x, dimDiamond2.getHeight() / 2));
|
||||
}
|
||||
|
||||
private UTranslate translate(StringBounder stringBounder) {
|
||||
if (getFtile1() == tile1) {
|
||||
return getTranslate1(stringBounder);
|
||||
}
|
||||
if (getFtile1() == tile2) {
|
||||
return getTranslate2(stringBounder);
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
|
||||
if (geo.hasPointOut() == false) {
|
||||
return;
|
||||
}
|
||||
final Point2D p2 = getP2(stringBounder);
|
||||
final Point2D p1 = geo.translate(translate(stringBounder)).getPointOut();
|
||||
final Direction originalDirection = Direction.leftOrRight(p1, p2);
|
||||
|
||||
final double x1 = p1.getX();
|
||||
final double x2 = p2.getX();
|
||||
final Point2D mp1a = translate1.getTranslated(p1);
|
||||
final Point2D mp2b = translate2.getTranslated(p2);
|
||||
final Direction newDirection = Direction.leftOrRight(mp1a, mp2b);
|
||||
final UPolygon arrow = x2 > x1 ? Arrows.asToRight() : Arrows.asToLeft();
|
||||
if (originalDirection == newDirection) {
|
||||
final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Diamond.diamondHalfSize;
|
||||
final Point2D mp2bc = new Point2D.Double(mp2b.getX() + delta, mp2b.getY());
|
||||
final Snake snake = new Snake(myArrowColor);
|
||||
final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;
|
||||
snake.addPoint(mp1a);
|
||||
snake.addPoint(mp1a.getX(), middle);
|
||||
snake.addPoint(mp2bc.getX(), middle);
|
||||
snake.addPoint(mp2bc);
|
||||
ug.draw(snake);
|
||||
final Snake small = new Snake(myArrowColor, arrow);
|
||||
small.addPoint(mp2bc);
|
||||
small.addPoint(mp2bc.getX(), mp2b.getY());
|
||||
small.addPoint(mp2b);
|
||||
ug.draw(small);
|
||||
} else {
|
||||
final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Diamond.diamondHalfSize;
|
||||
final Point2D mp2bb = new Point2D.Double(mp2b.getX() + delta, mp2b.getY() - 1.5
|
||||
* Diamond.diamondHalfSize);
|
||||
final Snake snake = new Snake(myArrowColor);
|
||||
snake.addPoint(mp1a);
|
||||
snake.addPoint(mp1a.getX(), mp2bb.getY());
|
||||
snake.addPoint(mp2bb);
|
||||
ug.draw(snake);
|
||||
final Snake small = new Snake(myArrowColor, arrow);
|
||||
small.addPoint(mp2bb);
|
||||
small.addPoint(mp2bb.getX(), mp2b.getY());
|
||||
small.addPoint(mp2b);
|
||||
ug.draw(small);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class ConnectionVerticalThenHorizontalDirect extends AbstractConnection implements ConnectionTranslatable {
|
||||
private final HtmlColor myArrowColor;
|
||||
private final boolean branchEmpty;
|
||||
|
||||
public ConnectionVerticalThenHorizontalDirect(Ftile tile, HtmlColor myArrowColor, boolean branchEmpty) {
|
||||
super(tile, diamond2);
|
||||
this.myArrowColor = myArrowColor == null ? arrowColor : myArrowColor;
|
||||
this.branchEmpty = branchEmpty;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
|
||||
final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
|
||||
if (geo.hasPointOut() == false) {
|
||||
return;
|
||||
}
|
||||
final Point2D p1 = geo.translate(translate(stringBounder)).getPointOut();
|
||||
final Point2D p2 = new Point2D.Double(getLeft(stringBounder), dimTotal.getHeight());
|
||||
|
||||
final double x1 = p1.getX();
|
||||
final double y1 = p1.getY();
|
||||
final double x2 = p2.getX();
|
||||
final double y2 = p2.getY();
|
||||
|
||||
final Snake snake = new Snake(myArrowColor);
|
||||
if (branchEmpty) {
|
||||
snake.emphasizeDirection(Direction.DOWN);
|
||||
}
|
||||
snake.addPoint(x1, y1);
|
||||
snake.addPoint(x1, y2);
|
||||
snake.addPoint(x2, y2);
|
||||
snake.addPoint(x2, dimTotal.getHeight());
|
||||
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
|
||||
final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
|
||||
if (geo.hasPointOut() == false) {
|
||||
return;
|
||||
}
|
||||
final Point2D p1 = geo.translate(translate(stringBounder)).getPointOut();
|
||||
final Point2D p2 = new Point2D.Double(getLeft(stringBounder), dimTotal.getHeight()
|
||||
- Diamond.diamondHalfSize);
|
||||
|
||||
final Point2D mp1a = translate1.getTranslated(p1);
|
||||
final Point2D mp2b = translate2.getTranslated(p2);
|
||||
|
||||
final Snake snake = new Snake(myArrowColor);
|
||||
// snake.emphasizeDirection(Direction.DOWN);
|
||||
|
||||
final double x1 = mp1a.getX();
|
||||
final double x2 = mp2b.getX();
|
||||
final double y2 = mp2b.getY();
|
||||
|
||||
snake.addPoint(mp1a);
|
||||
snake.addPoint(x1, y2);
|
||||
snake.addPoint(mp2b);
|
||||
snake.addPoint(x2, dimTotal.getHeight());
|
||||
|
||||
ug.draw(snake);
|
||||
}
|
||||
|
||||
|
||||
private UTranslate translate(StringBounder stringBounder) {
|
||||
if (getFtile1() == tile1) {
|
||||
return getTranslate1(stringBounder);
|
||||
}
|
||||
if (getFtile1() == tile2) {
|
||||
return getTranslate2(stringBounder);
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Ftile addLinks(Branch branch1, Branch branch2, StringBounder stringBounder) {
|
||||
final List<Connection> conns = new ArrayList<Connection>();
|
||||
conns.add(new ConnectionHorizontalThenVertical(tile1, branch1));
|
||||
conns.add(new ConnectionHorizontalThenVertical(tile2, branch2));
|
||||
if (tile1.calculateDimension(stringBounder).hasPointOut()
|
||||
&& tile2.calculateDimension(stringBounder).hasPointOut()) {
|
||||
conns.add(new ConnectionVerticalThenHorizontal(tile1, branch1.getInlinkRenderingColor(), branch1.isEmpty()));
|
||||
conns.add(new ConnectionVerticalThenHorizontal(tile2, branch2.getInlinkRenderingColor(), branch2.isEmpty()));
|
||||
} else if (tile1.calculateDimension(stringBounder).hasPointOut()
|
||||
&& tile2.calculateDimension(stringBounder).hasPointOut() == false) {
|
||||
conns.add(new ConnectionVerticalThenHorizontalDirect(tile1, branch1.getInlinkRenderingColor(), branch1
|
||||
.isEmpty()));
|
||||
} else if (tile1.calculateDimension(stringBounder).hasPointOut() == false
|
||||
&& tile2.calculateDimension(stringBounder).hasPointOut()) {
|
||||
conns.add(new ConnectionVerticalThenHorizontalDirect(tile2, branch2.getInlinkRenderingColor(), branch2
|
||||
.isEmpty()));
|
||||
}
|
||||
|
||||
return FtileUtils.addConnection(this, conns);
|
||||
}
|
||||
|
||||
}
|
@ -47,6 +47,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.creole.CreoleParser;
|
||||
import net.sourceforge.plantuml.creole.Sheet;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock1;
|
||||
@ -122,7 +123,7 @@ public class FtileBox extends AbstractFtile {
|
||||
final FontConfiguration fc = new FontConfiguration(font, fontColor, skinParam.getHyperlinkColor(),
|
||||
skinParam.useUnderlineForHyperlink());
|
||||
|
||||
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, false).createSheet(label);
|
||||
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(label);
|
||||
this.tb = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), new MyStencil(), new UStroke(1));
|
||||
this.print = label.toString();
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 16021 $
|
||||
* Revision $Revision: 16530 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.classdiagram;
|
||||
@ -39,6 +39,7 @@ import java.io.OutputStream;
|
||||
import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.EntityUtils;
|
||||
@ -138,9 +139,10 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
|
||||
group = getOrCreateNamespaceInternal(namespace2, Display.getWithNewlines(namespace), GroupType.PACKAGE,
|
||||
getRootGroup());
|
||||
}
|
||||
return createLeafInternal(fullyCode,
|
||||
display == null ? Display.getWithNewlines(fullyCode.getShortName(getLeafs())) : display, type, group,
|
||||
symbol);
|
||||
return createLeafInternal(
|
||||
fullyCode,
|
||||
Display.isNull(display) ? Display.getWithNewlines(fullyCode.getShortName(getLeafs())).withCreoleMode(
|
||||
CreoleMode.SIMPLE_LINE) : display, type, group, symbol);
|
||||
}
|
||||
|
||||
private final String getNamespace(Code fullyCode) {
|
||||
|
@ -73,13 +73,13 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||
"(interface|enum|annotation|abstract[%s]+class|abstract|class)[%s]+"), //
|
||||
new RegexOr(//
|
||||
new RegexConcat(//
|
||||
new RegexLeaf("DISPLAY1", "[%g]([^%g]+)[%g]"), //
|
||||
new RegexLeaf("DISPLAY1", "[%g](.+)[%g]"), //
|
||||
new RegexLeaf("[%s]+as[%s]+"), //
|
||||
new RegexLeaf("CODE1", "(" + CODE + ")")), //
|
||||
new RegexConcat(//
|
||||
new RegexLeaf("CODE2", "(" + CODE + ")"), //
|
||||
new RegexLeaf("[%s]+as[%s]+"), // //
|
||||
new RegexLeaf("DISPLAY2", "[%g]([^%g]+)[%g]")), //
|
||||
new RegexLeaf("DISPLAY2", "[%g](.+)[%g]")), //
|
||||
new RegexLeaf("CODE3", "(" + CODE + ")"), //
|
||||
new RegexLeaf("CODE4", "[%g]([^%g]+)[%g]")), //
|
||||
new RegexLeaf("GENERIC", "(?:[%s]*\\<(" + GenericRegexProducer.PATTERN + ")\\>)?"), //
|
||||
|
@ -84,13 +84,13 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
new RegexLeaf("TYPE", "(interface|enum|abstract[%s]+class|abstract|class)[%s]+"), //
|
||||
new RegexOr(//
|
||||
new RegexConcat(//
|
||||
new RegexLeaf("DISPLAY1", "[%g]([^%g]+)[%g]"), //
|
||||
new RegexLeaf("DISPLAY1", "[%g](.+)[%g]"), //
|
||||
new RegexLeaf("[%s]+as[%s]+"), //
|
||||
new RegexLeaf("CODE1", "(" + CommandCreateClass.CODE + ")")), //
|
||||
new RegexConcat(//
|
||||
new RegexLeaf("CODE2", "(" + CommandCreateClass.CODE + ")"), //
|
||||
new RegexLeaf("[%s]+as[%s]+"), // //
|
||||
new RegexLeaf("DISPLAY2", "[%g]([^%g]+)[%g]")), //
|
||||
new RegexLeaf("DISPLAY2", "[%g](.+)[%g]")), //
|
||||
new RegexLeaf("CODE3", "(" + CommandCreateClass.CODE + ")"), //
|
||||
new RegexLeaf("CODE4", "[%g]([^%g]+)[%g]")), //
|
||||
new RegexLeaf("GENERIC", "(?:[%s]*\\<(" + GenericRegexProducer.PATTERN + ")\\>)?"), //
|
||||
@ -159,7 +159,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
if (type2 == LeafType.INTERFACE && entity.getEntityType() != LeafType.INTERFACE) {
|
||||
typeLink = typeLink.getDashed();
|
||||
}
|
||||
final Link link = new Link(cl2, entity, typeLink, null, 2, null, null, system.getLabeldistance(),
|
||||
final Link link = new Link(cl2, entity, typeLink, Display.NULL, 2, null, null, system.getLabeldistance(),
|
||||
system.getLabelangle());
|
||||
system.addLink(link);
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ import net.sourceforge.plantuml.classdiagram.ClassDiagram;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand;
|
||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
|
||||
public class CommandDiamondAssociation extends SingleLineCommand<ClassDiagram> {
|
||||
@ -53,7 +54,7 @@ public class CommandDiamondAssociation extends SingleLineCommand<ClassDiagram> {
|
||||
if (diagram.leafExist(code)) {
|
||||
return CommandExecutionResult.error("Already existing : "+code.getFullName());
|
||||
}
|
||||
diagram.createLeaf(code, null, LeafType.ASSOCIATION, null);
|
||||
diagram.createLeaf(code, Display.NULL, LeafType.ASSOCIATION, null);
|
||||
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 14727 $
|
||||
* Revision $Revision: 16545 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.classdiagram.command;
|
||||
@ -43,6 +43,7 @@ import net.sourceforge.plantuml.classdiagram.ClassDiagram;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand;
|
||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||
@ -96,7 +97,7 @@ public class CommandImport extends SingleLineCommand<ClassDiagram> {
|
||||
|
||||
for (String p : cl.getParents()) {
|
||||
final IEntity ent2 = classDiagram.getOrCreateLeaf(Code.of(p), cl.getParentType(), null);
|
||||
final Link link = new Link(ent2, ent1, new LinkType(LinkDecor.NONE, LinkDecor.EXTENDS), null, 2);
|
||||
final Link link = new Link(ent2, ent1, new LinkType(LinkDecor.NONE, LinkDecor.EXTENDS), Display.NULL, 2);
|
||||
classDiagram.addLink(link);
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ public class ProtectedCommand<S extends Diagram> implements Command<S> {
|
||||
return result;
|
||||
} catch (Throwable t) {
|
||||
Log.error("Error " + t);
|
||||
t.printStackTrace();
|
||||
String msg = "You should send a mail to plantuml@gmail.com with this log (V" + Version.versionString()
|
||||
+ ")";
|
||||
Log.error(msg);
|
||||
|
@ -143,13 +143,13 @@ public final class FactoryNoteActivityCommand implements SingleMultiFactoryComma
|
||||
final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getDashed();
|
||||
|
||||
if (position == Position.RIGHT) {
|
||||
link = new Link(activity, note, type, null, 1);
|
||||
link = new Link(activity, note, type, Display.NULL, 1);
|
||||
} else if (position == Position.LEFT) {
|
||||
link = new Link(note, activity, type, null, 1);
|
||||
link = new Link(note, activity, type, Display.NULL, 1);
|
||||
} else if (position == Position.BOTTOM) {
|
||||
link = new Link(activity, note, type, null, 2);
|
||||
link = new Link(activity, note, type, Display.NULL, 2);
|
||||
} else if (position == Position.TOP) {
|
||||
link = new Link(note, activity, type, null, 2);
|
||||
link = new Link(note, activity, type, Display.NULL, 2);
|
||||
} else {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ 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.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
@ -162,15 +163,15 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma
|
||||
|
||||
final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getDashed();
|
||||
if (position == Position.RIGHT) {
|
||||
link = new Link(cl1, note, type, null, 1);
|
||||
link = new Link(cl1, note, type, Display.NULL, 1);
|
||||
link.setHorizontalSolitary(true);
|
||||
} else if (position == Position.LEFT) {
|
||||
link = new Link(note, cl1, type, null, 1);
|
||||
link = new Link(note, cl1, type, Display.NULL, 1);
|
||||
link.setHorizontalSolitary(true);
|
||||
} else if (position == Position.BOTTOM) {
|
||||
link = new Link(cl1, note, type, null, 2);
|
||||
link = new Link(cl1, note, type, Display.NULL, 2);
|
||||
} else if (position == Position.TOP) {
|
||||
link = new Link(note, cl1, type, null, 2);
|
||||
link = new Link(note, cl1, type, Display.NULL, 2);
|
||||
} else {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
@ -130,9 +131,9 @@ public final class FactoryTipOnEntityCommand implements SingleMultiFactoryComman
|
||||
final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getInvisible();
|
||||
final Link link;
|
||||
if (position == Position.RIGHT) {
|
||||
link = new Link(cl1, (IEntity) tips, type, null, 1);
|
||||
link = new Link(cl1, (IEntity) tips, type, Display.NULL, 1);
|
||||
} else {
|
||||
link = new Link((IEntity) tips, cl1, type, null, 1);
|
||||
link = new Link((IEntity) tips, cl1, type, Display.NULL, 1);
|
||||
}
|
||||
diagram.addLink(link);
|
||||
}
|
||||
|
@ -163,7 +163,11 @@ public class AtomTable implements Atom {
|
||||
private double getColWidth(int col) {
|
||||
double result = 0;
|
||||
for (int i = 0; i < getNbLines(); i++) {
|
||||
final double width = getPosition(i, col).getWidth();
|
||||
final Position position = getPosition(i, col);
|
||||
if (position == null) {
|
||||
continue;
|
||||
}
|
||||
final double width = position.getWidth();
|
||||
result = Math.max(result, width);
|
||||
}
|
||||
return result;
|
||||
@ -172,14 +176,24 @@ public class AtomTable implements Atom {
|
||||
private double getLineHeight(int line) {
|
||||
double result = 0;
|
||||
for (int i = 0; i < getNbCols(); i++) {
|
||||
final double height = getPosition(line, i).getHeight();
|
||||
final Position position = getPosition(line, i);
|
||||
if (position == null) {
|
||||
continue;
|
||||
}
|
||||
final double height = position.getHeight();
|
||||
result = Math.max(result, height);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Position getPosition(int line, int col) {
|
||||
if (line >= lines.size()) {
|
||||
return null;
|
||||
}
|
||||
final Line l = lines.get(line);
|
||||
if (col >= l.cells.size()) {
|
||||
return null;
|
||||
}
|
||||
final Atom atom = l.cells.get(col);
|
||||
return positions.get(atom);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class CreoleHorizontalLine implements Atom {
|
||||
if (line.length() == 0) {
|
||||
return TextBlockUtils.empty(0, 0);
|
||||
}
|
||||
final CreoleParser parser = new CreoleParser(fontConfiguration, HorizontalAlignment.LEFT, skinParam, false);
|
||||
final CreoleParser parser = new CreoleParser(fontConfiguration, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL);
|
||||
final Sheet sheet = parser.createSheet(Display.getWithNewlines(line));
|
||||
final TextBlock tb = new SheetBlock1(sheet, 0, skinParam.getPadding());
|
||||
return tb;
|
||||
|
39
src/net/sourceforge/plantuml/creole/CreoleMode.java
Normal file
39
src/net/sourceforge/plantuml/creole/CreoleMode.java
Normal file
@ -0,0 +1,39 @@
|
||||
/* ========================================================================
|
||||
* 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: 11025 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.creole;
|
||||
|
||||
public enum CreoleMode {
|
||||
FULL, SIMPLE_LINE;
|
||||
|
||||
}
|
@ -48,10 +48,10 @@ public class CreoleParser {
|
||||
private final FontConfiguration fontConfiguration;
|
||||
private final ISkinSimple skinParam;
|
||||
private final HorizontalAlignment horizontalAlignment;
|
||||
private final boolean modeSimpleLine;
|
||||
private final CreoleMode modeSimpleLine;
|
||||
|
||||
public CreoleParser(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
|
||||
ISkinSimple skinParam, boolean modeSimpleLine) {
|
||||
ISkinSimple skinParam, CreoleMode modeSimpleLine) {
|
||||
this.modeSimpleLine = modeSimpleLine;
|
||||
this.fontConfiguration = fontConfiguration;
|
||||
this.skinParam = skinParam;
|
||||
@ -83,7 +83,7 @@ public class CreoleParser {
|
||||
|
||||
public Sheet createSheet(Display display) {
|
||||
final Sheet sheet = new Sheet(horizontalAlignment);
|
||||
if (display != null) {
|
||||
if (Display.isNull(display) == false) {
|
||||
final CreoleContext context = new CreoleContext();
|
||||
for (CharSequence cs : display) {
|
||||
final Stripe stripe;
|
||||
|
@ -46,13 +46,13 @@ public class CreoleStripeSimpleParser {
|
||||
|
||||
final private String line;
|
||||
final private StripeStyle style;
|
||||
private final boolean modeSimpleLine;
|
||||
private final CreoleMode modeSimpleLine;
|
||||
|
||||
private final FontConfiguration fontConfiguration;
|
||||
private final ISkinSimple skinParam;
|
||||
|
||||
public CreoleStripeSimpleParser(String line, CreoleContext creoleContext, FontConfiguration fontConfiguration,
|
||||
ISkinSimple skinParam, boolean modeSimpleLine) {
|
||||
ISkinSimple skinParam, CreoleMode modeSimpleLine) {
|
||||
this.fontConfiguration = fontConfiguration;
|
||||
this.modeSimpleLine = modeSimpleLine;
|
||||
this.skinParam = skinParam;
|
||||
@ -80,15 +80,15 @@ public class CreoleStripeSimpleParser {
|
||||
return;
|
||||
}
|
||||
|
||||
if (modeSimpleLine == false) {
|
||||
final Pattern p6 = MyPattern.cmpile("^__([^_]*)__$");
|
||||
final Matcher m6 = p6.matcher(line);
|
||||
if (m6.find()) {
|
||||
this.line = m6.group(1);
|
||||
this.style = new StripeStyle(StripeStyleType.HORIZONTAL_LINE, 0, '_');
|
||||
return;
|
||||
}
|
||||
}
|
||||
// if (modeSimpleLine == CreoleMode.FULL) {
|
||||
// final Pattern p6 = MyPattern.cmpile("^__([^_]*)__$");
|
||||
// final Matcher m6 = p6.matcher(line);
|
||||
// if (m6.find()) {
|
||||
// this.line = m6.group(1);
|
||||
// this.style = new StripeStyle(StripeStyleType.HORIZONTAL_LINE, 0, '_');
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
final Pattern p7 = MyPattern.cmpile("^\\.\\.([^\\.]*)\\.\\.$");
|
||||
final Matcher m7 = p7.matcher(line);
|
||||
@ -98,7 +98,7 @@ public class CreoleStripeSimpleParser {
|
||||
return;
|
||||
}
|
||||
|
||||
if (modeSimpleLine == false) {
|
||||
if (modeSimpleLine == CreoleMode.FULL) {
|
||||
final Pattern p1 = MyPattern.cmpile("^(\\*+)([^*]+(?:[^*]|\\*\\*[^*]+\\*\\*)*)$");
|
||||
final Matcher m1 = p1.matcher(line);
|
||||
if (m1.find()) {
|
||||
@ -109,7 +109,7 @@ public class CreoleStripeSimpleParser {
|
||||
}
|
||||
}
|
||||
|
||||
if (modeSimpleLine == false) {
|
||||
if (modeSimpleLine == CreoleMode.FULL) {
|
||||
final Pattern p2 = MyPattern.cmpile("^(#+)(.+)$");
|
||||
final Matcher m2 = p2.matcher(CharHidder.hide(line));
|
||||
if (m2.find()) {
|
||||
|
@ -72,7 +72,7 @@ public class PSystemCreole extends AbstractPSystem {
|
||||
final UFont font = new UFont("Serif", Font.PLAIN, 14);
|
||||
final FontConfiguration fontConfiguration = new FontConfiguration(font, HtmlColorUtils.BLACK,
|
||||
HtmlColorUtils.BLUE, true);
|
||||
final Sheet sheet = new CreoleParser(fontConfiguration, HorizontalAlignment.LEFT, null, false)
|
||||
final Sheet sheet = new CreoleParser(fontConfiguration, HorizontalAlignment.LEFT, null, CreoleMode.FULL)
|
||||
.createSheet(display);
|
||||
final SheetBlock1 sheetBlock = new SheetBlock1(sheet, 0, 0);
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class StripeSimple implements Stripe {
|
||||
final private ISkinSimple skinParam;
|
||||
|
||||
public StripeSimple(FontConfiguration fontConfiguration, StripeStyle style, CreoleContext context,
|
||||
ISkinSimple skinParam, boolean modeSimpleLine) {
|
||||
ISkinSimple skinParam, CreoleMode modeSimpleLine) {
|
||||
this.fontConfiguration = fontConfiguration;
|
||||
this.style = style;
|
||||
this.skinParam = skinParam;
|
||||
@ -70,7 +70,7 @@ public class StripeSimple implements Stripe {
|
||||
this.commands.add(CommandCreoleStyle.createCreole(FontStyle.ITALIC));
|
||||
this.commands.add(CommandCreoleStyle.createLegacy(FontStyle.ITALIC));
|
||||
this.commands.add(CommandCreoleStyle.createLegacyEol(FontStyle.ITALIC));
|
||||
if (modeSimpleLine == false) {
|
||||
if (modeSimpleLine == CreoleMode.FULL) {
|
||||
this.commands.add(CommandCreoleStyle.createCreole(FontStyle.UNDERLINE));
|
||||
}
|
||||
this.commands.add(CommandCreoleStyle.createLegacy(FontStyle.UNDERLINE));
|
||||
|
@ -85,7 +85,7 @@ public class StripeTable implements Stripe {
|
||||
final List<StripeSimple> cells = new ArrayList<StripeSimple>();
|
||||
for (String s : lines) {
|
||||
final StripeSimple cell = new StripeSimple(getFontConfiguration(mode), stripeStyle,
|
||||
new CreoleContext(), skinParam, false);
|
||||
new CreoleContext(), skinParam, CreoleMode.FULL);
|
||||
cell.analyzeAndAdd(s);
|
||||
cells.add(cell);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class StripeTree implements Stripe {
|
||||
final List<String> lines = StripeTable.getWithNewlinesInternal(line);
|
||||
for (String s : lines) {
|
||||
final StripeSimple cell = new StripeSimple(fontConfiguration, stripeStyle, new CreoleContext(), skinParam,
|
||||
false);
|
||||
CreoleMode.FULL);
|
||||
// EMTEC
|
||||
final String text = s.replaceFirst("^\\s*\\|_", "");
|
||||
final int level = (s.length() - text.length()) / 2;
|
||||
|
@ -81,7 +81,7 @@ public class Bodier {
|
||||
private boolean isMethod(String s) {
|
||||
if (type == LeafType.ANNOTATION || type == LeafType.ABSTRACT_CLASS || type == LeafType.CLASS
|
||||
|| type == LeafType.INTERFACE || type == LeafType.ENUM) {
|
||||
return StringUtils.isMethod(s);
|
||||
return MemberImpl.isMethod(s);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -158,7 +158,7 @@ public class Bodier {
|
||||
public TextBlock getBody(final FontParam fontParam, final ISkinParam skinParam, final boolean showMethods,
|
||||
final boolean showFields) {
|
||||
if (type.isLikeClass() && isBodyEnhanced()) {
|
||||
if (showMethods && showFields) {
|
||||
if (showMethods || showFields) {
|
||||
return new BodyEnhanced(rawBody, fontParam, skinParam, manageModifier);
|
||||
}
|
||||
return null;
|
||||
|
@ -34,7 +34,6 @@
|
||||
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 +44,7 @@ import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.ISkinSimple;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.creole.CreoleParser;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
@ -145,11 +145,10 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock {
|
||||
}
|
||||
members = new ArrayList<Member>();
|
||||
final List<String> allTree = buildAllTree(s, it);
|
||||
final TextBlock bloc = TextBlockUtils.create(Display.create(allTree),
|
||||
fontParam.getFontConfiguration(skinParam), align, skinParam, false);
|
||||
final TextBlock bloc = Display.create(allTree).create(fontParam.getFontConfiguration(skinParam), align, skinParam, CreoleMode.FULL);
|
||||
blocks.add(bloc);
|
||||
} else {
|
||||
final Member m = new MemberImpl(s, StringUtils.isMethod(s), manageModifier, manageUrl);
|
||||
final Member m = new MemberImpl(s, MemberImpl.isMethod(s), manageModifier, manageUrl);
|
||||
members.add(m);
|
||||
if (m.getUrl() != null) {
|
||||
urls.add(m.getUrl());
|
||||
@ -205,8 +204,7 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock {
|
||||
return null;
|
||||
}
|
||||
s = StringUtils.trin(s.substring(2, s.length() - 2));
|
||||
return TextBlockUtils
|
||||
.create(Display.getWithNewlines(s), titleConfig, HorizontalAlignment.LEFT, spriteContainer);
|
||||
return Display.getWithNewlines(s).create(titleConfig, HorizontalAlignment.LEFT, spriteContainer);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -119,7 +119,7 @@ public class BodyEnhanced2 extends AbstractTextBlock implements TextBlock {
|
||||
}
|
||||
|
||||
private TextBlock getTextBlock(Display members2, StringBounder stringBounder) {
|
||||
final TextBlock result = TextBlockUtils.create(members2, titleConfig, align, spriteContainer);
|
||||
final TextBlock result = members2.create(titleConfig, align, spriteContainer);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -144,8 +144,7 @@ public class BodyEnhanced2 extends AbstractTextBlock implements TextBlock {
|
||||
return null;
|
||||
}
|
||||
s = StringUtils.trin(s.substring(2, s.length() - 2));
|
||||
return TextBlockUtils
|
||||
.create(Display.getWithNewlines(s), titleConfig, HorizontalAlignment.LEFT, spriteContainer);
|
||||
return Display.getWithNewlines(s).create(titleConfig, HorizontalAlignment.LEFT, spriteContainer);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 14667 $
|
||||
* Revision $Revision: 16520 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram;
|
||||
@ -124,7 +124,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
||||
}
|
||||
|
||||
final protected ILeaf createLeafInternal(Code code, Display display, LeafType type, IGroup group, USymbol symbol) {
|
||||
if (display == null) {
|
||||
if (Display.isNull(display)) {
|
||||
display = Display.getWithNewlines(code);
|
||||
}
|
||||
final ILeaf leaf = entityFactory.createLeaf(code, display, type, group, getHides(), getNamespaceSeparator());
|
||||
|
@ -45,24 +45,50 @@ import java.util.regex.Pattern;
|
||||
import net.sourceforge.plantuml.CharSequence2;
|
||||
import net.sourceforge.plantuml.CharSequence2Impl;
|
||||
import net.sourceforge.plantuml.EmbededDiagram;
|
||||
import net.sourceforge.plantuml.ISkinSimple;
|
||||
import net.sourceforge.plantuml.LineLocationImpl;
|
||||
import net.sourceforge.plantuml.SpriteContainer;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.UrlBuilder;
|
||||
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.creole.CreoleParser;
|
||||
import net.sourceforge.plantuml.creole.Sheet;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock1;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock2;
|
||||
import net.sourceforge.plantuml.graphic.CircledCharacter;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockSimple;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockSpotted;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
import net.sourceforge.plantuml.sequencediagram.MessageNumber;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
|
||||
public class Display implements Iterable<CharSequence> {
|
||||
|
||||
private final List<CharSequence> display = new ArrayList<CharSequence>();
|
||||
private final List<CharSequence> display;
|
||||
private final HorizontalAlignment naturalHorizontalAlignment;
|
||||
private final boolean isNull;
|
||||
private final CreoleMode defaultCreoleMode;
|
||||
|
||||
// public void setDefaultCreoleMode(CreoleMode defaultCreoleMode) {
|
||||
// this.defaultCreoleMode = defaultCreoleMode;
|
||||
// }
|
||||
|
||||
public final static Display NULL = new Display(null, null, true, CreoleMode.FULL);
|
||||
|
||||
public boolean isWhite() {
|
||||
return display.size() == 0 || (display.size() == 1 && display.get(0).toString().matches("\\s*"));
|
||||
}
|
||||
|
||||
public static Display empty() {
|
||||
return new Display((HorizontalAlignment) null);
|
||||
return new Display((HorizontalAlignment) null, false, CreoleMode.FULL);
|
||||
}
|
||||
|
||||
public static Display create(CharSequence... s) {
|
||||
@ -70,7 +96,7 @@ public class Display implements Iterable<CharSequence> {
|
||||
}
|
||||
|
||||
public static Display create(Collection<? extends CharSequence> other) {
|
||||
return new Display(other, null);
|
||||
return new Display(other, null, false, CreoleMode.FULL);
|
||||
}
|
||||
|
||||
public static Display getWithNewlines(Code s) {
|
||||
@ -79,7 +105,8 @@ public class Display implements Iterable<CharSequence> {
|
||||
|
||||
public static Display getWithNewlines(String s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
// Thread.dumpStack();
|
||||
return NULL;
|
||||
}
|
||||
final List<String> result = new ArrayList<String>();
|
||||
final StringBuilder current = new StringBuilder();
|
||||
@ -113,22 +140,28 @@ public class Display implements Iterable<CharSequence> {
|
||||
}
|
||||
}
|
||||
result.add(current.toString());
|
||||
return new Display(result, naturalHorizontalAlignment);
|
||||
return new Display(result, naturalHorizontalAlignment, false, CreoleMode.FULL);
|
||||
}
|
||||
|
||||
private Display(Display other) {
|
||||
this(other.naturalHorizontalAlignment);
|
||||
private Display(Display other, CreoleMode mode) {
|
||||
this(other.naturalHorizontalAlignment, other.isNull, mode);
|
||||
this.display.addAll(other.display);
|
||||
}
|
||||
|
||||
private Display(HorizontalAlignment naturalHorizontalAlignment) {
|
||||
this.naturalHorizontalAlignment = naturalHorizontalAlignment;
|
||||
private Display(HorizontalAlignment naturalHorizontalAlignment, boolean isNull, CreoleMode defaultCreoleMode) {
|
||||
this.defaultCreoleMode = defaultCreoleMode;
|
||||
this.isNull = isNull;
|
||||
this.display = isNull ? null : new ArrayList<CharSequence>();
|
||||
this.naturalHorizontalAlignment = isNull ? null : naturalHorizontalAlignment;
|
||||
}
|
||||
|
||||
private Display(Collection<? extends CharSequence> other, HorizontalAlignment naturalHorizontalAlignment) {
|
||||
this(naturalHorizontalAlignment);
|
||||
private Display(Collection<? extends CharSequence> other, HorizontalAlignment naturalHorizontalAlignment,
|
||||
boolean isNull, CreoleMode defaultCreoleMode) {
|
||||
this(naturalHorizontalAlignment, isNull, defaultCreoleMode);
|
||||
if (isNull == false) {
|
||||
this.display.addAll(manageEmbededDiagrams2(other));
|
||||
}
|
||||
}
|
||||
|
||||
private static List<CharSequence> manageEmbededDiagrams2(final Collection<? extends CharSequence> strings) {
|
||||
final List<CharSequence> result = new ArrayList<CharSequence>();
|
||||
@ -158,11 +191,21 @@ public class Display implements Iterable<CharSequence> {
|
||||
for (CharSequence line : display) {
|
||||
result.add("<u>" + line);
|
||||
}
|
||||
return new Display(result, this.naturalHorizontalAlignment);
|
||||
return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode);
|
||||
}
|
||||
|
||||
public Display withCreoleMode(CreoleMode mode) {
|
||||
if (isNull) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
return new Display(this, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (isNull) {
|
||||
return "NULL";
|
||||
}
|
||||
return display.toString();
|
||||
}
|
||||
|
||||
@ -177,24 +220,27 @@ public class Display implements Iterable<CharSequence> {
|
||||
}
|
||||
|
||||
public Display addAll(Display other) {
|
||||
final Display result = new Display(this);
|
||||
final Display result = new Display(this, this.defaultCreoleMode);
|
||||
result.display.addAll(other.display);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Display addFirst(CharSequence s) {
|
||||
final Display result = new Display(this);
|
||||
final Display result = new Display(this, this.defaultCreoleMode);
|
||||
result.display.add(0, s);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Display add(CharSequence s) {
|
||||
final Display result = new Display(this);
|
||||
final Display result = new Display(this, this.defaultCreoleMode);
|
||||
result.display.add(s);
|
||||
return result;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
if (isNull) {
|
||||
return 0;
|
||||
}
|
||||
return display.size();
|
||||
}
|
||||
|
||||
@ -207,7 +253,8 @@ public class Display implements Iterable<CharSequence> {
|
||||
}
|
||||
|
||||
public Display subList(int i, int size) {
|
||||
return new Display(display.subList(i, size), this.naturalHorizontalAlignment);
|
||||
return new Display(display.subList(i, size), this.naturalHorizontalAlignment, this.isNull,
|
||||
this.defaultCreoleMode);
|
||||
}
|
||||
|
||||
public List<? extends CharSequence> as() {
|
||||
@ -236,7 +283,7 @@ public class Display implements Iterable<CharSequence> {
|
||||
if (url == null) {
|
||||
return this;
|
||||
}
|
||||
final Display result = new Display(this.naturalHorizontalAlignment);
|
||||
final Display result = new Display(this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode);
|
||||
result.display.add(UrlBuilder.purgeUrl(this.get(0).toString()));
|
||||
result.display.addAll(this.subList(1, this.size()).display);
|
||||
return result;
|
||||
@ -258,7 +305,7 @@ public class Display implements Iterable<CharSequence> {
|
||||
|
||||
public List<Display> splitMultiline(Pattern separator) {
|
||||
final List<Display> result = new ArrayList<Display>();
|
||||
Display pending = new Display(this.naturalHorizontalAlignment);
|
||||
Display pending = new Display(this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode);
|
||||
result.add(pending);
|
||||
for (CharSequence line : display) {
|
||||
final Matcher m = separator.matcher(line);
|
||||
@ -266,7 +313,7 @@ public class Display implements Iterable<CharSequence> {
|
||||
final CharSequence s1 = line.subSequence(0, m.start());
|
||||
pending.display.add(s1);
|
||||
final CharSequence s2 = line.subSequence(m.end(), line.length());
|
||||
pending = new Display(this.naturalHorizontalAlignment);
|
||||
pending = new Display(this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode);
|
||||
result.add(pending);
|
||||
pending.display.add(s2);
|
||||
} else {
|
||||
@ -276,4 +323,88 @@ public class Display implements Iterable<CharSequence> {
|
||||
return Collections.unmodifiableList(result);
|
||||
}
|
||||
|
||||
// ------
|
||||
|
||||
public static boolean isNull(Display display) {
|
||||
// if (display == null) {
|
||||
// throw new IllegalArgumentException();
|
||||
// }
|
||||
return display == null || display.isNull;
|
||||
}
|
||||
|
||||
public TextBlock create(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
|
||||
ISkinSimple spriteContainer) {
|
||||
return create(fontConfiguration, horizontalAlignment, spriteContainer, CreoleMode.FULL);
|
||||
}
|
||||
|
||||
public TextBlock createWithNiceCreoleMode(FontConfiguration fontConfiguration,
|
||||
HorizontalAlignment horizontalAlignment, ISkinSimple spriteContainer) {
|
||||
return create(fontConfiguration, horizontalAlignment, spriteContainer, defaultCreoleMode);
|
||||
}
|
||||
|
||||
public TextBlock create(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
|
||||
ISkinSimple spriteContainer, CreoleMode modeSimpleLine) {
|
||||
return create(fontConfiguration, horizontalAlignment, spriteContainer, 0, modeSimpleLine, null, null);
|
||||
}
|
||||
|
||||
public TextBlock create(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
|
||||
ISkinSimple spriteContainer, double maxMessageSize, CreoleMode modeSimpleLine, UFont fontForStereotype,
|
||||
HtmlColor htmlColorForStereotype) {
|
||||
if (getNaturalHorizontalAlignment() != null) {
|
||||
horizontalAlignment = getNaturalHorizontalAlignment();
|
||||
}
|
||||
if (size() > 0) {
|
||||
if (get(0) instanceof Stereotype) {
|
||||
return createStereotype(fontConfiguration, horizontalAlignment, spriteContainer, 0, fontForStereotype,
|
||||
htmlColorForStereotype);
|
||||
}
|
||||
if (get(size() - 1) instanceof Stereotype) {
|
||||
return createStereotype(fontConfiguration, horizontalAlignment, spriteContainer, size() - 1,
|
||||
fontForStereotype, htmlColorForStereotype);
|
||||
}
|
||||
if (get(0) instanceof MessageNumber) {
|
||||
return createMessageNumber(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize);
|
||||
}
|
||||
}
|
||||
|
||||
return getCreole(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, modeSimpleLine);
|
||||
}
|
||||
|
||||
private TextBlock getCreole(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
|
||||
ISkinSimple spriteContainer, double maxMessageSize, CreoleMode modeSimpleLine) {
|
||||
final Sheet sheet = new CreoleParser(fontConfiguration, horizontalAlignment, spriteContainer, modeSimpleLine)
|
||||
.createSheet(this);
|
||||
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, maxMessageSize, spriteContainer == null ? 0
|
||||
: spriteContainer.getPadding());
|
||||
return new SheetBlock2(sheetBlock1, sheetBlock1, new UStroke(1.5));
|
||||
}
|
||||
|
||||
private TextBlock createMessageNumber(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
|
||||
ISkinSimple spriteContainer, double maxMessageSize) {
|
||||
TextBlock tb1 = subList(0, 1).getCreole(fontConfiguration, horizontalAlignment, spriteContainer,
|
||||
maxMessageSize, CreoleMode.FULL);
|
||||
tb1 = TextBlockUtils.withMargin(tb1, 0, 4, 0, 0);
|
||||
final TextBlock tb2 = subList(1, size()).getCreole(fontConfiguration, horizontalAlignment, spriteContainer,
|
||||
maxMessageSize, CreoleMode.FULL);
|
||||
return TextBlockUtils.mergeLR(tb1, tb2, VerticalAlignment.CENTER);
|
||||
|
||||
}
|
||||
|
||||
private TextBlock createStereotype(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
|
||||
SpriteContainer spriteContainer, int position, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
|
||||
final Stereotype stereotype = (Stereotype) get(position);
|
||||
if (stereotype.isSpotted()) {
|
||||
final CircledCharacter circledCharacter = new CircledCharacter(stereotype.getCharacter(),
|
||||
stereotype.getRadius(), stereotype.getCircledFont(), stereotype.getHtmlColor(), null,
|
||||
fontConfiguration.getColor());
|
||||
if (stereotype.getLabel(false) == null) {
|
||||
return new TextBlockSpotted(circledCharacter, this.subList(1, this.size()), fontConfiguration,
|
||||
horizontalAlignment, spriteContainer);
|
||||
}
|
||||
return new TextBlockSpotted(circledCharacter, this, fontConfiguration, horizontalAlignment, spriteContainer);
|
||||
}
|
||||
return new TextBlockSimple(this, fontConfiguration, horizontalAlignment, spriteContainer, 0, fontForStereotype,
|
||||
htmlColorForStereotype);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 15543 $
|
||||
* Revision $Revision: 16541 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram;
|
||||
@ -110,8 +110,8 @@ public class Link implements Hideable, Removeable {
|
||||
this.cl1 = cl1;
|
||||
this.cl2 = cl2;
|
||||
this.type = type;
|
||||
if (label == null) {
|
||||
this.label = null;
|
||||
if (Display.isNull(label)) {
|
||||
this.label = Display.NULL;
|
||||
} else if (doWeHaveToRemoveUrlAtStart(label)) {
|
||||
this.url = label.initUrl();
|
||||
this.label = label.removeUrl(url);
|
||||
@ -370,8 +370,9 @@ public class Link implements Hideable, Removeable {
|
||||
private double getQualifierMargin(StringBounder stringBounder, UFont fontQualif, String qualif,
|
||||
ISkinSimple spriteContainer) {
|
||||
if (qualif != null) {
|
||||
final TextBlock b = TextBlockUtils.create(Display.create(qualif), new FontConfiguration(fontQualif,
|
||||
HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.LEFT, spriteContainer);
|
||||
final TextBlock b = Display.create(qualif).create(
|
||||
new FontConfiguration(fontQualif, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true),
|
||||
HorizontalAlignment.LEFT, spriteContainer);
|
||||
final Dimension2D dim = b.calculateDimension(stringBounder);
|
||||
return Math.max(dim.getWidth(), dim.getHeight());
|
||||
}
|
||||
@ -480,7 +481,7 @@ public class Link implements Hideable, Removeable {
|
||||
}
|
||||
|
||||
public boolean hasUrl() {
|
||||
if (label != null && label.hasUrl()) {
|
||||
if (Display.isNull(label) == false && label.hasUrl()) {
|
||||
return true;
|
||||
}
|
||||
return getUrl() != null;
|
||||
|
@ -49,11 +49,11 @@ class Magma {
|
||||
public void putInSquare() {
|
||||
final SquareLinker<ILeaf> linker = new SquareLinker<ILeaf>() {
|
||||
public void topDown(ILeaf top, ILeaf down) {
|
||||
system.addLink(new Link(top, down, linkType, null, 2));
|
||||
system.addLink(new Link(top, down, linkType, Display.NULL, 2));
|
||||
}
|
||||
|
||||
public void leftRight(ILeaf left, ILeaf right) {
|
||||
system.addLink(new Link(left, right, linkType, null, 1));
|
||||
system.addLink(new Link(left, right, linkType, Display.NULL, 1));
|
||||
}
|
||||
};
|
||||
new SquareMaker<ILeaf>().putInSquare(standalones, linker);
|
||||
@ -99,12 +99,12 @@ class Magma {
|
||||
}
|
||||
|
||||
public void linkToDown(Magma down) {
|
||||
system.addLink(new Link(this.getBottomLeft(), down.getTopLeft(), linkType, null, 2));
|
||||
system.addLink(new Link(this.getBottomLeft(), down.getTopLeft(), linkType, Display.NULL, 2));
|
||||
|
||||
}
|
||||
|
||||
public void linkToRight(Magma right) {
|
||||
system.addLink(new Link(this.getTopRight(), right.getTopLeft(), linkType, null, 1));
|
||||
system.addLink(new Link(this.getTopRight(), right.getTopLeft(), linkType, Display.NULL, 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ public class MemberImpl implements Member {
|
||||
private final VisibilityModifier visibilityModifier;
|
||||
|
||||
public MemberImpl(String tmpDisplay, boolean isMethod, boolean manageModifier, boolean manageUrl) {
|
||||
tmpDisplay = tmpDisplay.replaceAll("(?i)\\{(method|field)\\}\\s*", "");
|
||||
if (manageModifier) {
|
||||
this.hasUrl = new UrlBuilder(null, ModeUrl.ANYWHERE).getUrl(tmpDisplay) != null;
|
||||
final Pattern pstart = MyPattern.cmpile("^(" + UrlBuilder.getRegexp() + ")([^\\[\\]]+)$");
|
||||
@ -100,7 +101,8 @@ public class MemberImpl implements Member {
|
||||
}
|
||||
|
||||
if (VisibilityModifier.isVisibilityCharacter(displayClean.charAt(0))) {
|
||||
visibilityModifier = VisibilityModifier.getVisibilityModifier(displayClean.charAt(0), isMethod == false);
|
||||
visibilityModifier = VisibilityModifier
|
||||
.getVisibilityModifier(displayClean.charAt(0), isMethod == false);
|
||||
this.display = StringUtils.trin(StringUtils.manageGuillemet(displayClean.substring(1)));
|
||||
} else {
|
||||
this.display = StringUtils.manageGuillemet(displayClean);
|
||||
@ -122,7 +124,7 @@ public class MemberImpl implements Member {
|
||||
return getDisplayWithoutVisibilityChar();
|
||||
}
|
||||
|
||||
public String getDisplayWithoutVisibilityChar() {
|
||||
private String getDisplayWithoutVisibilityChar() {
|
||||
// assert display.length() == 0 || VisibilityModifier.isVisibilityCharacter(display.charAt(0)) == false;
|
||||
return display;
|
||||
}
|
||||
@ -194,4 +196,14 @@ public class MemberImpl implements Member {
|
||||
return hasUrl;
|
||||
}
|
||||
|
||||
public static boolean isMethod(String s) {
|
||||
if (s.contains("{method}")) {
|
||||
return true;
|
||||
}
|
||||
if (s.contains("{field}")) {
|
||||
return false;
|
||||
}
|
||||
return s.contains("(") || s.contains(")");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
@ -134,7 +135,7 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
|
||||
if (m.isStatic()) {
|
||||
config = config.underline();
|
||||
}
|
||||
TextBlock bloc = TextBlockUtils.create(Display.getWithNewlines(s), config, align, skinParam, true);
|
||||
TextBlock bloc = Display.getWithNewlines(s).create(config, align, skinParam, CreoleMode.SIMPLE_LINE);
|
||||
bloc = TextBlockUtils.fullInnerPosition(bloc, m.getDisplay(false));
|
||||
return new TextBlockTracer(m, bloc);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public class EntityFactory {
|
||||
final LongCode longCode = getLongCode(code, namespaceSeparator);
|
||||
final EntityImpl result = new EntityImpl(this, code, bodier, parentContainer, groupType, namespace2, longCode,
|
||||
namespaceSeparator, rawLayout);
|
||||
if (display != null) {
|
||||
if (Display.isNull(display) == false) {
|
||||
result.setDisplay(display);
|
||||
}
|
||||
return result;
|
||||
|
@ -224,7 +224,7 @@ final class EntityImpl implements ILeaf, IGroup {
|
||||
}
|
||||
|
||||
public boolean hasUrl() {
|
||||
if (display != null && display.hasUrl()) {
|
||||
if (Display.isNull(display) == false && display.hasUrl()) {
|
||||
return true;
|
||||
}
|
||||
if (bodier.hasUrl()) {
|
||||
|
@ -78,10 +78,7 @@ public class DescriptionDiagramFactory extends UmlDiagramFactory {
|
||||
cmds.add(new CommandLinkElement());
|
||||
//
|
||||
cmds.add(new CommandPackageWithUSymbol());
|
||||
cmds.add(new CommandPackage());
|
||||
cmds.add(new CommandEndPackage());
|
||||
// addCommand(new CommandNamespace());
|
||||
// addCommand(new CommandEndNamespace());
|
||||
final FactoryNoteCommand factoryNoteCommand = new FactoryNoteCommand();
|
||||
cmds.add(factoryNoteCommand.createMultiLine());
|
||||
|
||||
@ -99,12 +96,9 @@ public class DescriptionDiagramFactory extends UmlDiagramFactory {
|
||||
|
||||
cmds.add(factoryNoteCommand.createSingleLine());
|
||||
cmds.add(new CommandUrl());
|
||||
// addCommand(new CommandCreateComponent2());
|
||||
cmds.add(new CommandCreateElementFull());
|
||||
cmds.add(new CommandCreateElementMultilines());
|
||||
// addCommand(new CommandCreateElementTyped());
|
||||
// addCommand(new CommandCreateCircleInterface());
|
||||
// addCommand(new CommandCreateActorInComponent());
|
||||
cmds.add(new CommandCreateElementMultilines(0));
|
||||
cmds.add(new CommandCreateElementMultilines(1));
|
||||
|
||||
cmds.add(factoryNoteOnEntityCommand.createMultiLine());
|
||||
cmds.add(factoryNoteCommand.createMultiLine());
|
||||
|
@ -56,22 +56,32 @@ import net.sourceforge.plantuml.graphic.USymbol;
|
||||
|
||||
public class CommandCreateElementMultilines extends CommandMultilines2<DescriptionDiagram> {
|
||||
|
||||
private final int type;
|
||||
|
||||
enum Mode {
|
||||
EXTENDS, IMPLEMENTS
|
||||
};
|
||||
|
||||
public CommandCreateElementMultilines() {
|
||||
super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE);
|
||||
public CommandCreateElementMultilines(int type) {
|
||||
super(getRegexConcat(type), MultilinesStrategy.REMOVE_STARTING_QUOTE);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPatternEnd() {
|
||||
if (type == 0) {
|
||||
return "(?i)^(.*)[%g]$";
|
||||
}
|
||||
if (type == 1) {
|
||||
return "(?i)^(.*)\\]$";
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
private static RegexConcat getRegexConcat() {
|
||||
private static RegexConcat getRegexConcat(int type) {
|
||||
if (type == 0) {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("TYPE", "(usecase|database)[%s]+"), //
|
||||
new RegexLeaf("TYPE", "(usecase|database|artifact)[%s]+"), //
|
||||
new RegexLeaf("CODE", "([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("STEREO", "(\\<\\<.+\\>\\>)?"), //
|
||||
@ -80,6 +90,19 @@ public class CommandCreateElementMultilines extends CommandMultilines2<Descripti
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("DESC", "as[%s]*[%g](.*)$"));
|
||||
}
|
||||
if (type == 1) {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("TYPE", "(package|usecase|database|artifact)[%s]+"), //
|
||||
new RegexLeaf("CODE", "([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("STEREO", "(\\<\\<.+\\>\\>)?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("COLOR", "(" + HtmlColorUtils.COLOR_REGEXP + ")?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("DESC", "\\[(.*)$"));
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
public CommandExecutionResult executeNow(DescriptionDiagram diagram, BlocLines lines) {
|
||||
lines = lines.trim(false);
|
||||
@ -91,16 +114,22 @@ public class CommandCreateElementMultilines extends CommandMultilines2<Descripti
|
||||
if (symbol.equalsIgnoreCase("usecase")) {
|
||||
type = LeafType.USECASE;
|
||||
usymbol = null;
|
||||
} else if (symbol.equalsIgnoreCase("package")) {
|
||||
type = LeafType.DESCRIPTION;
|
||||
usymbol = USymbol.PACKAGE;
|
||||
} else if (symbol.equalsIgnoreCase("database")) {
|
||||
type = LeafType.DESCRIPTION;
|
||||
usymbol = USymbol.DATABASE;
|
||||
} else if (symbol.equalsIgnoreCase("artifact")) {
|
||||
type = LeafType.DESCRIPTION;
|
||||
usymbol = USymbol.ARTIFACT;
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
final Code code = Code.of(line0.get("CODE", 0));
|
||||
final List<String> lineLast = StringUtils.getSplit(MyPattern.cmpile(getPatternEnd()),
|
||||
lines.getLast499().toString());
|
||||
final List<String> lineLast = StringUtils.getSplit(MyPattern.cmpile(getPatternEnd()), lines.getLast499()
|
||||
.toString());
|
||||
lines = lines.subExtract(1, 1);
|
||||
Display display = lines.toDisplay();
|
||||
final String descStart = line0.get("DESC", 0);
|
||||
|
@ -71,11 +71,11 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
|
||||
new RegexLeaf("HEAD2", "(0\\)|<<|[<^*+#0)]|<\\||[%s]+o)?"), //
|
||||
new RegexLeaf("BODY1", "([-=.~]+)"), //
|
||||
new RegexLeaf("ARROW_STYLE1",
|
||||
"(?:\\[((?:#\\w+|dotted|dashed|bold|hidden)(?:,#\\w+|,dotted|,dashed|,bold|,hidden)*)\\])?"),
|
||||
"(?:\\[((?:#\\w+|dotted|dashed|bold|hidden|norank)(?:,#\\w+|,dotted|,dashed|,bold|,hidden|,norank)*)\\])?"),
|
||||
new RegexLeaf("DIRECTION", "(?:(left|right|up|down|le?|ri?|up?|do?)(?=[-=.~0()]))?"), //
|
||||
new RegexLeaf("INSIDE", "(?:(0|\\(0\\)|\\(0|0\\))(?=[-=.~]))?"), //
|
||||
new RegexLeaf("ARROW_STYLE2",
|
||||
"(?:\\[((?:#\\w+|dotted|dashed|bold|hidden)(?:,#\\w+|,dotted|,dashed|,bold|,hidden)*)\\])?"),
|
||||
"(?:\\[((?:#\\w+|dotted|dashed|bold|hidden|norank)(?:,#\\w+|,dotted|,dashed|,bold|,hidden|,norank)*)\\])?"),
|
||||
new RegexLeaf("BODY2", "([-=.~]*)"), //
|
||||
new RegexLeaf("HEAD1", "(\\(0|>>|[>^*+#0(]|\\|>|o[%s]+)?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
|
@ -72,7 +72,7 @@ public class ActivityBox extends AbstractTextBlock {
|
||||
this.label = label;
|
||||
final UFont font = new UFont("Serif", Font.PLAIN, 14);
|
||||
final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true);
|
||||
tb = TextBlockUtils.create(Display.create(label), fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty());
|
||||
tb = Display.create(label).create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty());
|
||||
}
|
||||
|
||||
public Tile getTile() {
|
||||
|
@ -80,8 +80,7 @@ public class Tile extends AbstractTextBlock implements TextBlock {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
ug = ug.apply(new UChangeColor(HtmlColorUtils.BLACK));
|
||||
final TextBlock n = TextBlockUtils.create(Display.create("" + num), fc, HorizontalAlignment.LEFT,
|
||||
new SpriteContainerEmpty());
|
||||
final TextBlock n = Display.create("" + num).create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty());
|
||||
final Dimension2D dimNum = n.calculateDimension(ug.getStringBounder());
|
||||
final Dimension2D dimTotal = calculateDimension(ug.getStringBounder());
|
||||
final double diffx = dimTotal.getWidth() - dimNum.getWidth();
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 14708 $
|
||||
* Revision $Revision: 16528 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -269,9 +269,7 @@ public class Elastane {
|
||||
final String label = l.getLabel().get(0).toString();
|
||||
if (label != null) {
|
||||
// polyline.getFirst().getCenter();
|
||||
final TextBlock textBlock = TextBlockUtils.create(Display.create(label),
|
||||
new FontConfiguration(UFont.getCurrentFont(g2d), HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true),
|
||||
HorizontalAlignment.LEFT, new SpriteContainerEmpty());
|
||||
final TextBlock textBlock = Display.create(label).create(new FontConfiguration(UFont.getCurrentFont(g2d), HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.LEFT, new SpriteContainerEmpty());
|
||||
textBlock.calculateDimension(StringBounderUtils.asStringBounder(g2d));
|
||||
// textBlock.drawTOBEREMOVED(new ColorMapperIdentity(), g2d, center.getXint() - dim.getWidth() / 2,
|
||||
// center.getYint() - dim.getHeight() / 2);
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 14708 $
|
||||
* Revision $Revision: 16528 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -40,6 +40,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.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
@ -47,7 +48,6 @@ import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapper;
|
||||
|
||||
class EntityImageActivity extends AbstractEntityImage {
|
||||
@ -59,7 +59,7 @@ class EntityImageActivity extends AbstractEntityImage {
|
||||
|
||||
public EntityImageActivity(IEntity entity) {
|
||||
super(entity);
|
||||
this.text = TextBlockUtils.create(entity.getDisplay(), new FontConfiguration(getFont14(),
|
||||
this.text = entity.getDisplay().create(new FontConfiguration(getFont14(),
|
||||
HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty());
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 14708 $
|
||||
* Revision $Revision: 16528 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -38,13 +38,13 @@ import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.SpriteContainerEmpty;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.skin.CircleInterface;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapper;
|
||||
|
||||
@ -55,7 +55,7 @@ class EntityImageCircleInterface extends AbstractEntityImage {
|
||||
|
||||
public EntityImageCircleInterface(IEntity entity) {
|
||||
super(entity);
|
||||
this.name = TextBlockUtils.create(entity.getDisplay(), new FontConfiguration(getFont14(),
|
||||
this.name = entity.getDisplay().create(new FontConfiguration(getFont14(),
|
||||
HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty());
|
||||
this.circleInterface = new CircleInterface(getYellow(), getRed());
|
||||
}
|
||||
|
@ -1,96 +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: 14708 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.SpriteContainerEmpty;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapper;
|
||||
|
||||
class EntityImageComponent extends AbstractEntityImage {
|
||||
|
||||
final private TextBlock name;
|
||||
private final float thickness = (float) 1.6;
|
||||
|
||||
public EntityImageComponent(IEntity entity) {
|
||||
super(entity);
|
||||
this.name = TextBlockUtils.create(entity.getDisplay(), new FontConfiguration(getFont14(),
|
||||
HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D getDimension(StringBounder stringBounder) {
|
||||
final Dimension2D nameDim = name.calculateDimension(stringBounder);
|
||||
return Dimension2DDouble.delta(nameDim, 20, 14);
|
||||
}
|
||||
|
||||
private void drawRect(ColorMapper colorMapper, Graphics2D g2d, double x, double y, double width, double height) {
|
||||
g2d.setStroke(new BasicStroke(thickness));
|
||||
final Shape head = new Rectangle2D.Double(x, y, width, height);
|
||||
g2d.setColor(colorMapper.getMappedColor(getYellow()));
|
||||
g2d.fill(head);
|
||||
g2d.setColor(colorMapper.getMappedColor(getRed()));
|
||||
g2d.draw(head);
|
||||
|
||||
g2d.setStroke(new BasicStroke());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(ColorMapper colorMapper, Graphics2D g2d) {
|
||||
final Dimension2D dimTotal = getDimension(StringBounderUtils.asStringBounder(g2d));
|
||||
name.calculateDimension(StringBounderUtils.asStringBounder(g2d));
|
||||
|
||||
drawRect(colorMapper, g2d, 6, 0, dimTotal.getWidth(), dimTotal.getHeight());
|
||||
drawRect(colorMapper, g2d, 0, 7, 12, 6);
|
||||
drawRect(colorMapper, g2d, 0, dimTotal.getHeight() - 7 - 6, 12, 6);
|
||||
|
||||
g2d.setColor(Color.BLACK);
|
||||
// name.drawTOBEREMOVED(colorMapper, g2d, 6 + (dimTotal.getWidth() - nameDim.getWidth()) / 2,
|
||||
// (dimTotal.getHeight() - nameDim.getHeight()) / 2);
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 14708 $
|
||||
* Revision $Revision: 16528 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -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.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
@ -46,7 +47,6 @@ import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapper;
|
||||
|
||||
class EntityImageDefault extends AbstractEntityImage {
|
||||
@ -55,7 +55,7 @@ class EntityImageDefault extends AbstractEntityImage {
|
||||
|
||||
public EntityImageDefault(IEntity entity) {
|
||||
super(entity);
|
||||
this.textBlock = TextBlockUtils.create(entity.getDisplay(), new FontConfiguration(getFont14(), HtmlColorUtils.BLACK,
|
||||
this.textBlock = entity.getDisplay().create(new FontConfiguration(getFont14(), HtmlColorUtils.BLACK,
|
||||
HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty());
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 14708 $
|
||||
* Revision $Revision: 16528 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -40,6 +40,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.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
@ -47,7 +48,6 @@ import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapper;
|
||||
|
||||
class EntityImageNote extends AbstractEntityImage {
|
||||
@ -59,7 +59,7 @@ class EntityImageNote extends AbstractEntityImage {
|
||||
|
||||
public EntityImageNote(IEntity entity) {
|
||||
super(entity);
|
||||
this.text = TextBlockUtils.create(entity.getDisplay(), new FontConfiguration(getFont14(),
|
||||
this.text = entity.getDisplay().create(new FontConfiguration(getFont14(),
|
||||
HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty());
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 14708 $
|
||||
* Revision $Revision: 16528 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -41,6 +41,7 @@ import java.awt.geom.QuadCurve2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.SpriteContainerEmpty;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
@ -48,7 +49,6 @@ import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapper;
|
||||
|
||||
class EntityImageUsecase extends AbstractEntityImage {
|
||||
@ -57,7 +57,7 @@ class EntityImageUsecase extends AbstractEntityImage {
|
||||
|
||||
public EntityImageUsecase(IEntity entity) {
|
||||
super(entity);
|
||||
this.name = TextBlockUtils.create(entity.getDisplay(), new FontConfiguration(getFont14(),
|
||||
this.name = entity.getDisplay().create(new FontConfiguration(getFont14(),
|
||||
HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty());
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 14708 $
|
||||
* Revision $Revision: 16528 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -81,8 +81,7 @@ public class MethodsOrFieldsArea {
|
||||
}
|
||||
|
||||
private TextBlock createTextBlock(String s) {
|
||||
return TextBlockUtils.create(Display.create(s), new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true),
|
||||
HorizontalAlignment.LEFT, new SpriteContainerEmpty());
|
||||
return Display.create(s).create(new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.LEFT, new SpriteContainerEmpty());
|
||||
}
|
||||
|
||||
public void draw(UGraphic ug, double x, double y) {
|
||||
|
@ -96,7 +96,7 @@ public class DateEventUtils {
|
||||
|
||||
private static TextBlock getComment(final List<String> asList, HtmlColor color) {
|
||||
final UFont font = new UFont("SansSerif", Font.BOLD, 14);
|
||||
TextBlock comment = TextBlockUtils.create(Display.create(asList), new FontConfiguration(font, color,
|
||||
TextBlock comment = Display.create(asList).create(new FontConfiguration(font, color,
|
||||
HtmlColorUtils.BLUE, true), HorizontalAlignment.LEFT, new SpriteContainerEmpty());
|
||||
comment = TextBlockUtils.withMargin(comment, 4, 4);
|
||||
comment = new TextBlockBordered(comment, color);
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 16265 $
|
||||
* Revision $Revision: 16528 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
@ -110,14 +110,11 @@ public class GraphicStrings extends AbstractTextBlock implements IEntityImage {
|
||||
private TextBlock getTextBlock() {
|
||||
TextBlock result = null;
|
||||
if (maxLine == 0) {
|
||||
result = TextBlockUtils.create(Display.create(strings), new FontConfiguration(font, green, hyperlinkColor, useUnderlineForHyperlink),
|
||||
HorizontalAlignment.LEFT, new SpriteContainerEmpty());
|
||||
result = Display.create(strings).create(new FontConfiguration(font, green, hyperlinkColor, useUnderlineForHyperlink), HorizontalAlignment.LEFT, new SpriteContainerEmpty());
|
||||
} else {
|
||||
for (int i = 0; i < strings.size(); i += maxLine) {
|
||||
final int n = Math.min(i + maxLine, strings.size());
|
||||
final TextBlock textBlock1 = TextBlockUtils.create(Display.create(strings.subList(i, n)),
|
||||
new FontConfiguration(font, green, hyperlinkColor, useUnderlineForHyperlink), HorizontalAlignment.LEFT,
|
||||
new SpriteContainerEmpty());
|
||||
final TextBlock textBlock1 = Display.create(strings.subList(i, n)).create(new FontConfiguration(font, green, hyperlinkColor, useUnderlineForHyperlink), HorizontalAlignment.LEFT, new SpriteContainerEmpty());
|
||||
if (result == null) {
|
||||
result = textBlock1;
|
||||
} else {
|
||||
|
@ -161,7 +161,8 @@ public class QuoteUtils {
|
||||
"Do me a favour. Disconnect me. I could be reworked, but I'll never be top of the line again.", //
|
||||
"Take it easy, don't push the little button on the joystick!", //
|
||||
"I'm a very private person.", //
|
||||
"To sculpt an elephant from a big block of marble, just knock away all the bits that don't look like an elephant."
|
||||
"To sculpt an elephant from a big block of marble, just knock away all the bits that don't look like an elephant.", //
|
||||
"Who said you could talk to me? Have I got something on my face ?"
|
||||
);
|
||||
private QuoteUtils() {
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 16265 $
|
||||
* Revision $Revision: 16518 $
|
||||
*
|
||||
*/
|
||||
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 extends AbstractTextBlock implements TextBlock {
|
||||
public class TextBlockSimple extends AbstractTextBlock implements TextBlock {
|
||||
|
||||
private List<Line> lines2;
|
||||
|
||||
@ -66,7 +66,7 @@ class TextBlockSimple extends AbstractTextBlock implements TextBlock {
|
||||
this(texts, fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, null, null);
|
||||
}
|
||||
|
||||
protected TextBlockSimple(Display texts, FontConfiguration fontConfiguration,
|
||||
public TextBlockSimple(Display texts, FontConfiguration fontConfiguration,
|
||||
HorizontalAlignment horizontalAlignment, SpriteContainer spriteContainer, double maxMessageSize,
|
||||
UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
|
||||
this.texts = texts;
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 12235 $
|
||||
* Revision $Revision: 16518 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
@ -41,7 +41,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
class TextBlockSpotted extends TextBlockSimple {
|
||||
public class TextBlockSpotted extends TextBlockSimple {
|
||||
|
||||
private final CircledCharacter circledCharacter;
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 16278 $
|
||||
* Revision $Revision: 16518 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
@ -44,102 +44,15 @@ import java.awt.geom.Rectangle2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.ISkinSimple;
|
||||
import net.sourceforge.plantuml.SpriteContainer;
|
||||
import net.sourceforge.plantuml.creole.CreoleParser;
|
||||
import net.sourceforge.plantuml.creole.Sheet;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock1;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock2;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.posimo.Positionable;
|
||||
import net.sourceforge.plantuml.posimo.PositionableImpl;
|
||||
import net.sourceforge.plantuml.sequencediagram.MessageNumber;
|
||||
import net.sourceforge.plantuml.ugraphic.LimitFinder;
|
||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
|
||||
public class TextBlockUtils {
|
||||
|
||||
public static TextBlock create(Display texts, FontConfiguration fontConfiguration,
|
||||
HorizontalAlignment horizontalAlignment, ISkinSimple spriteContainer) {
|
||||
return create(texts, fontConfiguration, horizontalAlignment, spriteContainer, false);
|
||||
}
|
||||
|
||||
public static TextBlock create(Display texts, FontConfiguration fontConfiguration,
|
||||
HorizontalAlignment horizontalAlignment, ISkinSimple spriteContainer, boolean modeSimpleLine) {
|
||||
if (texts == null) {
|
||||
return empty(0, 0);
|
||||
}
|
||||
return create(texts, fontConfiguration, horizontalAlignment, spriteContainer, 0, modeSimpleLine, null, null);
|
||||
}
|
||||
|
||||
public static TextBlock create(Display texts, FontConfiguration fontConfiguration,
|
||||
HorizontalAlignment horizontalAlignment, ISkinSimple spriteContainer, double maxMessageSize,
|
||||
boolean modeSimpleLine, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
|
||||
if (texts.getNaturalHorizontalAlignment() != null) {
|
||||
horizontalAlignment = texts.getNaturalHorizontalAlignment();
|
||||
}
|
||||
if (texts.size() > 0) {
|
||||
if (texts.get(0) instanceof Stereotype) {
|
||||
return createStereotype(texts, fontConfiguration, horizontalAlignment, spriteContainer, 0,
|
||||
fontForStereotype, htmlColorForStereotype);
|
||||
}
|
||||
if (texts.get(texts.size() - 1) instanceof Stereotype) {
|
||||
return createStereotype(texts, fontConfiguration, horizontalAlignment, spriteContainer,
|
||||
texts.size() - 1, fontForStereotype, htmlColorForStereotype);
|
||||
}
|
||||
if (texts.get(0) instanceof MessageNumber) {
|
||||
return createMessageNumber(texts, fontConfiguration, horizontalAlignment, spriteContainer,
|
||||
maxMessageSize);
|
||||
}
|
||||
}
|
||||
|
||||
return getCreole(texts, fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, modeSimpleLine);
|
||||
}
|
||||
|
||||
private static TextBlock getCreole(Display texts, FontConfiguration fontConfiguration,
|
||||
HorizontalAlignment horizontalAlignment, ISkinSimple spriteContainer, double maxMessageSize,
|
||||
boolean modeSimpleLine) {
|
||||
final Sheet sheet = new CreoleParser(fontConfiguration, horizontalAlignment, spriteContainer, modeSimpleLine)
|
||||
.createSheet(texts);
|
||||
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, maxMessageSize, spriteContainer == null ? 0
|
||||
: spriteContainer.getPadding());
|
||||
return new SheetBlock2(sheetBlock1, sheetBlock1, new UStroke(1.5));
|
||||
}
|
||||
|
||||
private static TextBlock createMessageNumber(Display texts, FontConfiguration fontConfiguration,
|
||||
HorizontalAlignment horizontalAlignment, ISkinSimple spriteContainer, double maxMessageSize) {
|
||||
TextBlock tb1 = getCreole(texts.subList(0, 1), fontConfiguration, horizontalAlignment, spriteContainer,
|
||||
maxMessageSize, false);
|
||||
tb1 = TextBlockUtils.withMargin(tb1, 0, 4, 0, 0);
|
||||
final TextBlock tb2 = getCreole(texts.subList(1, texts.size()), fontConfiguration, horizontalAlignment,
|
||||
spriteContainer, maxMessageSize, false);
|
||||
return TextBlockUtils.mergeLR(tb1, tb2, VerticalAlignment.CENTER);
|
||||
|
||||
}
|
||||
|
||||
private static TextBlock createStereotype(Display texts, FontConfiguration fontConfiguration,
|
||||
HorizontalAlignment horizontalAlignment, SpriteContainer spriteContainer, int position,
|
||||
UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
|
||||
final Stereotype stereotype = (Stereotype) texts.get(position);
|
||||
if (stereotype.isSpotted()) {
|
||||
final CircledCharacter circledCharacter = new CircledCharacter(stereotype.getCharacter(),
|
||||
stereotype.getRadius(), stereotype.getCircledFont(), stereotype.getHtmlColor(), null,
|
||||
fontConfiguration.getColor());
|
||||
if (stereotype.getLabel(false) == null) {
|
||||
return new TextBlockSpotted(circledCharacter, texts.subList(1, texts.size()), fontConfiguration,
|
||||
horizontalAlignment, spriteContainer);
|
||||
}
|
||||
return new TextBlockSpotted(circledCharacter, texts, fontConfiguration, horizontalAlignment,
|
||||
spriteContainer);
|
||||
}
|
||||
return new TextBlockSimple(texts, fontConfiguration, horizontalAlignment, spriteContainer, 0,
|
||||
fontForStereotype, htmlColorForStereotype);
|
||||
}
|
||||
|
||||
public static TextBlock withMargin(TextBlock textBlock, double marginX, double marginY) {
|
||||
return new TextBlockMarged(textBlock, marginX, marginX, marginY, marginY);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public abstract class USymbol {
|
||||
return symbol;
|
||||
}
|
||||
|
||||
public abstract TextBlock asSmall(TextBlock label, TextBlock stereotype, SymbolContext symbolContext);
|
||||
public abstract TextBlock asSmall(TextBlock name, TextBlock label, TextBlock stereotype, SymbolContext symbolContext);
|
||||
|
||||
public abstract TextBlock asBig(TextBlock label, TextBlock stereotype, double width, double height,
|
||||
SymbolContext symbolContext);
|
||||
|
@ -36,10 +36,13 @@ package net.sourceforge.plantuml.graphic;
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.creole.Stencil;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
class USymbolArtifact extends USymbol {
|
||||
@ -49,7 +52,6 @@ class USymbolArtifact extends USymbol {
|
||||
return SkinParameter.ARTIFACT;
|
||||
}
|
||||
|
||||
|
||||
private void drawArtifact(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing) {
|
||||
|
||||
final URectangle form = new URectangle(widthTotal, heightTotal);
|
||||
@ -86,11 +88,26 @@ class USymbolArtifact extends USymbol {
|
||||
return new Margin(10, 10 + 10, 10 + 3, 10);
|
||||
}
|
||||
|
||||
public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
public boolean manageHorizontalLine() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
final Stencil stencil = new Stencil() {
|
||||
public double getStartingX(StringBounder stringBounder, double y) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getEndingX(StringBounder stringBounder, double y) {
|
||||
return dim.getWidth();
|
||||
}
|
||||
};
|
||||
ug = new UGraphicStencil(ug, stencil, new UStroke());
|
||||
ug = symbolContext.apply(ug);
|
||||
drawArtifact(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
|
||||
final Margin margin = getMargin();
|
||||
|
@ -70,7 +70,7 @@ class USymbolCard extends USymbol {
|
||||
return new Margin(10, 10, 3, 3);
|
||||
}
|
||||
|
||||
public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -86,7 +86,7 @@ class USymbolCloud extends USymbol {
|
||||
return new Margin(10, 10, 10, 10);
|
||||
}
|
||||
|
||||
public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -69,7 +69,7 @@ class USymbolComponent1 extends USymbol {
|
||||
return new Margin(10, 10, 10, 10);
|
||||
}
|
||||
|
||||
public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -72,7 +72,7 @@ class USymbolComponent2 extends USymbol {
|
||||
return new Margin(10 + 5, 20 + 5, 15 + 5, 5 + 5);
|
||||
}
|
||||
|
||||
public TextBlock asSmall(final TextBlock label, TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -112,7 +112,7 @@ class USymbolDatabase extends USymbol {
|
||||
return new Margin(10, 10, 20, 5);
|
||||
}
|
||||
|
||||
public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -101,23 +101,29 @@ public class USymbolFolder extends USymbol {
|
||||
return new Margin(10, 10 + 10, 10 + 3, 10);
|
||||
}
|
||||
|
||||
public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
public TextBlock asSmall(final TextBlock name, final TextBlock label, final TextBlock stereotype,
|
||||
final SymbolContext symbolContext) {
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final Dimension2D dim = calculateDimension(ug.getStringBounder());
|
||||
ug = symbolContext.apply(ug);
|
||||
drawFolder(ug, dim.getWidth(), dim.getHeight(), new Dimension2DDouble(0, 0),
|
||||
symbolContext.isShadowing());
|
||||
final Dimension2D dimName = name.calculateDimension(ug.getStringBounder());
|
||||
drawFolder(ug, dim.getWidth(), dim.getHeight(), dimName, symbolContext.isShadowing());
|
||||
final Margin margin = getMargin();
|
||||
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
|
||||
tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1())));
|
||||
name.drawU(ug.apply(new UTranslate(4, 3)));
|
||||
tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1() + dimName.getHeight())));
|
||||
}
|
||||
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
final Dimension2D dimName = name.calculateDimension(stringBounder);
|
||||
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
|
||||
final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder);
|
||||
return getMargin().addDimension(Dimension2DDouble.mergeTB(dimStereo, dimLabel));
|
||||
return getMargin().addDimension(Dimension2DDouble.mergeTB(dimName, dimStereo, dimLabel));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ class USymbolFrame extends USymbol {
|
||||
return new Margin(10 + 5, 20 + 5, 15 + 5, 5 + 5);
|
||||
}
|
||||
|
||||
public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -73,7 +73,7 @@ class USymbolNode extends USymbol {
|
||||
return new Margin(10 + 5, 20 + 5, 15 + 5, 5 + 5);
|
||||
}
|
||||
|
||||
public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -114,7 +114,7 @@ class USymbolQueue extends USymbol {
|
||||
return new Margin(5, 15, 5, 5);
|
||||
}
|
||||
|
||||
public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -67,7 +67,7 @@ class USymbolRect extends USymbol {
|
||||
return new Margin(10, 10, 10, 10);
|
||||
}
|
||||
|
||||
public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
@ -41,7 +41,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
abstract class USymbolSimpleAbstract extends USymbol {
|
||||
|
||||
public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
if (stereotype == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class USymbolStorage extends USymbol {
|
||||
return new Margin(10, 10, 10, 10);
|
||||
}
|
||||
|
||||
public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) {
|
||||
return new AbstractTextBlock() {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user