1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 02:49:06 +00:00

version 8057

This commit is contained in:
Arnaud Roques 2017-02-26 17:26:11 +01:00
parent c7252cdf63
commit 73307b6df5
80 changed files with 1063 additions and 176 deletions

View File

@ -6,12 +6,14 @@ Generate UML diagram from textual description
PlantUML is a component that allows to quickly write :
* [Sequence diagram](http://plantuml.com/sequence.html),
* [Use case diagram](http://plantuml.com/usecase.html),
* [Class diagram](http://plantuml.com/classes.html),
* [Activity diagram](http://plantuml.com/activity2.html),
* [Component diagram](http://plantuml.com/component.html),
* [State diagram](http://plantuml.com/state.html),
* [Object diagram](http://plantuml.com/objects.html)
* [Sequence diagram](http://plantuml.com/sequence-diagram),
* [Use case diagram](http://plantuml.com/use-case-diagram),
* [Class diagram](http://plantuml.com/class-diagram),
* [Activity diagram](http://plantuml.com/activity-diagram-beta),
* [Component diagram](http://plantuml.com/component-diagram),
* [State diagram](http://plantuml.com/state-diagram),
* [Object diagram](http://plantuml.com/object-diagram),
* [Deployment diagram](http://plantuml.com/deployment-diagram),
* [Timing diagram](http://plantuml.com/timing-diagram)
To know more about PlantUML, please visit http://plantuml.com/

View File

@ -64,7 +64,6 @@
<jar jarfile="plantuml.jar" basedir="build">
<manifest>
<attribute name="Main-Class" value="net.sourceforge.plantuml.Run" />
<attribute name="SplashScreen-Image" value="net/sourceforge/plantuml/version/logo.png" />
<attribute name="Class-Path" value="batik-all-1.7.jar jlatexmath-minimal-1.0.3.jar jlm_cyrillic.jar jlm_greek.jar vizjs.jar j2v8_win32_x86_64-3.1.6.jar j2v8_linux_x86_64-3.1.6.jar j2v8_macosx_x86_64-3.1.6.jar" />
</manifest>
</jar>

View File

@ -35,7 +35,7 @@
<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId>
<version>8057-SNAPSHOT</version>
<version>8058-SNAPSHOT</version>
<packaging>jar</packaging>
<name>PlantUML</name>

View File

@ -96,7 +96,7 @@ public interface ISkinParam extends ISkinSimple {
public double getRoundCorner(String param, Stereotype stereotype);
public double maxMessageSize();
public LineBreakStrategy maxMessageSize();
public boolean strictUmlStyle();
@ -129,10 +129,11 @@ public interface ISkinParam extends ISkinSimple {
public SplitParam getSplitParam();
public int swimlaneWidth();
public UmlDiagramType getUmlDiagramType();
public HtmlColor getHoverPathColor();
public double getPadding(PaddingParam param);
}

View File

@ -0,0 +1,50 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml;
public class LineBreakStrategy {
public static final LineBreakStrategy NONE = new LineBreakStrategy(null);
private final String value;
public LineBreakStrategy(String value) {
this.value = value;
}
public double getMathWidth() {
if (value != null && value.matches("-?\\d+")) {
return Double.parseDouble(value);
}
return 0;
}
}

View File

@ -0,0 +1,41 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml;
public enum PaddingParam {
PARTICIPANT, BOX;
public String getSkinName() {
return StringUtils.goLowerCase(name()) + "Padding";
}
}

View File

@ -130,7 +130,7 @@ public class Run {
}
new MainWindow2(option, dir);
} else if (option.isPipe() || option.isPipeMap() || option.isSyntax()) {
managePipe(option);
error = managePipe(option);
forceQuit = true;
} else if (option.isFailfast2()) {
final long start2 = System.currentTimeMillis();
@ -256,7 +256,7 @@ public class Run {
}
}
private static void managePipe(Option option) throws IOException {
private static boolean managePipe(Option option) throws IOException {
final String charset = option.getCharset();
final BufferedReader br;
if (charset == null) {
@ -264,10 +264,11 @@ public class Run {
} else {
br = new BufferedReader(new InputStreamReader(System.in, charset));
}
managePipe(option, br, System.out);
return managePipe(option, br, System.out);
}
public static void managePipe(Option option, final BufferedReader br, final PrintStream ps) throws IOException {
static public boolean managePipe(Option option, final BufferedReader br, final PrintStream ps) throws IOException {
boolean error = false;
final StringBuilder sb = new StringBuilder();
String s = null;
while ((s = br.readLine()) != null) {
@ -286,6 +287,7 @@ public class Run {
ps.println(((UmlDiagram) system).getUmlDiagramType().name());
ps.println(system.getDescription());
} else if (system instanceof PSystemError) {
error = true;
ps.println("ERROR");
final PSystemError sys = (PSystemError) system;
ps.println(sys.getHigherErrorPosition());
@ -302,6 +304,7 @@ public class Run {
} else if (option.isPipe()) {
final String result = sourceStringReader.generateImage(ps, 0, option.getFileFormatOption());
if ("(error)".equalsIgnoreCase(result)) {
error = true;
System.err.println("ERROR");
final Diagram system = sourceStringReader.getBlocks().get(0).getDiagram();
final PSystemError sys = (PSystemError) system;
@ -311,6 +314,7 @@ public class Run {
}
}
}
return error;
}
private static boolean manageAllFiles(Option option) throws IOException, InterruptedException {

View File

@ -641,12 +641,8 @@ public class SkinParam implements ISkinParam {
return null;
}
public double maxMessageSize() {
final String value = getValue("maxmessagesize");
if (value != null && value.matches("-?\\d+")) {
return Double.parseDouble(value);
}
return 0;
public LineBreakStrategy maxMessageSize() {
return new LineBreakStrategy(getValue("maxmessagesize"));
}
public boolean strictUmlStyle() {
@ -726,14 +722,6 @@ public class SkinParam implements ISkinParam {
return true;
}
public double getPadding() {
final String value = getValue("padding");
if (value != null && value.matches("\\d+(\\.\\d+)?")) {
return Double.parseDouble(value);
}
return 0;
}
public int groupInheritance() {
final String value = getValue("groupinheritance");
int result = Integer.MAX_VALUE;
@ -839,4 +827,20 @@ public class SkinParam implements ISkinParam {
return getIHtmlColorSet().getColorIfValid(value, false);
}
public double getPadding() {
final String value = getValue("padding");
if (value != null && value.matches("\\d+(\\.\\d+)?")) {
return Double.parseDouble(value);
}
return 0;
}
public double getPadding(PaddingParam param) {
final String value = getValue(param.getSkinName());
if (value != null && value.matches("\\d+(\\.\\d+)?")) {
return Double.parseDouble(value);
}
return 0;
}
}

View File

@ -150,7 +150,7 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getThickness(param, stereotype);
}
public double maxMessageSize() {
public LineBreakStrategy maxMessageSize() {
return skinParam.maxMessageSize();
}
@ -254,4 +254,8 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getHoverPathColor();
}
public double getPadding(PaddingParam param) {
return skinParam.getPadding(param);
}
}

View File

@ -35,6 +35,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.LineBreakStrategy;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.CreoleParser;
import net.sourceforge.plantuml.creole.Sheet;
@ -68,7 +69,7 @@ public class FloatingNote extends AbstractTextBlock implements Stencil, TextBloc
final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
skinParam, CreoleMode.FULL).createSheet(note);
final SheetBlock2 sheetBlock2 = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this,
final SheetBlock2 sheetBlock2 = new SheetBlock2(new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()), this,
new UStroke(1));
this.opale = new Opale(borderColor, noteBackgroundColor, sheetBlock2, skinParam.shadowing(), false);

View File

@ -40,6 +40,7 @@ import java.util.Set;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.activitydiagram3.Branch;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
@ -125,7 +126,7 @@ class FtileIfAndStop extends AbstractFtile {
final Sheet sheet = new CreoleParser(fcTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
skinParam, CreoleMode.FULL).createSheet(labelTest);
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding());
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding());
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1),
tileNonStop.getThickness());

View File

@ -38,6 +38,7 @@ import java.util.Set;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
@ -98,7 +99,7 @@ public class FtileNoteAlone extends AbstractFtile implements Stencil {
final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
skinParam, CreoleMode.FULL).createSheet(note);
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this, new UStroke(1));
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()), this, new UStroke(1));
opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(), false);
}

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
@ -121,7 +122,7 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil {
final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
skinParam, CreoleMode.FULL).createSheet(note.getDisplay());
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this, new UStroke(1));
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()), this, new UStroke(1));
opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(), withLink);
}

View File

@ -38,6 +38,7 @@ import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
@ -98,7 +99,7 @@ public class FtileWithNotes extends AbstractFtile {
for (PositionedNote note : notes) {
final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
skinParam, CreoleMode.FULL).createSheet(note.getDisplay());
final SheetBlock1 sheet1 = new SheetBlock1(sheet, 0, skinParam.getPadding());
final SheetBlock1 sheet1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding());
final SheetBlock2 sheet2 = new SheetBlock2(sheet1, new Stencil() {
// -6 and 15 value comes from Opale: this is very ugly!
public double getStartingX(StringBounder stringBounder, double y) {

View File

@ -33,6 +33,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.activitydiagram3.Branch;
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
@ -193,7 +194,7 @@ public class ConditionalBuilder {
final Sheet sheet = new CreoleParser(fontTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
skinParam, CreoleMode.FULL).createSheet(labelTest);
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding());
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding());
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), tile1.getThickness());
final Ftile diamond1;

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
@ -119,7 +120,7 @@ public class FtileBox extends AbstractFtile {
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.ACTIVITY, null);
final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
skinParam, CreoleMode.FULL).createSheet(label);
this.tb = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), new MyStencil(), new UStroke(1));
this.tb = new SheetBlock2(new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()), new MyStencil(), new UStroke(1));
this.print = label.toString();
}

View File

@ -38,6 +38,7 @@ import java.util.List;
import java.util.StringTokenizer;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
@ -227,7 +228,8 @@ public class AtomText implements Atom {
return x;
}
public List<AtomText> getSplitted(StringBounder stringBounder, double maxWidth) {
public List<AtomText> getSplitted(StringBounder stringBounder, LineBreakStrategy maxWidthAsString) {
final double maxWidth = maxWidthAsString.getMathWidth();
final List<AtomText> result = new ArrayList<AtomText>();
final StringTokenizer st = new StringTokenizer(text, " ", true);
final StringBuilder currentLine = new StringBuilder();

View File

@ -34,6 +34,7 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -77,7 +78,7 @@ public class CreoleHorizontalLine implements Atom {
}
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());
final TextBlock tb = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding());
return tb;
}

View File

@ -36,32 +36,37 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.graphic.StringBounder;
public class Fission {
private final Stripe stripe;
private final double maxWidth;
private final LineBreakStrategy maxWidth;
public Fission(Stripe stripe, double maxWidth) {
public Fission(Stripe stripe, LineBreakStrategy maxWidth) {
this.stripe = stripe;
this.maxWidth = maxWidth;
if (maxWidth == null) {
throw new IllegalArgumentException();
}
}
public List<Stripe> getSplitted(StringBounder stringBounder) {
if (maxWidth == 0) {
final double valueMaxWidth = maxWidth.getMathWidth();
if (valueMaxWidth == 0) {
return Arrays.asList(stripe);
}
final List<Stripe> result = new ArrayList<Stripe>();
StripeSimple current = new StripeSimple();
for (Atom a1 : stripe.getAtoms()) {
for (Atom atom : getSplitted(stringBounder, a1)) {
final double width = atom.calculateDimension(stringBounder).getWidth();
if (current.totalWidth + width > maxWidth) {
for (Atom atom : stripe.getAtoms()) {
for (Atom atomSplitted : getSplitted(stringBounder, atom)) {
final double width = atomSplitted.calculateDimension(stringBounder).getWidth();
if (current.totalWidth + width > valueMaxWidth) {
result.add(current);
current = new StripeSimple();
}
current.addAtom(atom, width);
current.addAtom(atomSplitted, width);
}
}
if (current.totalWidth > 0) {

View File

@ -38,6 +38,7 @@ import java.util.List;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.DiagramDescriptionImpl;
import net.sourceforge.plantuml.core.ImageData;
@ -71,7 +72,7 @@ public class PSystemCreole extends AbstractPSystem {
final FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(font);
final Sheet sheet = new CreoleParser(fontConfiguration, HorizontalAlignment.LEFT, null, CreoleMode.FULL)
.createSheet(display);
final SheetBlock1 sheetBlock = new SheetBlock1(sheet, 0, 0);
final SheetBlock1 sheetBlock = new SheetBlock1(sheet, LineBreakStrategy.NONE, 0);
final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), 1.0, null, null, null, 0, 0, null,
false);

View File

@ -38,6 +38,7 @@ import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.StringBounder;
@ -54,13 +55,16 @@ public class SheetBlock1 extends AbstractTextBlock implements TextBlock, Atom, S
private Map<Stripe, Double> widths;
private Map<Atom, Position> positions;
private MinMax minMax;
private final double maxWidth;
private final LineBreakStrategy maxWidth;
private final double padding;
public SheetBlock1(Sheet sheet, double maxWidth, double padding) {
public SheetBlock1(Sheet sheet, LineBreakStrategy maxWidth, double padding) {
this.sheet = sheet;
this.maxWidth = maxWidth;
this.padding = padding;
if (maxWidth == null) {
throw new IllegalArgumentException();
}
}
@Override

View File

@ -36,6 +36,7 @@ import java.util.List;
import java.util.StringTokenizer;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
@ -69,7 +70,7 @@ public class StripeTable implements Stripe {
for (StripeSimple cell : cells) {
sheet.add(cell);
}
return new SheetBlock1(sheet, 0, padding);
return new SheetBlock1(sheet, LineBreakStrategy.NONE, padding);
}
private HtmlColor getBackColor(String line) {

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.CharSequence2;
import net.sourceforge.plantuml.CharSequence2Impl;
import net.sourceforge.plantuml.EmbededDiagram;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.LineLocationImpl;
import net.sourceforge.plantuml.SpriteContainer;
import net.sourceforge.plantuml.StringUtils;
@ -371,12 +372,21 @@ public class Display implements Iterable<CharSequence> {
public TextBlock create(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
ISkinSimple spriteContainer, CreoleMode modeSimpleLine) {
return create(fontConfiguration, horizontalAlignment, spriteContainer, 0, modeSimpleLine, null, null);
return create(fontConfiguration, horizontalAlignment, spriteContainer, LineBreakStrategy.NONE, modeSimpleLine, null, null);
}
public TextBlock create(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
ISkinSimple spriteContainer, double maxMessageSize, CreoleMode modeSimpleLine, UFont fontForStereotype,
HtmlColor htmlColorForStereotype) {
ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize) {
return create(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, defaultCreoleMode, null,
null);
}
public TextBlock create(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, CreoleMode modeSimpleLine,
UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
if (maxMessageSize == null) {
throw new IllegalArgumentException();
}
if (getNaturalHorizontalAlignment() != null) {
horizontalAlignment = getNaturalHorizontalAlignment();
}
@ -398,7 +408,7 @@ public class Display implements Iterable<CharSequence> {
}
private TextBlock getCreole(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
ISkinSimple spriteContainer, double maxMessageSize, CreoleMode modeSimpleLine) {
ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, CreoleMode modeSimpleLine) {
final Sheet sheet = new CreoleParser(fontConfiguration, horizontalAlignment, spriteContainer, modeSimpleLine)
.createSheet(this);
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, maxMessageSize, spriteContainer == null ? 0
@ -407,7 +417,7 @@ public class Display implements Iterable<CharSequence> {
}
private TextBlock createMessageNumber(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
ISkinSimple spriteContainer, double maxMessageSize) {
ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize) {
TextBlock tb1 = subList(0, 1).getCreole(fontConfiguration, horizontalAlignment, spriteContainer,
maxMessageSize, CreoleMode.FULL);
tb1 = TextBlockUtils.withMargin(tb1, 0, 4, 0, 0);

View File

@ -60,7 +60,7 @@ import net.sourceforge.plantuml.version.PSystemVersion;
public class PSystemDonors extends AbstractPSystem {
public static final String DONORS = "UDfbL4josp0CtUCKN6lIGoXsx5J-96EdwKnsi0HRZ2d29IMdyZbwbImwqrqlu2CLSYkJIhaIXW3utiE3KfFyE-JWaMfoAhKrMuqvF54I3bSmvn0w3sbVYXkOkd15BQnfWxxMQDMIImkfBTYfALDzekvpkvMCFXqjp35woDOmrdsW3QIXDHzXtGG8BKnrCZoM8UjHDXxMDHrAich4V11-u_uTyZ2hFfIoWn4RRTMA6q-GDH_karSM8drmqB28K6CLX_9KQkWxsaBa79LQkkxGjS9qTQLjTx2CqTSdU33wA0LZdUy5-VL6MxZprzOs0f7G4SQdIjUkLNCikK38Ej5VIfJsKLv29enBphuLcIpMaYVu15Vs5ppj1wni8Q7BHPC9RboxvpU_rzB8IDc3g_K9xaDsmR3GUKb6tQ8sRSp0d68mtaD6Q3zbc7zhoAjnit4eipI1xpE_rfINQkRGOu2q8x5eDB6tpbcIecPyrB5HBbRv4WXhX5Latkw9c6VoAjM7o5QyxvIvPOSMpU56lL2DVF2m4eBe2ZNJtMXXOjXrUYz-_pBcClHW21EPK-mqlzh9OQzsD_LooCZ38_RsMEa1uDHejKOiP7NSZjHNiZjoDsgHFdrUfy7Q2LkOqc1bOkOs5ujKwbbGZyMqiv3fg9kiBCkS2EwEiVEF2ClGXAeUP1BHc3PQVD5Kf2RSK1tqpJrCuibSk0Gts5Cicy1TwfruQAshi882I3PvsocDijKHwCGOEFyulqVjp-_ddp0g1wlTok8rcykFm5dPXNiUm9aIRxUEMhNKbGmkm___Ady0ufjPnG00";
public static final String DONORS = "UDfbL4josp0CtUCKN6lIGoXsx5J-96EdwKnsi0HRZ2d29IMdyZbwbImwqrqlu2CLSYkJIhaoJ01y3tXFgKd-7NBmI3KvbTgQhSOSdYW9XokOSmYTXxGlnGrCNRYY5jQqGLzhj6h9fONK5kpKbAa-KVTpkvMCFXqjp35woDOmrdsW3QIXDHzXtGG8BKnrCZoM8UjHDXxMDHrAich4V11-u_uTyZ2hFfIoWn4RRTMA6q-GDH_karSM8drmqB28K6CLX_9KQkWxsaB6EIgrTDsXQuNfwahRxc0PewzFy63qKGh6EjyBykkDjd3dhwrj12AX8unFbQvTg-POSe6GTKD_AL7QHta9cR0kEVjMncInbZp19xYol-1fFs1b2mbTBZEPuCQrUtxpUosDZ9Gzk5gVu3va5mmBdPTar2rgqyOCp2a6upraXFPJXlctXhmQDnk7iaiJ-3xpQqrvgMOEFGP8EnA9HXjxwvGbAMh6HnqBvIALBu6mHbX5uksUY7achr9zY6J5-suoj-pGeZdSg1UgaGyULa8GNQ5ckbijJ0oxRjwBtx-CkImz2C94uXGvpQzoSjXFkzjwEMJauH5xUQpq071gj5eZ5c8TjoFrbUoEt8rQf4-VrscGTi8MfZImJCpSvYAHIZqBwh68TXOo7NMR5RFCYU3k62l_YB0CJQZgGIOHZMcZHHTDHMh23TLXlhc7IRoP2vUW1dkAnoPmbted6bhhAbXG08cJjzsaKLmTWKwCWVEFytlK_ln-_WcZSc3jLepNR2uV0cV52_SyW3CbtcuTjMgfArbSXlz_LLRN_yGZVm26X5oY";
@Override
final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat)

View File

@ -30,7 +30,6 @@
*/
package net.sourceforge.plantuml.graphic;
public class HtmlColorUtils {
public static final HtmlColor BLACK;
@ -66,7 +65,6 @@ public class HtmlColorUtils {
public static final HtmlColor COL_D7E0F2;
public static final HtmlColor COL_989898;
public static final HtmlColor COL_BBBBBB;
static {
@ -108,4 +106,11 @@ public class HtmlColorUtils {
}
public static HtmlColor noGradient(HtmlColor color) {
if (color instanceof HtmlColorGradient) {
return ((HtmlColorGradient) color).getColor1();
}
return color;
}
}

View File

@ -203,7 +203,8 @@ public class QuoteUtils {
"Ab WninFpevcg senzrjbexf jrer perngrq qhevat gur jevgvat bs guvf zrffntr.",
"P'rfg cerffr-cherr dhv g'nf vagreebtr ?",
"Ybbx, nygreangvir snpgf ner abg snpgf. Gurl'er snyfrubbqf",
"Guvf vf abg n penfu, guvf vf zber bs na nygreangvir erfhyg.");
"Guvf vf abg n penfu, guvf vf zber bs na nygreangvir erfhyg.",
"Lbh yrnearq gb cebtenz va SBEGENA qvqa'g lbh?");
private QuoteUtils() {
}

View File

@ -35,6 +35,7 @@ import java.awt.geom.Rectangle2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -50,8 +51,8 @@ public class TextBlockTitle implements TextBlock {
if (stringsToDisplay.size() == 1 && stringsToDisplay.get(0).length() == 0) {
throw new IllegalArgumentException();
}
textBlock = stringsToDisplay.create(font, HorizontalAlignment.CENTER, spriteContainer, 0, CreoleMode.FULL,
null, null);
textBlock = stringsToDisplay.create(font, HorizontalAlignment.CENTER, spriteContainer, LineBreakStrategy.NONE,
CreoleMode.FULL, null, null);
}
public final void drawU(UGraphic ug) {

View File

@ -34,6 +34,7 @@ import java.awt.geom.Dimension2D;
import java.util.Arrays;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.CreoleParser;
@ -76,7 +77,7 @@ public class GTileNode extends AbstractTextBlock implements GTile {
final Sheet sheet9 = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
.createSheet(display);
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet9, 0, 0);
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet9, LineBreakStrategy.NONE, 0);
return sheetBlock1;
}

View File

@ -44,7 +44,10 @@ public class ComplementBeforeOrAfterOrAtTaskStartOrEnd implements ComplementPatt
public Complement getComplement(GanttDiagram system, RegexResult arg, String suffix) {
final String code = arg.get("COMPLEMENT" + suffix, 2);
final String position = arg.get("COMPLEMENT" + suffix, 3);
final Task task = system.getTask(new TaskCode(code));
final Task task = system.getExistingTask(code);
if (task == null) {
throw new IllegalStateException();
}
final String days = arg.get("COMPLEMENT" + suffix, 0);
TaskInstant result = new TaskInstant(task, TaskAttribute.fromString(position));
if (days != null) {

View File

@ -0,0 +1,86 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.project3;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
public class ComplementDate implements ComplementPattern {
public IRegex toRegex(String suffix) {
return new RegexOr(toRegexA(suffix), toRegexB(suffix));
}
private IRegex toRegexA(String suffix) {
return new RegexConcat( //
new RegexLeaf("ADAY" + suffix, "([\\d]+)"), //
new RegexLeaf("[\\w ]*?"), //
new RegexLeaf("AMONTH" + suffix, "(" + Month.getRegexString() + ")"), //
new RegexLeaf("[\\w ]*?"), //
new RegexLeaf("AYEAR" + suffix, "([\\d]+)"));
}
private IRegex toRegexB(String suffix) {
return new RegexConcat( //
new RegexLeaf("BYEAR" + suffix, "([\\d]{4})"), //
new RegexLeaf("\\D"), //
new RegexLeaf("BMONTH" + suffix, "([\\d]{1,2})"), //
new RegexLeaf("\\D"), //
new RegexLeaf("BDAY" + suffix, "([\\d]{1,2})"));
}
public Complement getComplement(GanttDiagram system, RegexResult arg, String suffix) {
if (arg.get("ADAY" + suffix, 0) != null) {
return resultA(arg, suffix);
}
if (arg.get("BDAY" + suffix, 0) != null) {
return resultB(arg, suffix);
}
throw new IllegalStateException();
}
private Complement resultA(RegexResult arg, String suffix) {
final int day = Integer.parseInt(arg.get("ADAY" + suffix, 0));
final String month = arg.get("AMONTH" + suffix, 0);
final int year = Integer.parseInt(arg.get("AYEAR" + suffix, 0));
return DayAsDate.create(year, month, day);
}
private Complement resultB(RegexResult arg, String suffix) {
final int day = Integer.parseInt(arg.get("BDAY" + suffix, 0));
final int month = Integer.parseInt(arg.get("BMONTH" + suffix, 0));
final int year = Integer.parseInt(arg.get("BYEAR" + suffix, 0));
return DayAsDate.create(year, month, day);
}
}

View File

@ -0,0 +1,92 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.project3;
public class DayAsDate implements Complement {
private final int year;
private final int dayOfMonth;
private final Month month;
public static DayAsDate create(int year, String month, int dayOfMonth) {
return new DayAsDate(year, Month.fromString(month), dayOfMonth);
}
public static DayAsDate create(int year, int month, int dayOfMonth) {
return new DayAsDate(year, Month.values()[month - 1], dayOfMonth);
}
private DayAsDate(int year, Month month, int dayOfMonth) {
this.year = year;
this.dayOfMonth = dayOfMonth;
this.month = month;
}
@Override
public String toString() {
return "" + year + "/" + month + "/" + dayOfMonth;
}
public final int getDayOfMonth() {
return dayOfMonth;
}
private int daysPerMonth() {
return month.getDaysPerMonth(year);
}
public DayAsDate next() {
int newDayOfMonth = dayOfMonth + 1;
if (newDayOfMonth <= daysPerMonth()) {
return new DayAsDate(year, month, newDayOfMonth);
}
assert newDayOfMonth > daysPerMonth();
newDayOfMonth = 1;
final Month newMonth = month.next();
final int newYear = newMonth == Month.JANUARY ? year + 1 : year;
return new DayAsDate(newYear, newMonth, newDayOfMonth);
}
public Month getMonth() {
return month;
}
// https://en.wikipedia.org/wiki/Zeller%27s_congruence
public DayOfWeek getDayOfWeek() {
final int q = dayOfMonth;
final int m = month.m();
final int y = m >= 13 ? year - 1 : year;
final int k = y % 100;
final int j = y / 100;
final int h = ((q + 13 * (m + 1) / 5) + k + k / 4 + j / 4 + 5 * j) % 7;
return DayOfWeek.fromH(h);
}
}

View File

@ -0,0 +1,50 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.project3;
import net.sourceforge.plantuml.StringUtils;
public enum DayOfWeek {
MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY;
public DayOfWeek next() {
return DayOfWeek.values()[(ordinal() + 1) % 7];
}
public static DayOfWeek fromH(int h) {
return DayOfWeek.values()[(h + 5) % 7];
}
public String shortName() {
return StringUtils.capitalize(name().substring(0, 2));
}
}

View File

@ -0,0 +1,39 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.project3;
public interface GCalendar {
// public DayAsDate next(DayAsDate day);
public DayAsDate toDayAsDate(InstantDay day);
}

View File

@ -0,0 +1,49 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.project3;
public class GCalendarSimple implements GCalendar {
private final DayAsDate start;
public GCalendarSimple(DayAsDate start) {
this.start = start;
}
public DayAsDate toDayAsDate(InstantDay day) {
DayAsDate result = start;
for (int i = 0; i < day.getNumDay(); i++) {
result = result.next();
}
return result;
}
}

View File

@ -36,6 +36,7 @@ import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -49,7 +50,6 @@ import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorSetSimple;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
@ -63,10 +63,16 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class GanttDiagram extends AbstractPSystem {
public class GanttDiagram extends AbstractPSystem implements Subject {
private final Map<TaskCode, Task> tasks = new LinkedHashMap<TaskCode, Task>();
private final Map<String, Task> byShortName = new HashMap<String, Task>();
private final List<GanttConstraint> constraints = new ArrayList<GanttConstraint>();
private final IHtmlColorSet colorSet = new HtmlColorSetSimple();
private GCalendar calendar;
private Instant min;
private Instant max;
public DiagramDescription getDescription() {
return new DiagramDescriptionImpl("(Project)", getClass());
@ -91,7 +97,6 @@ public class GanttDiagram extends AbstractPSystem {
}
private void sortTasks() {
System.err.println("SORTING TASKS!");
final TaskCodeSimpleOrder order = getCanonicalOrder(1);
final List<Task> list = new ArrayList<Task>(tasks.values());
Collections.sort(list, new Comparator<Task>() {
@ -108,8 +113,10 @@ public class GanttDiagram extends AbstractPSystem {
private UDrawable getUDrawable() {
return new UDrawable() {
public void drawU(UGraphic ug) {
initMinMax();
final TimeScale timeScale = new TimeScale();
drawInternal(ug, timeScale);
drawTimeHeader(ug, timeScale);
drawTasks(ug, timeScale);
drawConstraints(ug, timeScale);
}
};
@ -122,42 +129,66 @@ public class GanttDiagram extends AbstractPSystem {
}
private void drawInternal(final UGraphic ug, TimeScale timeScale) {
private void drawTimeHeader(final UGraphic ug, TimeScale timeScale) {
// System.err.println("==============");
// for (Task task : tasks.values()) {
// System.err.println("task=" + task + " " + ((TaskImpl) task).debug());
// }
// System.err.println("==============");
final double yTotal = initTaskDraws(timeScale);
Instant min = tasks.values().iterator().next().getStart();
Instant max = tasks.values().iterator().next().getEnd();
for (Task task : tasks.values()) {
final Instant start = task.getStart();
final Instant end = task.getEnd();
if (min.compareTo(start) > 0) {
min = start;
}
if (max.compareTo(end) < 0) {
max = end;
}
}
final double header = 16;
double y = header;
for (Task task : tasks.values()) {
final TaskDraw draw = new TaskDraw(task, timeScale, y);
task.setTaskDraw(draw);
y += draw.getHeight();
}
ULine vbar = new ULine(0, y);
final double xmin = timeScale.getPixel(min);
final double xmax = timeScale.getPixel(max.increment());
ug.apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY)).draw(new ULine(xmax - xmin, 0));
ug.apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY)).apply(new UTranslate(0, header - 3))
ug.apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY)).apply(new UTranslate(0, getHeaderHeight() - 3))
.draw(new ULine(xmax - xmin, 0));
if (calendar == null) {
drawSimpleDayCounter(ug, timeScale, yTotal);
} else {
drawCalendar(ug, timeScale, yTotal);
}
}
private void drawCalendar(final UGraphic ug, TimeScale timeScale, final double yTotal) {
final int magic = 12;
final ULine vbar = new ULine(0, yTotal - magic);
Month lastMonth = null;
for (Instant i = min; i.compareTo(max.increment()) <= 0; i = i.increment()) {
final DayAsDate day = calendar.toDayAsDate((InstantDay) i);
final String d1 = "" + day.getDayOfMonth();
final TextBlock num = Display.getWithNewlines(d1).create(getFontConfiguration(), HorizontalAlignment.LEFT,
new SpriteContainerEmpty());
final double x1 = timeScale.getPixel(i);
final double x2 = timeScale.getPixel(i.increment());
if (i.compareTo(max.increment()) < 0) {
final TextBlock weekDay = Display.getWithNewlines(day.getDayOfWeek().shortName()).create(
getFontConfiguration(), HorizontalAlignment.LEFT, new SpriteContainerEmpty());
drawCenter(ug.apply(new UTranslate(0, magic * 2)), num, x1, x2);
drawCenter(ug.apply(new UTranslate(0, magic)), weekDay, x1, x2);
if (lastMonth != day.getMonth()) {
final TextBlock month = Display.getWithNewlines(day.getMonth().name()).create(
getFontConfiguration(), HorizontalAlignment.LEFT, new SpriteContainerEmpty());
month.drawU(ug.apply(new UTranslate(x1, 0)));
}
lastMonth = day.getMonth();
}
ug.apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY)).apply(new UTranslate(x1, magic)).draw(vbar);
}
}
private double getHeaderHeight() {
if (calendar != null) {
return 40;
}
return 16;
}
private void drawCenter(final UGraphic ug, final TextBlock text, final double x1, final double x2) {
final double width = text.calculateDimension(ug.getStringBounder()).getWidth();
final double delta = (x2 - x1) - width;
text.drawU(ug.apply(new UTranslate(x1 + delta / 2, 0)));
}
private void drawSimpleDayCounter(final UGraphic ug, TimeScale timeScale, final double yTotal) {
final ULine vbar = new ULine(0, yTotal);
for (Instant i = min; i.compareTo(max.increment()) <= 0; i = i.increment()) {
final TextBlock num = Display.getWithNewlines(i.toShortString()).create(getFontConfiguration(),
HorizontalAlignment.LEFT, new SpriteContainerEmpty());
@ -170,14 +201,40 @@ public class GanttDiagram extends AbstractPSystem {
}
ug.apply(new UChangeColor(HtmlColorUtils.LIGHT_GRAY)).apply(new UTranslate(x1, 0)).draw(vbar);
}
}
private double initTaskDraws(TimeScale timeScale) {
double y = getHeaderHeight();
for (Task task : tasks.values()) {
final TaskDraw draw = new TaskDraw(task, timeScale, y);
task.setTaskDraw(draw);
y += draw.getHeight();
}
return y;
}
private void initMinMax() {
min = tasks.values().iterator().next().getStart();
max = tasks.values().iterator().next().getEnd();
for (Task task : tasks.values()) {
final Instant start = task.getStart();
final Instant end = task.getEnd();
if (min.compareTo(start) > 0) {
min = start;
}
if (max.compareTo(end) < 0) {
max = end;
}
}
}
private void drawTasks(final UGraphic ug, TimeScale timeScale) {
for (Task task : tasks.values()) {
final TaskDraw draw = task.getTaskDraw();
draw.drawU(ug.apply(new UTranslate(0, draw.getY())));
draw.getTitle().drawU(
ug.apply(new UTranslate(timeScale.getPixel(task.getStart().increment()), draw.getY())));
}
}
private FontConfiguration getFontConfiguration() {
@ -185,11 +242,38 @@ public class GanttDiagram extends AbstractPSystem {
return new FontConfiguration(font, HtmlColorUtils.LIGHT_GRAY, HtmlColorUtils.LIGHT_GRAY, false);
}
public Task getTask(TaskCode code) {
Task result = tasks.get(code);
public Task getExistingTask(String id) {
if (id == null) {
throw new IllegalArgumentException();
}
Task result = byShortName.get(id);
if (result != null) {
return result;
}
final TaskCode code = new TaskCode(id);
return tasks.get(code);
}
public Task getOrCreateTask(String codeOrShortName, String shortName) {
if (codeOrShortName == null) {
throw new IllegalArgumentException();
}
Task result = shortName == null ? null : byShortName.get(shortName);
if (result != null) {
return result;
}
result = byShortName.get(codeOrShortName);
if (result != null) {
return result;
}
final TaskCode code = new TaskCode(codeOrShortName);
result = tasks.get(code);
if (result == null) {
result = new TaskImpl(code);
tasks.put(code, result);
if (byShortName != null) {
byShortName.put(shortName, result);
}
}
return result;
}
@ -216,10 +300,12 @@ public class GanttDiagram extends AbstractPSystem {
constraints.add(constraint);
}
private final IHtmlColorSet colorSet = new HtmlColorSetSimple();
public IHtmlColorSet getIHtmlColorSet() {
return colorSet;
}
public void setStartingDate(DayAsDate start) {
this.calendar = new GCalendarSimple(start);
}
}

View File

@ -46,7 +46,7 @@ import net.sourceforge.plantuml.core.DiagramType;
public class GanttDiagramFactory extends UmlDiagramFactory {
private List<SubjectPattern> subjects() {
return Arrays.<SubjectPattern> asList(new SubjectTask());
return Arrays.<SubjectPattern> asList(new SubjectTask(), new SubjectProject());
}
public GanttDiagramFactory() {

View File

@ -0,0 +1,81 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.project3;
import net.sourceforge.plantuml.StringUtils;
public enum Month {
JANUARY(31), FEBRUARY(28), MARCH(31), APRIL(30), MAY(31), JUNE(30), //
JULY(31), AUGUST(31), SEPTEMBER(30), OCTOBER(31), NOVEMBER(30), DECEMBER(31);
private final int daysPerMonth;
private Month(int daysPerMonth) {
this.daysPerMonth = daysPerMonth;
}
static public String getRegexString() {
final StringBuilder sb = new StringBuilder();
for (Month month : Month.values()) {
if (sb.length() > 0) {
sb.append("|");
}
sb.append(month.name().substring(0, 3) + "[a-z]*");
}
return sb.toString();
}
public static Month fromString(String value) {
value = StringUtils.goUpperCase(value).substring(0, 3);
for (Month m : Month.values()) {
if (m.name().startsWith(value)) {
return m;
}
}
throw new IllegalArgumentException();
}
public final int getDaysPerMonth(int year) {
if (this == FEBRUARY && year % 4 == 0) {
return 29;
}
return daysPerMonth;
}
public Month next() {
return Month.values()[(this.ordinal() + 1) % 12];
}
public int m() {
return 3 + (ordinal() + 10) % 12;
}
}

View File

@ -60,6 +60,9 @@ public class NaturalCommand extends SingleLineCommand2<GanttDiagram> {
final Subject subject = subjectPattern.getSubject(system, arg);
final Verb verb = verbPattern.getVerb(system, arg);
final Complement complement = complementPattern.getComplement(system, arg, "0");
if (complement == null) {
throw new IllegalStateException();
}
return verb.execute(subject, complement);
}

View File

@ -0,0 +1,54 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.project3;
import java.util.Arrays;
import java.util.Collection;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
public class SubjectProject implements SubjectPattern {
public Collection<VerbPattern> getVerbs() {
return Arrays.<VerbPattern> asList(new VerbProjectStarts());
}
public IRegex toRegex() {
return new RegexLeaf("SUBJECT", "project");
}
public Subject getSubject(GanttDiagram project, RegexResult arg) {
return project;
}
}

View File

@ -45,12 +45,17 @@ public class SubjectTask implements SubjectPattern {
}
public IRegex toRegex() {
return new RegexLeaf("SUBJECT", "\\[([^\\[\\]]+?)\\]");
return new RegexLeaf("SUBJECT", "\\[([^\\[\\]]+?)\\](?:[%s]+as[%s]+\\[([^\\[\\]]+?)\\])?");
}
public Subject getSubject(GanttDiagram project, RegexResult arg) {
final String s = arg.get("SUBJECT", 0);
return project.getTask(new TaskCode(s));
final String shortName = arg.get("SUBJECT", 1);
final Task result = project.getOrCreateTask(s, shortName);
if (result == null) {
throw new IllegalStateException();
}
return result;
}
}

View File

@ -36,7 +36,6 @@ import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.SpriteContainerEmpty;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.UDrawable;

View File

@ -0,0 +1,62 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.project3;
import java.util.Arrays;
import java.util.Collection;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
public class VerbProjectStarts implements VerbPattern {
public Collection<ComplementPattern> getComplements() {
return Arrays.<ComplementPattern> asList(new ComplementDate());
}
public IRegex toRegex() {
return new RegexLeaf("starts[%s]*(the[%s]*|on[%s]*)*");
}
public Verb getVerb(final GanttDiagram project, RegexResult arg) {
return new Verb() {
public CommandExecutionResult execute(Subject subject, Complement complement) {
final DayAsDate start = (DayAsDate) complement;
assert project == subject;
project.setStartingDate(start);
return CommandExecutionResult.ok();
}
};
}
}

View File

@ -36,6 +36,7 @@ import java.util.List;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.PaddingParam;
import net.sourceforge.plantuml.SkinParamBackcolored;
import net.sourceforge.plantuml.SkinParamBackcoloredReference;
import net.sourceforge.plantuml.cucadiagram.Display;
@ -191,8 +192,9 @@ class DrawableSetInitializer {
}
}
takeParticipantEngloberPadding(stringBounder);
constraintSet.takeConstraintIntoAccount(stringBounder);
takeParticipantEngloberTitleWidth3(stringBounder);
takeParticipantEngloberTitleWidth(stringBounder);
prepareMissingSpace(stringBounder);
@ -201,7 +203,22 @@ class DrawableSetInitializer {
return drawableSet;
}
private void takeParticipantEngloberTitleWidth3(StringBounder stringBounder) {
private void takeParticipantEngloberPadding(StringBounder stringBounder) {
final double padding = drawableSet.getSkinParam().getPadding(PaddingParam.BOX);
if (padding == 0) {
return;
}
for (Englober pe : drawableSet.getExistingParticipantEnglober(stringBounder)) {
final ParticipantBox first = drawableSet.getLivingParticipantBox(pe.getFirst2TOBEPRIVATE())
.getParticipantBox();
final ParticipantBox last = drawableSet.getLivingParticipantBox(pe.getLast2TOBEPRIVATE())
.getParticipantBox();
constraintSet.pushToLeftParticipantBox(padding, first, true);
constraintSet.pushToLeftParticipantBox(padding, last, false);
}
}
private void takeParticipantEngloberTitleWidth(StringBounder stringBounder) {
for (Englober pe : drawableSet.getExistingParticipantEnglober(stringBounder)) {
final double preferredWidth = drawableSet.getEngloberPreferedWidth(stringBounder,
pe.getParticipantEnglober());

View File

@ -34,6 +34,7 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.cucadiagram.BodyEnhanced2;
import net.sourceforge.plantuml.cucadiagram.Display;
@ -58,16 +59,16 @@ public abstract class AbstractTextualComponent extends AbstractComponent {
private final UFont font;
private final HtmlColor fontColor;
public AbstractTextualComponent(CharSequence label, FontConfiguration font,
HorizontalAlignment horizontalAlignment, int marginX1, int marginX2, int marginY,
ISkinSimple spriteContainer, double maxMessageSize, UFont fontForStereotype,
public AbstractTextualComponent(LineBreakStrategy maxMessageSize, CharSequence label,
FontConfiguration font, HorizontalAlignment horizontalAlignment, int marginX1, int marginX2,
int marginY, ISkinSimple spriteContainer, UFont fontForStereotype,
HtmlColor htmlColorForStereotype) {
this(Display.getWithNewlines(label == null ? "" : label.toString()), font, horizontalAlignment, marginX1,
marginX2, marginY, spriteContainer, maxMessageSize, false, fontForStereotype, htmlColorForStereotype);
this(maxMessageSize, Display.getWithNewlines(label == null ? "" : label.toString()), font, horizontalAlignment,
marginX1, marginX2, marginY, spriteContainer, false, fontForStereotype, htmlColorForStereotype);
}
public AbstractTextualComponent(Display strings, FontConfiguration font, HorizontalAlignment horizontalAlignment,
int marginX1, int marginX2, int marginY, ISkinSimple spriteContainer, double maxMessageSize,
public AbstractTextualComponent(LineBreakStrategy maxMessageSize, Display strings, FontConfiguration font,
HorizontalAlignment horizontalAlignment, int marginX1, int marginX2, int marginY, ISkinSimple spriteContainer,
boolean enhanced, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
this.font = font.getFont();
this.fontColor = font.getColor();

View File

@ -31,6 +31,7 @@
package net.sourceforge.plantuml.skin.bluemodern;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -50,8 +51,8 @@ public abstract class AbstractComponentBlueModernArrow extends AbstractTextualCo
private final HtmlColor foregroundColor;
public AbstractComponentBlueModernArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer) {
super(stringsToDisplay, font, HorizontalAlignment.LEFT, 17, 17, 2,
spriteContainer, 0, false, null, null);
super(LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.LEFT, 17, 17,
2, spriteContainer, false, null, null);
this.arrowConfiguration = arrowConfiguration;
this.foregroundColor = foregroundColor;
}

View File

@ -31,6 +31,7 @@
package net.sourceforge.plantuml.skin.bluemodern;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -51,8 +52,8 @@ public class ComponentBlueModernActor extends AbstractTextualComponent {
public ComponentBlueModernActor(HtmlColor backgroundColor, HtmlColor foregroundColor, FontConfiguration font,
Display stringsToDisplay, boolean head, ISkinSimple spriteContainer) {
super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0,
spriteContainer, 0, false, null, null);
super(LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3,
0, spriteContainer, false, null, null);
this.head = head;
stickman = new StickMan(backgroundColor, foregroundColor);
}

View File

@ -33,6 +33,7 @@ package net.sourceforge.plantuml.skin.bluemodern;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -47,8 +48,8 @@ public class ComponentBlueModernDelayText extends AbstractTextualComponent {
public ComponentBlueModernDelayText(FontConfiguration font, Display stringsToDisplay,
ISkinSimple spriteContainer) {
super(stringsToDisplay, font, HorizontalAlignment.CENTER, 4, 4, 4,
spriteContainer, 0, false, null, null);
super(LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 4, 4,
4, spriteContainer, false, null, null);
}
@Override

View File

@ -33,6 +33,7 @@ package net.sourceforge.plantuml.skin.bluemodern;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -58,8 +59,8 @@ public class ComponentBlueModernDivider extends AbstractTextualComponent {
public ComponentBlueModernDivider(FontConfiguration font, HtmlColor background1, HtmlColor background2,
HtmlColor borderColor, Display stringsToDisplay, ISkinSimple spriteContainer) {
super(stringsToDisplay, font, HorizontalAlignment.CENTER, 4, 4, 4,
spriteContainer, 0, false, null, null);
super(LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 4, 4,
4, spriteContainer, false, null, null);
this.background1 = background1;
this.background2 = background2;
this.borderColor = borderColor;

View File

@ -33,6 +33,7 @@ package net.sourceforge.plantuml.skin.bluemodern;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -54,7 +55,7 @@ public class ComponentBlueModernEnglober extends AbstractTextualComponent {
public ComponentBlueModernEnglober(HtmlColor borderColor, HtmlColor backColor, Display strings,
FontConfiguration font, ISkinSimple spriteContainer) {
super(strings, font, HorizontalAlignment.CENTER, 4, 4, 1, spriteContainer, 0, false,
super(LineBreakStrategy.NONE, strings, font, HorizontalAlignment.CENTER, 4, 4, 1, spriteContainer, false,
null, null);
this.borderColor = borderColor;
this.backColor = backColor;

View File

@ -33,6 +33,7 @@ package net.sourceforge.plantuml.skin.bluemodern;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -65,7 +66,7 @@ public class ComponentBlueModernGroupingHeader extends AbstractTextualComponent
public ComponentBlueModernGroupingHeader(HtmlColor headerBackgroundColor, HtmlColor generalBackgroundColor,
HtmlColor borderColor, HtmlColor fontColor2, FontConfiguration bigFont, UFont smallFont, Display strings,
ISkinSimple spriteContainer) {
super(strings.get(0), bigFont, HorizontalAlignment.LEFT, 15, 30, 1, spriteContainer, 0, null, null);
super(LineBreakStrategy.NONE, strings.get(0), bigFont, HorizontalAlignment.LEFT, 15, 30, 1, spriteContainer, null, null);
this.headerBackgroundColor = headerBackgroundColor;
this.generalBackgroundColor = generalBackgroundColor;
this.borderColor = borderColor;

View File

@ -31,6 +31,7 @@
package net.sourceforge.plantuml.skin.bluemodern;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -54,7 +55,7 @@ final public class ComponentBlueModernNote extends AbstractTextualComponent {
public ComponentBlueModernNote(HtmlColor back, HtmlColor foregroundColor, FontConfiguration font,
Display strings, ISkinSimple spriteContainer) {
super(strings, font, HorizontalAlignment.LEFT, 6, 15, 5, spriteContainer, 0, false,
super(LineBreakStrategy.NONE, strings, font, HorizontalAlignment.LEFT, 6, 15, 5, spriteContainer, false,
null, null);
this.back = back;
this.foregroundColor = foregroundColor;

View File

@ -31,6 +31,7 @@
package net.sourceforge.plantuml.skin.bluemodern;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -50,8 +51,8 @@ public class ComponentBlueModernParticipant extends AbstractTextualComponent {
public ComponentBlueModernParticipant(HtmlColor blue1, HtmlColor blue2, FontConfiguration font,
Display stringsToDisplay, ISkinSimple spriteContainer) {
super(stringsToDisplay, font, HorizontalAlignment.CENTER, 7, 7, 7,
spriteContainer, 0, false, null, null);
super(LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 7, 7,
7, spriteContainer, false, null, null);
this.blue1 = blue1;
this.blue2 = blue2;
}

View File

@ -31,6 +31,7 @@
package net.sourceforge.plantuml.skin.rose;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -48,9 +49,9 @@ public abstract class AbstractComponentRoseArrow extends AbstractTextualComponen
public AbstractComponentRoseArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay,
ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer, HorizontalAlignment textHorizontalAlignment,
double maxMessageSize) {
super(stringsToDisplay, font, textHorizontalAlignment, 7, 7, 1, spriteContainer,
maxMessageSize, false, null, null);
LineBreakStrategy maxMessageSize) {
super(maxMessageSize, stringsToDisplay, font, textHorizontalAlignment, 7, 7, 1,
spriteContainer, false, null, null);
this.arrowConfiguration = arrowConfiguration;
this.foregroundColor = foregroundColor;
}

View File

@ -33,6 +33,7 @@ package net.sourceforge.plantuml.skin.rose;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -54,7 +55,7 @@ public class ComponentRoseActor extends AbstractTextualComponent {
public ComponentRoseActor(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head,
ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, 0, false,
super(LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false,
fontForStereotype, htmlColorForStereotype);
this.head = head;
this.stickman = new StickMan(biColor);

View File

@ -34,6 +34,7 @@ import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -62,7 +63,7 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
public ComponentRoseArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay,
ArrowConfiguration arrowConfiguration, HorizontalAlignment messagePosition, ISkinSimple spriteContainer,
HorizontalAlignment textHorizontalAlignment, double maxMessageSize, boolean niceArrow) {
HorizontalAlignment textHorizontalAlignment, LineBreakStrategy maxMessageSize, boolean niceArrow) {
super(foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer, textHorizontalAlignment,
maxMessageSize);
this.messagePosition = messagePosition;

View File

@ -33,6 +33,7 @@ package net.sourceforge.plantuml.skin.rose;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -54,7 +55,7 @@ public class ComponentRoseBoundary extends AbstractTextualComponent {
public ComponentRoseBoundary(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head,
ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, 0, false,
super(LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false,
fontForStereotype, htmlColorForStereotype);
this.head = head;
this.stickman = new Boundary(biColor);

View File

@ -33,6 +33,7 @@ package net.sourceforge.plantuml.skin.rose;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -54,7 +55,7 @@ public class ComponentRoseControl extends AbstractTextualComponent {
public ComponentRoseControl(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head,
ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, 0, false,
super(LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false,
fontForStereotype, htmlColorForStereotype);
this.head = head;
this.stickman = new Control(biColor);

View File

@ -33,6 +33,7 @@ package net.sourceforge.plantuml.skin.rose;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -56,7 +57,7 @@ public class ComponentRoseDatabase extends AbstractTextualComponent {
public ComponentRoseDatabase(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head,
ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, 0, false,
super(LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false,
fontForStereotype, htmlColorForStereotype);
this.head = head;

View File

@ -33,6 +33,7 @@ package net.sourceforge.plantuml.skin.rose;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -46,8 +47,8 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
public class ComponentRoseDelayText extends AbstractTextualComponent {
public ComponentRoseDelayText(FontConfiguration font, Display stringsToDisplay, ISkinSimple spriteContainer) {
super(stringsToDisplay, font, HorizontalAlignment.CENTER, 0, 0, 4,
spriteContainer, 0, false, null, null);
super(LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 0, 0,
4, spriteContainer, false, null, null);
}
@Override

View File

@ -33,6 +33,7 @@ package net.sourceforge.plantuml.skin.rose;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -60,7 +61,7 @@ public class ComponentRoseDivider extends AbstractTextualComponent {
public ComponentRoseDivider(FontConfiguration font, HtmlColor background, Display stringsToDisplay,
ISkinSimple spriteContainer, boolean withShadow, UStroke stroke, HtmlColor borderColor) {
super(stringsToDisplay, font, HorizontalAlignment.CENTER, 4, 4, 4, spriteContainer, 0, false, null, null);
super(LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 4, 4, 4, spriteContainer, false, null, null);
this.background = background;
this.borderColor = borderColor;
this.empty = stringsToDisplay.get(0).length() == 0;

View File

@ -33,6 +33,7 @@ package net.sourceforge.plantuml.skin.rose;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -49,7 +50,7 @@ public class ComponentRoseEnglober extends AbstractTextualComponent {
private final SymbolContext symbolContext;
public ComponentRoseEnglober(SymbolContext symbolContext, Display strings, FontConfiguration font, ISkinSimple spriteContainer) {
super(strings, font, HorizontalAlignment.CENTER, 3, 3, 1, spriteContainer, 0, false, null, null);
super(LineBreakStrategy.NONE, strings, font, HorizontalAlignment.CENTER, 3, 3, 1, spriteContainer, false, null, null);
this.symbolContext = symbolContext;
}

View File

@ -33,6 +33,7 @@ package net.sourceforge.plantuml.skin.rose;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -54,7 +55,7 @@ public class ComponentRoseEntity extends AbstractTextualComponent {
public ComponentRoseEntity(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head,
ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, 0, false,
super(LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, false,
fontForStereotype, htmlColorForStereotype);
this.head = head;
this.stickman = new EntityDomain(biColor);

View File

@ -33,6 +33,7 @@ package net.sourceforge.plantuml.skin.rose;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
@ -57,8 +58,8 @@ public class ComponentRoseGroupingElse extends AbstractTextualComponent {
public ComponentRoseGroupingElse(HtmlColor groupBorder, FontConfiguration smallFont, CharSequence comment,
ISkinSimple spriteContainer, HtmlColor backgroundColor) {
super(comment == null ? null : "[" + comment + "]", smallFont, HorizontalAlignment.LEFT, 5, 5, 1,
spriteContainer, 0, null, null);
super(LineBreakStrategy.NONE, comment == null ? null : "[" + comment + "]", smallFont, HorizontalAlignment.LEFT, 5, 5,
1, spriteContainer, null, null);
this.groupBorder = groupBorder;
this.backgroundColor = backgroundColor;
// this.stroke = stroke;

View File

@ -33,6 +33,7 @@ package net.sourceforge.plantuml.skin.rose;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -62,7 +63,7 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent {
public ComponentRoseGroupingHeader(HtmlColor background, SymbolContext symbolContext, FontConfiguration bigFont,
FontConfiguration smallFont2, Display strings, ISkinSimple spriteContainer) {
super(strings.get(0), bigFont, HorizontalAlignment.LEFT, 15, 30, 1, spriteContainer, 0, null, null);
super(LineBreakStrategy.NONE, strings.get(0), bigFont, HorizontalAlignment.LEFT, 15, 30, 1, spriteContainer, null, null);
this.symbolContext = symbolContext;
this.background = background;
if (strings.size() == 1 || strings.get(1) == null) {

View File

@ -31,6 +31,7 @@
package net.sourceforge.plantuml.skin.rose;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.creole.Stencil;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
@ -55,7 +56,7 @@ final public class ComponentRoseNote extends AbstractTextualComponent implements
public ComponentRoseNote(SymbolContext symbolContext, FontConfiguration font, Display strings, double paddingX, double paddingY,
ISkinSimple spriteContainer) {
super(strings, font, HorizontalAlignment.LEFT, 6, 15, 5, spriteContainer, 0, true, null, null);
super(LineBreakStrategy.NONE, strings, font, HorizontalAlignment.LEFT, 6, 15, 5, spriteContainer, true, null, null);
this.paddingX = paddingX;
this.paddingY = paddingY;
this.symbolContext = symbolContext;

View File

@ -31,6 +31,7 @@
package net.sourceforge.plantuml.skin.rose;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -49,7 +50,7 @@ final public class ComponentRoseNoteBox extends AbstractTextualComponent {
public ComponentRoseNoteBox(SymbolContext symbolContext, FontConfiguration font, Display strings,
ISkinSimple spriteContainer) {
super(strings, font, HorizontalAlignment.LEFT, 4, 4, 4, spriteContainer, 0, false, null, null);
super(LineBreakStrategy.NONE, strings, font, HorizontalAlignment.LEFT, 4, 4, 4, spriteContainer, false, null, null);
this.symbolContext = symbolContext;
}

View File

@ -31,6 +31,7 @@
package net.sourceforge.plantuml.skin.rose;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -51,7 +52,7 @@ final public class ComponentRoseNoteHexagonal extends AbstractTextualComponent {
public ComponentRoseNoteHexagonal(SymbolContext symbolContext, FontConfiguration font, Display strings,
ISkinSimple spriteContainer) {
super(strings, font, HorizontalAlignment.LEFT, 12, 12, 4, spriteContainer, 0, false, null, null);
super(LineBreakStrategy.NONE, strings, font, HorizontalAlignment.LEFT, 12, 12, 4, spriteContainer, false, null, null);
this.symbolContext = symbolContext;
}

View File

@ -31,6 +31,7 @@
package net.sourceforge.plantuml.skin.rose;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -57,12 +58,14 @@ public class ComponentRoseParticipant extends AbstractTextualComponent {
private final UStroke stroke;
private final double minWidth;
private final boolean collections;
private final double padding;
public ComponentRoseParticipant(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay,
ISkinSimple spriteContainer, double roundCorner, UFont fontForStereotype, HtmlColor htmlColorForStereotype,
double minWidth, boolean collections) {
super(stringsToDisplay, font, HorizontalAlignment.CENTER, 7, 7, 7, spriteContainer, 0, false,
double minWidth, boolean collections, double padding) {
super(LineBreakStrategy.NONE, stringsToDisplay, font, HorizontalAlignment.CENTER, 7, 7, 7, spriteContainer, false,
fontForStereotype, htmlColorForStereotype);
this.padding = padding;
this.minWidth = minWidth;
this.collections = collections;
this.back = biColor.getBackColor();
@ -75,6 +78,7 @@ public class ComponentRoseParticipant extends AbstractTextualComponent {
@Override
protected void drawInternalU(UGraphic ug, Area area) {
final StringBounder stringBounder = ug.getStringBounder();
ug = ug.apply(new UTranslate(padding, 0));
ug = ug.apply(new UChangeBackColor(back)).apply(new UChangeColor(foregroundColor));
ug = ug.apply(stroke);
final URectangle rect = new URectangle(getTextWidth(stringBounder), getTextHeight(stringBounder), roundCorner,
@ -104,7 +108,7 @@ public class ComponentRoseParticipant extends AbstractTextualComponent {
@Override
public double getPreferredWidth(StringBounder stringBounder) {
return getTextWidth(stringBounder) + deltaShadow + getDeltaCollection();
return getTextWidth(stringBounder) + deltaShadow + getDeltaCollection() + 2 * padding;
}
@Override

View File

@ -33,6 +33,7 @@ package net.sourceforge.plantuml.skin.rose;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -60,8 +61,8 @@ public class ComponentRoseReference extends AbstractTextualComponent {
public ComponentRoseReference(FontConfiguration font, SymbolContext symbolContext, FontConfiguration header,
Display stringsToDisplay, HorizontalAlignment position, ISkinSimple spriteContainer, HtmlColor background) {
super(stringsToDisplay.subList(1, stringsToDisplay.size()), font, HorizontalAlignment.LEFT, 4, 4, 4,
spriteContainer, 0, false, null, null);
super(LineBreakStrategy.NONE, stringsToDisplay.subList(1, stringsToDisplay.size()), font, HorizontalAlignment.LEFT, 4, 4,
4, spriteContainer, false, null, null);
this.position = position;
this.symbolContext = symbolContext;
this.background = background;

View File

@ -34,6 +34,7 @@ import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -59,7 +60,7 @@ public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow {
private final boolean niceArrow;
public ComponentRoseSelfArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay,
ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer, double maxMessageSize, boolean niceArrow) {
ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, boolean niceArrow) {
super(foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer, HorizontalAlignment.LEFT,
maxMessageSize);
this.niceArrow = niceArrow;

View File

@ -35,6 +35,7 @@ import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.PaddingParam;
import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
@ -100,25 +101,26 @@ public class Rose implements Skin {
config, messageHorizontalAlignment, param, textHorizontalAlignment, param.maxMessageSize(),
param.strictUmlStyle() == false);
}
final double padding = param.getPadding(PaddingParam.PARTICIPANT);
if (type == ComponentType.PARTICIPANT_HEAD) {
return new ComponentRoseParticipant(getSymbolContext(param, ColorParam.participantBorder), getUFont2(param,
FontParam.PARTICIPANT), stringsToDisplay, param, param.getRoundCorner("", null), newFontForStereotype,
getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), false);
getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), false, padding);
}
if (type == ComponentType.PARTICIPANT_TAIL) {
return new ComponentRoseParticipant(getSymbolContext(param, ColorParam.participantBorder), getUFont2(param,
FontParam.PARTICIPANT), stringsToDisplay, param, param.getRoundCorner("", null), newFontForStereotype,
getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), false);
getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), false, padding);
}
if (type == ComponentType.COLLECTIONS_HEAD) {
return new ComponentRoseParticipant(getSymbolContext(param, ColorParam.participantBorder), getUFont2(param,
FontParam.PARTICIPANT), stringsToDisplay, param, param.getRoundCorner("", null), newFontForStereotype,
getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), true);
getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), true, padding);
}
if (type == ComponentType.COLLECTIONS_TAIL) {
return new ComponentRoseParticipant(getSymbolContext(param, ColorParam.participantBorder), getUFont2(param,
FontParam.PARTICIPANT), stringsToDisplay, param, param.getRoundCorner("", null), newFontForStereotype,
getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), true);
getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), true, padding);
}
if (type == ComponentType.PARTICIPANT_LINE) {
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder);

View File

@ -249,7 +249,7 @@ public class Line implements Moveable, Hideable {
final double marginLabel = startUid.equalsId(endUid) ? 6 : 1;
final TextBlock label = TextBlockUtils.withMargin(
link.getLabel().create(labelFont, skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER),
skinParam), marginLabel, marginLabel);
skinParam, skinParam.maxMessageSize()), marginLabel, marginLabel);
if (getLinkArrow() == LinkArrow.NONE) {
labelOnly = label;
} else {

View File

@ -37,6 +37,7 @@ import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.cucadiagram.dot.DotData;
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.posimo.Moveable;
import net.sourceforge.plantuml.skin.rose.Rose;
@ -66,8 +67,9 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage,
cluster.drawU(ug, new UStroke(1.5), dotData.getUmlDiagramType(), dotData.getSkinParam());
}
final HtmlColor color = rose.getHtmlColor(dotData.getSkinParam(), getArrowColorParam(), null);
final HtmlColor color = HtmlColorUtils.noGradient(rose.getHtmlColor(dotData.getSkinParam(),
getArrowColorParam(), null));
for (Shape shape : dotStringFactory.getBibliotekon().allShapes()) {
final double minX = shape.getMinX();
final double minY = shape.getMinY();

View File

@ -37,6 +37,7 @@ import java.util.Map;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.command.Position;
@ -122,6 +123,7 @@ public class EntityImageTips extends AbstractEntityImage {
final Point2D positionOther = shapeOther.getPosition();
bibliotekon.getShape(getEntity());
final Position position = getPosition();
Direction direction = position.reverseDirection();
double height = 0;
for (Map.Entry<String, Display> ent : getEntity().getTips().entrySet()) {
final Display display = ent.getValue();
@ -133,14 +135,17 @@ public class EntityImageTips extends AbstractEntityImage {
final Dimension2D dim = opale.calculateDimension(stringBounder);
final Point2D pp1 = new Point2D.Double(0, dim.getHeight() / 2);
double x = positionOther.getX() - positionMe.getX();
if (position == Position.RIGHT) {
if (direction == Direction.RIGHT && x < 0) {
direction = direction.getInv();
}
if (direction == Direction.LEFT) {
x += memberPosition.getMaxX();
} else {
x += 4;
}
final double y = positionOther.getY() - positionMe.getY() - height + memberPosition.getCenterY();
final Point2D pp2 = new Point2D.Double(x, y);
opale.setOpale(position.reverseDirection(), pp1, pp2);
opale.setOpale(direction, pp1, pp2);
opale.drawU(ug);
ug = ug.apply(new UTranslate(0, dim.getHeight() + ySpacing));
height += dim.getHeight();

View File

@ -288,6 +288,62 @@ public class TikzGraphics {
cmd.add(sb.toString());
}
private void round(double r, double[] points) {
final StringBuilder sb = new StringBuilder("\\draw[");
if (color != null) {
sb.append("color=" + getColorName(color) + ",");
}
if (fillcolor != null) {
sb.append("fill=" + getColorName(fillcolor) + ",");
}
sb.append("line width=" + thickness + "pt]");
sb.append(" ");
int i = 0;
sb.append(couple(points[i++], points[i++]));
sb.append(" arc (180:270:" + format(r) + "pt) -- ");
sb.append(couple(points[i++], points[i++]));
sb.append(" -- ");
sb.append(couple(points[i++], points[i++]));
sb.append(" arc (270:360:" + format(r) + "pt) -- ");
sb.append(couple(points[i++], points[i++]));
sb.append(" -- ");
sb.append(couple(points[i++], points[i++]));
sb.append(" arc (0:90:" + format(r) + "pt) -- ");
sb.append(couple(points[i++], points[i++]));
sb.append(" -- ");
sb.append(couple(points[i++], points[i++]));
sb.append(" arc (90:180:" + format(r) + "pt) -- ");
sb.append(couple(points[i++], points[i++]));
sb.append(" -- ");
sb.append("cycle;");
cmd.add(sb.toString());
}
public void rectangleRound(double x, double y, double width, double height, double r) {
double[] points = new double[8 * 2];
points[0] = x;
points[1] = y + r;
points[2] = x + r;
points[3] = y;
points[4] = x + width - r;
points[5] = y;
points[6] = x + width;
points[7] = y + r;
points[8] = x + width;
points[9] = y + height - r;
points[10] = x + width - r;
points[11] = y + height;
points[12] = x + r;
points[13] = y + height;
points[14] = x;
points[15] = y + height - r;
round(r, points);
}
public void upath(double x, double y, UPath path) {
final StringBuilder sb = new StringBuilder("\\draw[color=" + getColorName(color) + ",line width=" + thickness
+ "pt] ");

View File

@ -189,11 +189,11 @@ public class Histogram implements TimeDrawing {
final UTranslate deltaY = new UTranslate(0, getFullDeltaY());
final UTranslate pos = new UTranslate(pt).compose(deltaY);
ug = ug.apply(pos);
final SymbolContext context = getContext();
final double height = -pt.getY();
if (height > 0) {
context.withForeColor(context.getBackColor()).apply(ug).draw(new URectangle(len, height));
}
// final SymbolContext context = getContext();
// final double height = -pt.getY();
// if (height > 0) {
// context.withForeColor(context.getBackColor()).apply(ug).draw(new URectangle(len, height));
// }
ug.draw(new ULine(len, 0));
}

View File

@ -35,6 +35,7 @@ import net.sourceforge.plantuml.ugraphic.UDriver;
import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.utils.MathUtils;
public class DriverRectangleTikz implements UDriver<TikzGraphics> {
@ -43,11 +44,16 @@ public class DriverRectangleTikz implements UDriver<TikzGraphics> {
final double width = rect.getWidth();
final double height = rect.getHeight();
final double r = MathUtils.min(rect.getRx(), rect.getRy(), width / 2, height / 2);
tikz.setFillColor(mapper.getMappedColor(param.getBackcolor()));
tikz.setStrokeColor(mapper.getMappedColor(param.getColor()));
tikz.setStrokeWidth(param.getStroke().getThickness(), param.getStroke().getDashTikz());
tikz.rectangle(x, y, width, height);
if (r == 0) {
tikz.rectangle(x, y, width, height);
} else {
tikz.rectangleRound(x, y, width, height, r);
}
}
}

View File

@ -48,6 +48,22 @@ public class MathUtils {
return max(max(a, b, c), max(d, e));
}
public static double min(double a, double b) {
return Math.min(a, b);
}
public static double min(double a, double b, double c) {
return min(min(a, b), c);
}
public static double min(double a, double b, double c, double d) {
return min(min(a, b), min(c, d));
}
public static double min(double a, double b, double c, double d, double e) {
return min(min(a, b, c), min(d, e));
}
public static double limitation(double v, double min, double max) {
if (min >= max) {
// assert false : "min="+min+" max="+max+" v="+v;

View File

@ -80,7 +80,7 @@ public class PSystemVersion extends AbstractPSystem {
} catch (IOException e) {
e.printStackTrace();
}
return null;
return new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
}
public static BufferedImage getCharlieImage() {
@ -92,7 +92,7 @@ public class PSystemVersion extends AbstractPSystem {
} catch (IOException e) {
e.printStackTrace();
}
return null;
return new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
}
public static BufferedImage getPlantumlSmallIcon() {
@ -104,7 +104,7 @@ public class PSystemVersion extends AbstractPSystem {
} catch (IOException e) {
e.printStackTrace();
}
return null;
return new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
}
private static BufferedImage transparentIcon;
@ -115,7 +115,7 @@ public class PSystemVersion extends AbstractPSystem {
}
final BufferedImage ico = getPlantumlSmallIcon();
if (ico == null) {
return null;
return new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
}
transparentIcon = new BufferedImage(ico.getWidth(), ico.getHeight(), BufferedImage.TYPE_INT_ARGB_PRE);
for (int i = 0; i < ico.getWidth(); i++) {

View File

@ -36,7 +36,7 @@ import java.util.Date;
public class Version {
public static int version() {
return 8056;
return 8057;
}
public static String versionString() {
@ -68,7 +68,7 @@ public class Version {
}
public static long compileTime() {
return 1487187608733L;
return 1488106743921L;
}
public static String compileTimeString() {