1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 10:59:01 +00:00

version 8032

This commit is contained in:
Arnaud Roques 2015-11-01 19:37:20 +01:00
parent 902ab3e908
commit 83478c0403
45 changed files with 431 additions and 205 deletions

View File

@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 17054 $ * Revision $Revision: 17433 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
@ -96,6 +96,7 @@ public enum ColorParam {
participantBorder(HtmlColorUtils.MY_RED, ColorType.LINE), participantBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
sequenceGroupBorder(HtmlColorUtils.BLACK, ColorType.LINE), sequenceGroupBorder(HtmlColorUtils.BLACK, ColorType.LINE),
sequenceGroupBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK), sequenceGroupBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK),
sequenceGroupBodyBackground(HtmlColorUtils.RED, true, ColorType.BACK),
sequenceReferenceBorder(HtmlColorUtils.BLACK, ColorType.LINE), sequenceReferenceBorder(HtmlColorUtils.BLACK, ColorType.LINE),
sequenceReferenceHeaderBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK), sequenceReferenceHeaderBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK),
sequenceReferenceBackground(HtmlColorUtils.WHITE, true, ColorType.BACK), sequenceReferenceBackground(HtmlColorUtils.WHITE, true, ColorType.BACK),

View File

@ -84,6 +84,8 @@ public interface ISkinParam extends ISkinSimple {
public boolean shadowing(); public boolean shadowing();
public boolean shadowingForNote(Stereotype stereotype);
public boolean shadowing2(SkinParameter skinParameter); public boolean shadowing2(SkinParameter skinParameter);
public PackageStyle getPackageStyle(); public PackageStyle getPackageStyle();

View File

@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 17125 $ * Revision $Revision: 17444 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
@ -78,22 +78,12 @@ public class SkinParam implements ISkinParam {
private static final String stereoPatternString = "\\<\\<(.*?)\\>\\>"; private static final String stereoPatternString = "\\<\\<(.*?)\\>\\>";
private static final Pattern stereoPattern = MyPattern.cmpile(stereoPatternString); private static final Pattern stereoPattern = MyPattern.cmpile(stereoPatternString);
// public SkinParam() {
//
// }
public static SkinParam noShadowing() { public static SkinParam noShadowing() {
final SkinParam result = new SkinParam(); final SkinParam result = new SkinParam();
result.setParam("shadowing", "false"); result.setParam("shadowing", "false");
return result; return result;
} }
// public SkinParam(String type) {
// if (type == null) {
// setParam("shadowing", "false");
// }
// }
static String cleanForKey(String key) { static String cleanForKey(String key) {
key = StringUtils.trin(StringUtils.goLowerCase(key)); key = StringUtils.trin(StringUtils.goLowerCase(key));
key = key.replaceAll("_|\\.|\\s", ""); key = key.replaceAll("_|\\.|\\s", "");
@ -452,6 +442,21 @@ public class SkinParam implements ISkinParam {
return true; return true;
} }
public boolean shadowingForNote(Stereotype stereotype) {
if (stereotype != null) {
checkStereotype(stereotype);
final String value2 = getValue("note" + "shadowing" + stereotype.getLabel(false));
if (value2 != null) {
return value2.equalsIgnoreCase("true");
}
}
final String value2 = getValue("note" + "shadowing");
if (value2 != null) {
return value2.equalsIgnoreCase("true");
}
return shadowing();
}
public boolean shadowing2(SkinParameter skinParameter) { public boolean shadowing2(SkinParameter skinParameter) {
if (skinParameter == null) { if (skinParameter == null) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();

View File

@ -52,6 +52,14 @@ public class SkinParamColors extends SkinParamDelegator {
return super.toString() + colors; return super.toString() + colors;
} }
@Override
public boolean shadowing() {
if (colors.getShadowing() == null) {
return super.shadowing();
}
return colors.getShadowing();
}
public HtmlColor getFontHtmlColor(FontParam param, Stereotype stereotype) { public HtmlColor getFontHtmlColor(FontParam param, Stereotype stereotype) {
final HtmlColor value = colors.getColor(ColorType.TEXT); final HtmlColor value = colors.getColor(ColorType.TEXT);
if (value == null) { if (value == null) {

View File

@ -229,4 +229,8 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getTabSize(); return skinParam.getTabSize();
} }
public boolean shadowingForNote(Stereotype stereotype) {
return shadowingForNote(stereotype);
}
} }

View File

@ -33,15 +33,13 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
public interface SpecificBackcolorable { public interface SpecificBackcolorable {
public Colors getColors(ISkinParam skinParam); public Colors getColors(ISkinParam skinParam);
public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color); // public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color);
public void setColors(Colors colors); public void setColors(Colors colors);

View File

@ -444,6 +444,11 @@ public class StringUtils {
return result.toString(); return result.toString();
} }
public static String manageTildeArobaseStart(String s) {
s = s.replaceAll("~@start", "@start");
return s;
}
public static String trinNoTrace(CharSequence s) { public static String trinNoTrace(CharSequence s) {
return s.toString().trim(); return s.toString().trim();
} }

View File

@ -44,7 +44,7 @@ public class UrlBuilder {
STRICT, AT_START, ANYWHERE, AT_END STRICT, AT_START, ANYWHERE, AT_END
} }
private static final String URL_PATTERN = "\\[\\[([%g][^%g]+[%g]|[^{}%s\\]\\[]*)(?:[%s]*\\{([^{}]+)\\})?(?:[%s]*([^\\]\\[]+))?\\]\\]"; private static final String URL_PATTERN = "\\[\\[([%g][^%g]+[%g]|[^{}%s\\]\\[]*)(?:[%s]*\\{((?:[^{}]|\\{[^{}]*\\})+)\\})?(?:[%s]*([^\\]\\[]+))?\\]\\]";
private final String topurl; private final String topurl;
private ModeUrl mode; private ModeUrl mode;
@ -54,6 +54,21 @@ public class UrlBuilder {
this.mode = mode; this.mode = mode;
} }
public static String multilineTooltip(String label) {
final Pattern p = MyPattern.cmpile("(?i)^(" + URL_PATTERN + ")?(.*)$");
final Matcher m = p.matcher(label);
if (m.matches() == false) {
return label;
}
String gr1 = m.group(1);
if (gr1 == null) {
return label;
}
final String gr2 = m.group(m.groupCount());
gr1 = gr1.replaceAll("\\\\n", "\n");
return gr1 + gr2;
}
public Url getUrl(String s) { public Url getUrl(String s) {
final Pattern p; final Pattern p;
if (mode == ModeUrl.STRICT) { if (mode == ModeUrl.STRICT) {

View File

@ -208,6 +208,11 @@ class FtileWhile extends AbstractFtile {
return getTranslateForWhile(stringBounder).getTranslated(geo.getPointOut()); return getTranslateForWhile(stringBounder).getTranslated(geo.getPointOut());
} }
private double getBottom(final StringBounder stringBounder) {
final FtileGeometry geo = whileBlock.calculateDimension(stringBounder);
return getTranslateForWhile(stringBounder).getDy() + geo.getHeight();
}
private Point2D getP2(final StringBounder stringBounder) { private Point2D getP2(final StringBounder stringBounder) {
return getTranslateDiamond1(stringBounder).getTranslated(new Point2D.Double(0, 0)); return getTranslateDiamond1(stringBounder).getTranslated(new Point2D.Double(0, 0));
} }
@ -230,16 +235,17 @@ class FtileWhile extends AbstractFtile {
final double y2 = p2.getY() + dimDiamond1.getOutY() / 2; final double y2 = p2.getY() + dimDiamond1.getOutY() / 2;
snake.addPoint(x1, y1); snake.addPoint(x1, y1);
snake.addPoint(x1, y1 + Diamond.diamondHalfSize); final double y1bis = Math.max(y1, getBottom(stringBounder)) + Diamond.diamondHalfSize;
snake.addPoint(x1, y1bis);
final double xx = dimTotal.getWidth(); final double xx = dimTotal.getWidth();
snake.addPoint(xx, y1 + Diamond.diamondHalfSize); snake.addPoint(xx, y1bis);
snake.addPoint(xx, y2); snake.addPoint(xx, y2);
snake.addPoint(x2, y2); snake.addPoint(x2, y2);
snake.emphasizeDirection(Direction.UP); snake.emphasizeDirection(Direction.UP);
ug.draw(snake); ug.draw(snake);
ug.apply(new UTranslate(x1, y1 + Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize)); ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Diamond.diamondHalfSize));
// ug = ug.apply(new UChangeColor(endInlinkColor)).apply(new UChangeBackColor(endInlinkColor)); // ug = ug.apply(new UChangeColor(endInlinkColor)).apply(new UChangeBackColor(endInlinkColor));
// ug.apply(new UTranslate(xx, (y1 + y2) / 2)).draw(Arrows.asToUp()); // ug.apply(new UTranslate(xx, (y1 + y2) / 2)).draw(Arrows.asToUp());

View File

@ -53,7 +53,7 @@ public class BlocLines implements Iterable<CharSequence> {
} }
private BlocLines(List<? extends CharSequence> lines) { private BlocLines(List<? extends CharSequence> lines) {
this.lines = Collections.unmodifiableList(lines); this.lines = (List<CharSequence>) Collections.unmodifiableList(lines);
} }
public Display toDisplay() { public Display toDisplay() {
@ -248,4 +248,12 @@ public class BlocLines implements Iterable<CharSequence> {
return new BlocLines(copy); return new BlocLines(copy);
} }
public BlocLines removeInnerComments() {
final List<CharSequence> copy = new ArrayList<CharSequence>();
for (CharSequence cs : lines) {
copy.add(MyPattern.removeAll(cs, CommandMultilinesComment.INNER_COMMENT));
}
return new BlocLines(copy);
}
} }

View File

@ -37,9 +37,10 @@ import net.sourceforge.plantuml.core.Diagram;
public class CommandMultilinesComment extends CommandMultilines<Diagram> { public class CommandMultilinesComment extends CommandMultilines<Diagram> {
public static final String COMMENT_MULTILINE_END = "(?i)^.*[%q]/[%s]*$"; public static final String COMMENT_MULTILINE_START = "(?i)^[%s]*/[%q]([^%q]|[%q][^/])*$";
public static final String COMMENT_MULTILINE_START = "(?i)^[%s]*/[%q].*$"; public static final String COMMENT_MULTILINE_END = "(?i)^([^%q]|[%q][^/])*[%q]/[%s]*$";
public static final String COMMENT_SINGLE_LINE = "(?i)^[%s]*([%q].*||/[%q].*[%q]/[%s]*)$"; public static final String COMMENT_SINGLE_LINE = "(?i)^[%s]*([%q].*||/[%q].*[%q]/[%s]*)$";
public static final String INNER_COMMENT = "/[%q].*?[%q]/";
public CommandMultilinesComment() { public CommandMultilinesComment() {
super(COMMENT_MULTILINE_START); super(COMMENT_MULTILINE_START);

View File

@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 16447 $ * Revision $Revision: 17468 $
* *
*/ */
package net.sourceforge.plantuml.command; package net.sourceforge.plantuml.command;
@ -64,6 +64,7 @@ public abstract class SingleLineCommand<S extends Diagram> implements Command<S>
if (lines.size() != 1) { if (lines.size() != 1) {
return CommandControl.NOT_OK; return CommandControl.NOT_OK;
} }
lines = lines.removeInnerComments();
if (isCommandForbidden()) { if (isCommandForbidden()) {
return CommandControl.NOT_OK; return CommandControl.NOT_OK;
} }
@ -87,6 +88,7 @@ public abstract class SingleLineCommand<S extends Diagram> implements Command<S>
if (lines.size() != 1) { if (lines.size() != 1) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
lines = lines.removeInnerComments();
final String line = StringUtils.trin(lines.getFirst499()); final String line = StringUtils.trin(lines.getFirst499());
if (isForbidden(line)) { if (isForbidden(line)) {
return CommandExecutionResult.error("Forbidden line " + line); return CommandExecutionResult.error("Forbidden line " + line);

View File

@ -62,6 +62,7 @@ public abstract class SingleLineCommand2<S extends Diagram> implements Command<S
if (lines.size() != 1) { if (lines.size() != 1) {
return CommandControl.NOT_OK; return CommandControl.NOT_OK;
} }
lines = lines.removeInnerComments();
if (isCommandForbidden()) { if (isCommandForbidden()) {
return CommandControl.NOT_OK; return CommandControl.NOT_OK;
} }
@ -84,6 +85,7 @@ public abstract class SingleLineCommand2<S extends Diagram> implements Command<S
if (lines.size() != 1) { if (lines.size() != 1) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
lines = lines.removeInnerComments();
final String line = StringUtils.trin(lines.getFirst499()); final String line = StringUtils.trin(lines.getFirst499());
if (isForbidden(line)) { if (isForbidden(line)) {
return CommandExecutionResult.error("Forbidden line " + line); return CommandExecutionResult.error("Forbidden line " + line);

View File

@ -167,10 +167,7 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma
final IEntity note = diagram final IEntity note = diagram
.createLeaf(UniqueSequence.getCode("GMN"), strings.toDisplay(), LeafType.NOTE, null); .createLeaf(UniqueSequence.getCode("GMN"), strings.toDisplay(), LeafType.NOTE, null);
Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet()); final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
// System.err.println("colors=" + colors);
// note.setSpecificColorTOBEREMOVED(ColorType.BACK,
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
note.setColors(colors); note.setColors(colors);
if (url != null) { if (url != null) {
note.addUrl(url); note.addUrl(url);

View File

@ -33,6 +33,8 @@
*/ */
package net.sourceforge.plantuml.command.note.sequence; package net.sourceforge.plantuml.command.note.sequence;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
@ -44,8 +46,10 @@ import net.sourceforge.plantuml.command.note.SingleMultiFactoryCommand;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.Note; import net.sourceforge.plantuml.sequencediagram.Note;
import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteStyle; import net.sourceforge.plantuml.sequencediagram.NoteStyle;
@ -58,10 +62,13 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
return new RegexConcat(// return new RegexConcat(//
new RegexLeaf("^"), // new RegexLeaf("^"), //
new RegexLeaf("VMERGE", "(/)?[%s]*"), // new RegexLeaf("VMERGE", "(/)?[%s]*"), //
new RegexLeaf("STYLE", "(note|hnote|rnote)[%s]+"), // new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("POSITION", "(right|left|over)[%s]+"), // new RegexLeaf("POSITION", "(right|left|over)[%s]+"), //
new RegexLeaf("PARTICIPANT", "(?:of[%s]+)?([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), // new RegexLeaf("PARTICIPANT", "(?:of[%s]+)?([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), //
ColorParser.exp1(), // color().getRegex(), //
new RegexLeaf("$")); new RegexLeaf("$"));
} }
@ -69,15 +76,22 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
return new RegexConcat(// return new RegexConcat(//
new RegexLeaf("^"), // new RegexLeaf("^"), //
new RegexLeaf("VMERGE", "(/)?[%s]*"), // new RegexLeaf("VMERGE", "(/)?[%s]*"), //
new RegexLeaf("STYLE", "(note|hnote|rnote)[%s]+"), // new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("POSITION", "(right|left|over)[%s]+"), // new RegexLeaf("POSITION", "(right|left|over)[%s]+"), //
new RegexLeaf("PARTICIPANT", "(?:of[%s])?([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), // new RegexLeaf("PARTICIPANT", "(?:of[%s])?([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), //
ColorParser.exp1(), // color().getRegex(), //
new RegexLeaf("[%s]*:[%s]*"), // new RegexLeaf("[%s]*:[%s]*"), //
new RegexLeaf("NOTE", "(.*)"), // new RegexLeaf("NOTE", "(.*)"), //
new RegexLeaf("$")); new RegexLeaf("$"));
} }
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}
public Command<SequenceDiagram> createMultiLine(boolean withBracket) { public Command<SequenceDiagram> createMultiLine(boolean withBracket) {
return new CommandMultilines2<SequenceDiagram>(getRegexConcatMultiLine(), return new CommandMultilines2<SequenceDiagram>(getRegexConcatMultiLine(),
MultilinesStrategy.KEEP_STARTING_QUOTE) { MultilinesStrategy.KEEP_STARTING_QUOTE) {
@ -116,7 +130,15 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
if (strings.size() > 0) { if (strings.size() > 0) {
final boolean tryMerge = arg.get("VMERGE", 0) != null; final boolean tryMerge = arg.get("VMERGE", 0) != null;
final Note note = new Note(p, position, strings.toDisplay()); final Note note = new Note(p, position, strings.toDisplay());
note.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final String stereotypeString = arg.get("STEREO", 0);
if (stereotypeString != null) {
final Stereotype stereotype = new Stereotype(stereotypeString);
note.setStereotype(stereotype);
colors = colors.applyStereotypeForNote(stereotype, diagram.getSkinParam(), FontParam.NOTE,
ColorParam.noteBackground, ColorParam.noteBorder);
}
note.setColors(colors);
note.setStyle(NoteStyle.getNoteStyle(arg.get("STYLE", 0))); note.setStyle(NoteStyle.getNoteStyle(arg.get("STYLE", 0)));
diagram.addNote(note, tryMerge); diagram.addNote(note, tryMerge);
} }

View File

@ -46,6 +46,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.Note; import net.sourceforge.plantuml.sequencediagram.Note;
import net.sourceforge.plantuml.sequencediagram.NoteStyle; import net.sourceforge.plantuml.sequencediagram.NoteStyle;
import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.Participant;
@ -60,7 +61,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
new RegexLeaf("STYLE", "(note|hnote|rnote)[%s]+over[%s]+"), // new RegexLeaf("STYLE", "(note|hnote|rnote)[%s]+over[%s]+"), //
new RegexLeaf("P1", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*\\,[%s]*"), // new RegexLeaf("P1", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*\\,[%s]*"), //
new RegexLeaf("P2", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), // new RegexLeaf("P2", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), //
ColorParser.exp1(), // color().getRegex(), //
new RegexLeaf("$") // new RegexLeaf("$") //
); );
} }
@ -72,12 +73,17 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
new RegexLeaf("STYLE", "(note|hnote|rnote)[%s]+over[%s]+"), // new RegexLeaf("STYLE", "(note|hnote|rnote)[%s]+over[%s]+"), //
new RegexLeaf("P1", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*\\,[%s]*"), // new RegexLeaf("P1", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*\\,[%s]*"), //
new RegexLeaf("P2", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), // new RegexLeaf("P2", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), //
ColorParser.exp1(), // color().getRegex(), //
new RegexLeaf("[%s]*:[%s]*"), // new RegexLeaf("[%s]*:[%s]*"), //
new RegexLeaf("NOTE", "(.*)"), // new RegexLeaf("NOTE", "(.*)"), //
new RegexLeaf("$")); new RegexLeaf("$"));
} }
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}
public Command<SequenceDiagram> createSingleLine() { public Command<SequenceDiagram> createSingleLine() {
return new SingleLineCommand2<SequenceDiagram>(getRegexConcatSingleLine()) { return new SingleLineCommand2<SequenceDiagram>(getRegexConcatSingleLine()) {
@ -119,7 +125,9 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
if (lines.size() > 0) { if (lines.size() > 0) {
final boolean tryMerge = line0.get("VMERGE", 0) != null; final boolean tryMerge = line0.get("VMERGE", 0) != null;
final Note note = new Note(p1, p2, lines.toDisplay()); final Note note = new Note(p1, p2, lines.toDisplay());
note.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0))); final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
note.setColors(colors);
// note.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
note.setStyle(NoteStyle.getNoteStyle(line0.get("STYLE", 0))); note.setStyle(NoteStyle.getNoteStyle(line0.get("STYLE", 0)));
diagram.addNote(note, tryMerge); diagram.addNote(note, tryMerge);
} }

View File

@ -91,12 +91,16 @@ public abstract class MyPattern {
return p; return p;
} }
// public static boolean mtches(String input, String regex) { // public static boolean mtches(String input, String regex) {
// return cmpile(regex).matcher(input).matches(); // return cmpile(regex).matcher(input).matches();
// } // }
// //
public static boolean mtches(CharSequence input, String regex) { public static boolean mtches(CharSequence input, String regex) {
return cmpile(regex).matcher(input).matches(); return cmpile(regex).matcher(input).matches();
} }
public static CharSequence removeAll(CharSequence src, String regex) {
return src.toString().replaceAll(transform(regex), "");
}
} }

View File

@ -118,8 +118,8 @@ public class AtomText implements Atom {
this.marginLeft = marginLeft; this.marginLeft = marginLeft;
this.marginRight = marginRight; this.marginRight = marginRight;
// this.text = StringUtils.showComparatorCharacters(StringUtils.manageBackslash(text)); // this.text = StringUtils.showComparatorCharacters(StringUtils.manageBackslash(text));
this.text = StringUtils.manageUnicodeNotationUplus(StringUtils.manageAmpDiese(StringUtils this.text = StringUtils.manageTildeArobaseStart(StringUtils.manageUnicodeNotationUplus(StringUtils
.showComparatorCharacters(CharHidder.unhide(text)))); .manageAmpDiese(StringUtils.showComparatorCharacters(CharHidder.unhide(text)))));
this.fontConfiguration = style; this.fontConfiguration = style;
this.url = url; this.url = url;
} }

View File

@ -58,7 +58,7 @@ import net.sourceforge.plantuml.version.PSystemVersion;
public class PSystemDonors extends AbstractPSystem { public class PSystemDonors extends AbstractPSystem {
public static final String DONORS = "UDfTKi6IsZ0ClUihVCwq7v4b7Jg1tUr0syFUHA8b0cEbjaERV7sLROCDEbaZFUaz-PMs-1_auHj5ygPqKHnZ0z-fI24Ns4fAVO1oWU81rZwLQ8Gz7J14HcTUf7DGkbQyMGl5YURd-xjsBEteO8lP8XUXuYLX2sKQBLVO3ud226ikxiC9r0lB8S0-Kj-HCokHNlLLonuAiBayGCN3IYmxivCX4DJ3GxquYGfPafxXEMEDbppLLQMbF-XQFUUgOvrwH3-gqjrDjZl2Iyu-Jl1g-Qg0YfkpChzLsC6NS1ljCX85NQ6QBXpzQBROIOjGpqT_wr37Ptq5sVHT6kTHp-GmQf_oKrxrF_9qlbFbshlq0yawo2hirKUUu6igjmBFt7HapHEo7NC5Tih9XF18hIPqdsjiVWqKJ3KSFEhNsYJ_fvmYDPtPU0oOA1r97PjzuE_PQDfYDdBbt3SVplcHz3F2BlFolE9EvqdHVUOoES-7UXAF3ct_oRnHHEa3_0KmFDNM"; public static final String DONORS = "UDfTKi6IsZ0ClUihVCwq7v4b7Jg1tUr0syFUHA8b0cEbjaERV7sLROCDEbaZFUaz-PMs-1_auHj5ygPqKHnZ0z-fI24Ns4fAVO1oWU81rZwLQ8Gz7J14HcTUf7DGkbQyMGl5YURd-xjsBEteO8lP8XUXuYLX2sKQBLVO3ud226ikxiC9r0lB8S0-Kj-HCokHNlLLonuAiBayGCN3IYmxivCX4DJ3GxquYGfPafxXEMEDbppLLQMbF-XQFUUgOvrwH3-gqjrDjZl2Iyu-Jl1g-Qg0YfkpChzLsC6NS1ljCX85NQ6QBXpzQBROIOjGpqT_wr37Ptq5sVHT6kTHp-GmQf_oKrxrF_9qlbFbshlq0yawo2hirKUUu6igjmBFt7HapHEo7NC5Tih9XF18hIPqdsjiVWqKJ3KSFEhNsYJ_fvmYDPtPU0oOA1r97PjzuE_PQDfYDdBbt3SVplcHz3F2BlFolE9EvqdHVUOoES-7UXAF3ct_oRnHHEa3x5Gl-jPiUFvf-0laPjiQ";
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
final GraphicStrings result = getGraphicStrings(); final GraphicStrings result = getGraphicStrings();

View File

@ -35,15 +35,14 @@ package net.sourceforge.plantuml.graphic.color;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.IHtmlColorSet;
public class ColorParser { public class ColorParser {
private static final String COLOR_REGEXP = "#\\w+[-\\\\|/]?\\w+"; private static final String COLOR_REGEXP = "#\\w+[-\\\\|/]?\\w+";
private static final String PART2 = "#(?:\\w+[-\\\\|/]?\\w+;)?(?:(?:text|back|header|line|line\\.dashed|line\\.dotted|line\\.bold)(?::\\w+[-\\\\|/]?\\w+)?(?:;|(?![\\w;:.])))+"; private static final String PART2 = "#(?:\\w+[-\\\\|/]?\\w+;)?(?:(?:text|back|header|line|line\\.dashed|line\\.dotted|line\\.bold|shadowing)(?::\\w+[-\\\\|/]?\\w+)?(?:;|(?![\\w;:.])))+";
private static final String COLORS_REGEXP = "(?:" + COLOR_REGEXP + ")|(?:" + PART2 + ")"; private static final String COLORS_REGEXP = "(?:" + PART2 + ")|(?:" + COLOR_REGEXP + ")";
private final RegexLeaf regex; private final RegexLeaf regex;
private final String name; private final String name;
@ -55,18 +54,6 @@ public class ColorParser {
this.mainType = mainType; this.mainType = mainType;
} }
public HtmlColor getLegacyColoe(RegexResult arg, IHtmlColorSet set) {
if (mainType != null) {
throw new IllegalStateException();
}
final String data = arg.get("COLOR", 0);
if (data != null && data.matches(PART2)) {
throw new IllegalStateException();
}
final HtmlColor result = set.getColorIfValid(data);
return result;
}
public Colors getColor(RegexResult arg, IHtmlColorSet set) { public Colors getColor(RegexResult arg, IHtmlColorSet set) {
if (mainType == null) { if (mainType == null) {
throw new IllegalStateException(); throw new IllegalStateException();
@ -107,10 +94,6 @@ public class ColorParser {
return new RegexLeaf("COLOR", "(?:(" + COLOR_REGEXP + "):)?"); return new RegexLeaf("COLOR", "(?:(" + COLOR_REGEXP + "):)?");
} }
public static RegexLeaf exp5() {
return new RegexLeaf("COLOR", "(?::?(" + COLOR_REGEXP + "))?");
}
public static RegexLeaf exp6() { public static RegexLeaf exp6() {
return new RegexLeaf("COLOR", "(?:(" + COLOR_REGEXP + ")\\|)?"); return new RegexLeaf("COLOR", "(?:(" + COLOR_REGEXP + ")\\|)?");
} }

View File

@ -38,6 +38,7 @@ import java.util.Map;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParamColors; import net.sourceforge.plantuml.SkinParamColors;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
@ -52,6 +53,7 @@ public class Colors {
private final Map<ColorType, HtmlColor> map = new EnumMap<ColorType, HtmlColor>(ColorType.class); private final Map<ColorType, HtmlColor> map = new EnumMap<ColorType, HtmlColor>(ColorType.class);
private LinkStyle lineStyle = null; private LinkStyle lineStyle = null;
private Boolean shadowing = null;
@Override @Override
public String toString() { public String toString() {
@ -83,9 +85,15 @@ public class Colors {
map.put(mainType, set.getColorIfValid(s)); map.put(mainType, set.getColorIfValid(s));
} }
} else { } else {
final ColorType key = ColorType.getType(s.substring(0, x)); final String name = s.substring(0, x);
final HtmlColor color = set.getColorIfValid(s.substring(x + 1)); final String value = s.substring(x + 1);
map.put(key, color); if (name.equalsIgnoreCase("shadowing")) {
this.shadowing = value.equalsIgnoreCase("true");
} else {
final ColorType key = ColorType.getType(name);
final HtmlColor color = set.getColorIfValid(value);
map.put(key, color);
}
} }
} }
if (data.contains("line.dashed")) { if (data.contains("line.dashed")) {
@ -126,6 +134,9 @@ public class Colors {
// } // }
public Colors add(ColorType type, HtmlColor color) { public Colors add(ColorType type, HtmlColor color) {
if (color == null) {
return this;
}
final Colors result = copy(); final Colors result = copy();
result.map.put(type, color); result.map.put(type, color);
return result; return result;
@ -186,4 +197,40 @@ public class Colors {
return add(colorType, colors); return add(colorType, colors);
} }
private Colors applyFontParamStereotype(Stereotype stereotype, ISkinParam skinParam, FontParam param) {
if (stereotype == null) {
throw new IllegalArgumentException();
}
if (param == null) {
return this;
}
final ColorType colorType = ColorType.TEXT;
if (getColor(colorType) != null) {
return this;
}
final HtmlColor col = skinParam.getFontHtmlColor(param, stereotype);
return add(colorType, col);
}
public Colors applyStereotypeForNote(Stereotype stereotype, ISkinParam skinParam, FontParam fontParam,
ColorParam... params) {
if (stereotype == null) {
throw new IllegalArgumentException();
}
if (params == null) {
throw new IllegalArgumentException();
}
Colors result = this;
for (ColorParam param : params) {
result = result.applyStereotype(stereotype, skinParam, param);
}
result = result.applyFontParamStereotype(stereotype, skinParam, fontParam);
result.shadowing = skinParam.shadowingForNote(stereotype);
return result;
}
public Boolean getShadowing() {
return shadowing;
}
} }

View File

@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 17316 $ * Revision $Revision: 17496 $
* *
*/ */
package net.sourceforge.plantuml.preproc; package net.sourceforge.plantuml.preproc;
@ -102,7 +102,7 @@ public class Defines {
int i = 1; int i = 1;
while (st.hasMoreTokens()) { while (st.hasMoreTokens()) {
regex.append("(?:(?:\\s*\"([^\"]*)\"\\s*)|(?:\\s*'([^']*)'\\s*)|\\s*([^,]*))"); regex.append("(?:(?:\\s*\"([^\"]*)\"\\s*)|(?:\\s*'([^']*)'\\s*)|\\s*" + "((?:\\([^()]*\\)|[^,])*?)" + ")");
final String var1 = st.nextToken(); final String var1 = st.nextToken();
final String var2 = "(##" + var1 + "\\b)|(\\b" + var1 + "##)|(\\b" + var1 + "\\b)"; final String var2 = "(##" + var1 + "\\b)|(\\b" + var1 + "##)|(\\b" + var1 + "\\b)";
newValue = newValue.replaceAll(var2, "\\$" + i + "\\$" + (i + 1) + "\\$" + (i + 2)); newValue = newValue.replaceAll(var2, "\\$" + i + "\\$" + (i + 1) + "\\$" + (i + 2));

View File

@ -40,6 +40,7 @@ import java.util.regex.Pattern;
import net.sourceforge.plantuml.CharSequence2; import net.sourceforge.plantuml.CharSequence2;
import net.sourceforge.plantuml.CharSequence2Impl; import net.sourceforge.plantuml.CharSequence2Impl;
import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.utils.StartUtils;
public class UncommentReadLine implements ReadLine { public class UncommentReadLine implements ReadLine {
@ -51,8 +52,8 @@ public class UncommentReadLine implements ReadLine {
public UncommentReadLine(ReadLine source) { public UncommentReadLine(ReadLine source) {
this.raw = source; this.raw = source;
this.start = MyPattern.cmpile("(?i)((?:\\W|\\<[^<>]*\\>)*)@start"); this.start = MyPattern.cmpile(StartUtils.START_PATTERN);
this.unpause = MyPattern.cmpile("(?i)((?:\\W|\\<[^<>]*\\>)*)@unpause"); this.unpause = MyPattern.cmpile(StartUtils.PAUSE_PATTERN);
} }
public CharSequence2 readLine() throws IOException { public CharSequence2 readLine() throws IOException {

View File

@ -206,7 +206,7 @@ public class Englober {
} }
public Real getMaxX(StringBounder stringBounder) { public Real getMaxX(StringBounder stringBounder) {
return getX2(); return getX2().addFixed(10);
} }

View File

@ -28,20 +28,18 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 17004 $ * Revision $Revision: 17479 $
* *
*/ */
package net.sourceforge.plantuml.sequencediagram; package net.sourceforge.plantuml.sequencediagram;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParamBackcolored;
import net.sourceforge.plantuml.SpecificBackcolorable; import net.sourceforge.plantuml.SpecificBackcolorable;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl; import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
public class Note extends AbstractEvent implements Event, SpecificBackcolorable { public class Note extends AbstractEvent implements Event, SpecificBackcolorable {
@ -54,6 +52,8 @@ public class Note extends AbstractEvent implements Event, SpecificBackcolorable
private final NotePosition position; private final NotePosition position;
private NoteStyle style = NoteStyle.NORMAL; private NoteStyle style = NoteStyle.NORMAL;
// private Stereotype stereotype;
private final Url url; private final Url url;
public Note(Participant p, NotePosition position, Display strings) { public Note(Participant p, NotePosition position, Display strings) {
@ -102,11 +102,11 @@ public class Note extends AbstractEvent implements Event, SpecificBackcolorable
return colors; return colors;
} }
public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) { // public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) {
if (color != null) { // if (color != null) {
this.colors = colors.add(type, color); // this.colors = colors.add(type, color);
} // }
} // }
private Colors colors = Colors.empty(); private Colors colors = Colors.empty();
@ -134,8 +134,18 @@ public class Note extends AbstractEvent implements Event, SpecificBackcolorable
this.style = style; this.style = style;
} }
public SkinParamBackcolored getSkinParamBackcolored(ISkinParam skinParam) { public ISkinParam getSkinParamBackcolored(ISkinParam skinParam) {
return new SkinParamBackcolored(skinParam, getColors(skinParam).getColor(ColorType.BACK)); // return new SkinParamBackcolored(skinParam, getColors(skinParam).getColor(ColorType.BACK));
return colors.mute(skinParam);
}
public void setStereotype(Stereotype stereotype) {
// this.stereotype = stereotype;
}
@Override
public String toString() {
return super.toString() + " " + strings;
} }
} }

View File

@ -34,6 +34,7 @@
package net.sourceforge.plantuml.sequencediagram; package net.sourceforge.plantuml.sequencediagram;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -66,4 +67,8 @@ public class Notes extends AbstractEvent implements Event, Iterable<Note> {
public Note get(int i) { public Note get(int i) {
return notes.get(i); return notes.get(i);
} }
public List<Note> asList() {
return Collections.unmodifiableList(notes);
}
} }

View File

@ -43,6 +43,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Stack; import java.util.Stack;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.OptionFlags;
@ -129,6 +130,7 @@ public class SequenceDiagram extends UmlDiagram {
} }
public void addNote(Note n, boolean tryMerge) { public void addNote(Note n, boolean tryMerge) {
// this.lastEventWithDeactivate = null;
if (tryMerge && events.size() > 0) { if (tryMerge && events.size() > 0) {
final Event last = events.get(events.size() - 1); final Event last = events.get(events.size() - 1);
if (last instanceof Note) { if (last instanceof Note) {
@ -272,6 +274,9 @@ public class SequenceDiagram extends UmlDiagram {
if (type != GroupingType.START && openGroupings.size() == 0) { if (type != GroupingType.START && openGroupings.size() == 0) {
return false; return false;
} }
if (backColorGeneral == null) {
backColorGeneral = getSkinParam().getHtmlColor(ColorParam.sequenceGroupBodyBackground, null, false);
}
final GroupingStart top = openGroupings.size() > 0 ? openGroupings.get(0) : null; final GroupingStart top = openGroupings.size() > 0 ? openGroupings.get(0) : null;

View File

@ -36,6 +36,7 @@ package net.sourceforge.plantuml.sequencediagram.command;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass; import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.SingleLineCommand2;
@ -167,7 +168,8 @@ public class CommandArrow extends SingleLineCommand2<SequenceDiagram> {
if (arg.get("MESSAGE", 0) == null) { if (arg.get("MESSAGE", 0) == null) {
labels = Display.create(""); labels = Display.create("");
} else { } else {
labels = Display.getWithNewlines(arg.get("MESSAGE", 0)); final String message = UrlBuilder.multilineTooltip(arg.get("MESSAGE", 0));
labels = Display.getWithNewlines(message);
} }
ArrowConfiguration config = hasDressing1 && hasDressing2 ? ArrowConfiguration.withDirectionBoth() ArrowConfiguration config = hasDressing1 && hasDressing2 ? ArrowConfiguration.withDirectionBoth()

View File

@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 12235 $ * Revision $Revision: 17359 $
* *
*/ */
package net.sourceforge.plantuml.sequencediagram.graphic; package net.sourceforge.plantuml.sequencediagram.graphic;
@ -89,7 +89,11 @@ class ArrowAndNoteBox extends Arrow implements InGroupable {
public double getPreferredWidth(StringBounder stringBounder) { public double getPreferredWidth(StringBounder stringBounder) {
double w = arrow.getPreferredWidth(stringBounder); double w = arrow.getPreferredWidth(stringBounder);
w = Math.max(w, arrow.getActualWidth(stringBounder)); w = Math.max(w, arrow.getActualWidth(stringBounder));
return w + noteBox.getPreferredWidth(stringBounder); double result = w + noteBox.getPreferredWidth(stringBounder);
if (noteBox.getNotePosition() == NotePosition.RIGHT) {
result += noteBox.getRightShift(arrow.getStartingY());
}
return result;
} }
@Override @Override

View File

@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 12235 $ * Revision $Revision: 17359 $
* *
*/ */
package net.sourceforge.plantuml.sequencediagram.graphic; package net.sourceforge.plantuml.sequencediagram.graphic;
@ -74,6 +74,13 @@ final class NoteBox extends GraphicalElement implements InGroupable {
this.comp = comp; this.comp = comp;
} }
public double getRightShift(double y) {
if (p1 == null) {
return 0;
}
return p1.getLifeLine().getRightShift(y) + 5;
}
@Override @Override
final public double getPreferredWidth(StringBounder stringBounder) { final public double getPreferredWidth(StringBounder stringBounder) {
final double preferredWidth = comp.getPreferredWidth(stringBounder); final double preferredWidth = comp.getPreferredWidth(stringBounder);
@ -98,8 +105,8 @@ final class NoteBox extends GraphicalElement implements InGroupable {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
final double xStart = getStartingX(stringBounder); final double xStart = getStartingX(stringBounder);
ug = ug.apply(new UTranslate(xStart, getStartingY())); ug = ug.apply(new UTranslate(xStart, getStartingY()));
final Dimension2D dimensionToUse = new Dimension2DDouble(getPreferredWidth(stringBounder), comp final Dimension2D dimensionToUse = new Dimension2DDouble(getPreferredWidth(stringBounder),
.getPreferredHeight(stringBounder)); comp.getPreferredHeight(stringBounder));
if (url != null) { if (url != null) {
ug.startUrl(url); ug.startUrl(url);
} }
@ -131,8 +138,8 @@ final class NoteBox extends GraphicalElement implements InGroupable {
private SegmentColored getSegment(StringBounder stringBounder) { private SegmentColored getSegment(StringBounder stringBounder) {
final SegmentColored segment = p1.getLiveThicknessAt(stringBounder, getStartingY()); final SegmentColored segment = p1.getLiveThicknessAt(stringBounder, getStartingY());
final SegmentColored segment2 = p1.getLiveThicknessAt(stringBounder, getStartingY() final SegmentColored segment2 = p1.getLiveThicknessAt(stringBounder,
+ comp.getPreferredHeight(stringBounder)); getStartingY() + comp.getPreferredHeight(stringBounder));
return segment.merge(segment2); return segment.merge(segment2);
} }
@ -156,4 +163,8 @@ final class NoteBox extends GraphicalElement implements InGroupable {
return url; return url;
} }
public NotePosition getNotePosition() {
return position;
}
} }

View File

@ -40,13 +40,16 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.real.Real;
import net.sourceforge.plantuml.sequencediagram.Event; import net.sourceforge.plantuml.sequencediagram.Event;
import net.sourceforge.plantuml.sequencediagram.MessageExo; import net.sourceforge.plantuml.sequencediagram.MessageExo;
import net.sourceforge.plantuml.sequencediagram.MessageExoType;
import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.ArrowComponent; import net.sourceforge.plantuml.skin.ArrowComponent;
import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.skin.ArrowDecoration;
import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin; import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.skin.rose.ComponentRoseArrow;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -95,6 +98,22 @@ public class CommunicationExoTile implements TileWithUpdateStairs {
x2 += CommunicationTile.LIVE_DELTA_SIZE * (level - 2); x2 += CommunicationTile.LIVE_DELTA_SIZE * (level - 2);
} }
} }
final ArrowConfiguration arrowConfiguration = message.getArrowConfiguration();
final MessageExoType type = message.getType();
if (arrowConfiguration.getDecoration1() == ArrowDecoration.CIRCLE && type == MessageExoType.FROM_LEFT) {
x1 += ComponentRoseArrow.diamCircle / 2 + 2;
}
if (arrowConfiguration.getDecoration2() == ArrowDecoration.CIRCLE && type == MessageExoType.TO_LEFT) {
x1 += ComponentRoseArrow.diamCircle / 2 + 2;
}
if (arrowConfiguration.getDecoration2() == ArrowDecoration.CIRCLE && type == MessageExoType.TO_RIGHT) {
x2 -= ComponentRoseArrow.diamCircle / 2 + 2;
}
if (arrowConfiguration.getDecoration1() == ArrowDecoration.CIRCLE && type == MessageExoType.FROM_RIGHT) {
x2 -= ComponentRoseArrow.diamCircle / 2 + 2;
}
final Area area = new Area(x2 - x1, dim.getHeight()); final Area area = new Area(x2 - x1, dim.getHeight());
ug = ug.apply(new UTranslate(x1, 0)); ug = ug.apply(new UTranslate(x1, 0));
comp.drawU(ug, area, (Context2D) ug); comp.drawU(ug, area, (Context2D) ug);

View File

@ -37,7 +37,6 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.real.Real;
@ -50,9 +49,7 @@ import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.skin.Skin; import net.sourceforge.plantuml.skin.Skin;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
public class CommunicationTile implements TileWithUpdateStairs, TileWithCallbackY { public class CommunicationTile implements TileWithUpdateStairs, TileWithCallbackY {
@ -184,26 +181,25 @@ public class CommunicationTile implements TileWithUpdateStairs, TileWithCallback
final Dimension2D dim = comp.getPreferredDimension(stringBounder); final Dimension2D dim = comp.getPreferredDimension(stringBounder);
final double width = dim.getWidth(); final double width = dim.getWidth();
// if (isSelf()) { Real point1 = getPoint1(stringBounder);
// final LivingSpace next = livingSpace1.getNext(); Real point2 = getPoint2(stringBounder);
// if (next != null) { if (isReverse(stringBounder)) {
// next.getPosB().ensureBiggerThan(getMaxX(stringBounder)); final int level1 = livingSpace1.getLevelAt(this, EventsHistoryMode.IGNORE_FUTURE_DEACTIVATE);
// } final int level2 = livingSpace2.getLevelAt(this, EventsHistoryMode.IGNORE_FUTURE_DEACTIVATE);
// } else { if (level1 > 0) {
final Real point1 = getPoint1(stringBounder); point1 = point1.addFixed(-LIVE_DELTA_SIZE);
final Real point2 = getPoint2(stringBounder); }
if (point1.getCurrentValue() < point2.getCurrentValue()) { point2 = point2.addFixed(level2 * LIVE_DELTA_SIZE);
point2.ensureBiggerThan(point1.addFixed(width));
} else {
point1.ensureBiggerThan(point2.addFixed(width)); point1.ensureBiggerThan(point2.addFixed(width));
// } } else {
final int level2 = livingSpace2.getLevelAt(this, EventsHistoryMode.IGNORE_FUTURE_DEACTIVATE);
if (level2 > 0) {
point2 = point2.addFixed(-LIVE_DELTA_SIZE);
}
point2.ensureBiggerThan(point1.addFixed(width));
} }
} }
// private boolean isSelf() {
// return livingSpace1 == livingSpace2;
// }
private Real getPoint1(final StringBounder stringBounder) { private Real getPoint1(final StringBounder stringBounder) {
return livingSpace1.getPosC(stringBounder); return livingSpace1.getPosC(stringBounder);
} }
@ -226,12 +222,6 @@ public class CommunicationTile implements TileWithUpdateStairs, TileWithCallback
} }
public Real getMaxX(StringBounder stringBounder) { public Real getMaxX(StringBounder stringBounder) {
// if (isSelf()) {
// final Component comp = getComponent(stringBounder);
// final Dimension2D dim = comp.getPreferredDimension(stringBounder);
// final double width = dim.getWidth();
// return livingSpace1.getPosC(stringBounder).addFixed(width);
// }
if (isReverse(stringBounder)) { if (isReverse(stringBounder)) {
return getPoint1(stringBounder); return getPoint1(stringBounder);
} }

View File

@ -56,7 +56,6 @@ public class CommunicationTileNoteRight implements TileWithUpdateStairs, TileWit
private final Skin skin; private final Skin skin;
private final ISkinParam skinParam; private final ISkinParam skinParam;
private final Display notes; private final Display notes;
// private final NotePosition notePosition;
private final LivingSpace livingSpace; private final LivingSpace livingSpace;
public Event getEvent() { public Event getEvent() {
@ -74,7 +73,6 @@ public class CommunicationTileNoteRight implements TileWithUpdateStairs, TileWit
this.skin = skin; this.skin = skin;
this.skinParam = skinParam; this.skinParam = skinParam;
this.notes = message.getNote(); this.notes = message.getNote();
// this.notePosition = message.getNotePosition();
this.livingSpace = livingSpace; this.livingSpace = livingSpace;
} }
@ -89,12 +87,13 @@ public class CommunicationTileNoteRight implements TileWithUpdateStairs, TileWit
} }
private Real getNotePosition(StringBounder stringBounder) { private Real getNotePosition(StringBounder stringBounder) {
final Component comp = getComponent(stringBounder); // final Component comp = getComponent(stringBounder);
final Dimension2D dim = comp.getPreferredDimension(stringBounder); // final Dimension2D dim = comp.getPreferredDimension(stringBounder);
if (isCreate()) { if (isCreate()) {
return livingSpace.getPosD(stringBounder); return livingSpace.getPosD(stringBounder);
} }
return livingSpace.getPosC(stringBounder); final int level = livingSpace.getLevelAt(this, EventsHistoryMode.IGNORE_FUTURE_DEACTIVATE);
return livingSpace.getPosC(stringBounder).addFixed(level * CommunicationTile.LIVE_DELTA_SIZE);
} }
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {

View File

@ -152,7 +152,7 @@ public class CommunicationTileSelf implements TileWithUpdateStairs {
final LivingSpace next = getNext(); final LivingSpace next = getNext();
if (next != null) { if (next != null) {
next.getPosB().ensureBiggerThan(getMaxX(stringBounder)); next.getPosC(stringBounder).ensureBiggerThan(getMaxX(stringBounder));
} }
} }

View File

@ -0,0 +1,74 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2014, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 4636 $
*
*/
package net.sourceforge.plantuml.sequencediagram.teoz;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.real.Real;
import net.sourceforge.plantuml.sequencediagram.Event;
import net.sourceforge.plantuml.sequencediagram.HSpace;
import net.sourceforge.plantuml.ugraphic.UGraphic;
public class HSpaceTile implements Tile {
private final HSpace hspace;
private final Real origin;
public Event getEvent() {
return hspace;
}
public HSpaceTile(HSpace hspace, TileArguments tileArguments) {
this.hspace = hspace;
this.origin = tileArguments.getOrigin();
}
public void drawU(UGraphic ug) {
}
public double getPreferredHeight(StringBounder stringBounder) {
return hspace.getPixel();
}
public void addConstraints(StringBounder stringBounder) {
}
public Real getMinX(StringBounder stringBounder) {
return origin;
}
public Real getMaxX(StringBounder stringBounder) {
return origin.addFixed(10);
}
}

View File

@ -89,9 +89,9 @@ public class LifeEventTile implements TileWithUpdateStairs {
} }
public double getPreferredHeight(StringBounder stringBounder) { public double getPreferredHeight(StringBounder stringBounder) {
if (lifeEvent.isActivate()) { // if (lifeEvent.isActivate()) {
return 20; // return 20;
} // }
if (isDestroyWithoutMessage()) { if (isDestroyWithoutMessage()) {
final Component cross = skin.createComponent(ComponentType.DESTROY, null, skinParam, null); final Component cross = skin.createComponent(ComponentType.DESTROY, null, skinParam, null);
final Dimension2D dimCross = cross.getPreferredDimension(stringBounder); final Dimension2D dimCross = cross.getPreferredDimension(stringBounder);

View File

@ -167,7 +167,7 @@ public class LivingSpace {
return; return;
} }
final Component comp = rose.createComponent(headType, null, p.getSkinParamBackcolored(skinParam), final Component comp = rose.createComponent(headType, null, p.getSkinParamBackcolored(skinParam),
p.getDisplay(false)); p.getDisplay(skinParam.forceSequenceParticipantUnderlined()));
final Dimension2D dim = comp.getPreferredDimension(ug.getStringBounder()); final Dimension2D dim = comp.getPreferredDimension(ug.getStringBounder());
if (horizontalAlignment == HorizontalAlignment.RIGHT) { if (horizontalAlignment == HorizontalAlignment.RIGHT) {
ug = ug.apply(new UTranslate(-dim.getWidth(), 0)); ug = ug.apply(new UTranslate(-dim.getWidth(), 0));
@ -187,8 +187,7 @@ public class LivingSpace {
} }
public Dimension2D getHeadPreferredDimension(StringBounder stringBounder) { public Dimension2D getHeadPreferredDimension(StringBounder stringBounder) {
// final Component comp = skin.createComponent(headType, null, skinParam, p.getDisplay(false)); final Component comp = rose.createComponent(headType, null, skinParam, p.getDisplay(skinParam.forceSequenceParticipantUnderlined()));
final Component comp = rose.createComponent(headType, null, skinParam, p.getDisplay(false));
final Dimension2D dim = comp.getPreferredDimension(stringBounder); final Dimension2D dim = comp.getPreferredDimension(stringBounder);
return dim; return dim;
} }

View File

@ -56,7 +56,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
public class NotesTile implements Tile { public class NotesTile implements Tile {
private final List<LivingSpace> noteLivingSpaces; private final LivingSpaces livingSpaces;
private final Skin skin; private final Skin skin;
private final ISkinParam skinParam; private final ISkinParam skinParam;
private final Notes notes; private final Notes notes;
@ -65,15 +65,14 @@ public class NotesTile implements Tile {
return notes; return notes;
} }
public NotesTile(List<LivingSpace> noteLivingSpaces, Notes notes, Skin skin, ISkinParam skinParam) { public NotesTile(LivingSpaces livingSpaces, Notes notes, Skin skin, ISkinParam skinParam) {
this.noteLivingSpaces = noteLivingSpaces; this.livingSpaces = livingSpaces;
this.notes = notes; this.notes = notes;
this.skin = skin; this.skin = skin;
this.skinParam = skinParam; this.skinParam = skinParam;
} }
private Component getComponent(StringBounder stringBounder, int i) { private Component getComponent(StringBounder stringBounder, Note note) {
final Note note = notes.get(i);
final Component comp = skin.createComponent(getNoteComponentType(note.getStyle()), null, final Component comp = skin.createComponent(getNoteComponentType(note.getStyle()), null,
note.getSkinParamBackcolored(skinParam), note.getStrings()); note.getSkinParamBackcolored(skinParam), note.getStrings());
return comp; return comp;
@ -92,45 +91,28 @@ public class NotesTile implements Tile {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
for (int i = 0; i < noteLivingSpaces.size(); i++) { for (Note note : notes) {
final Component comp = getComponent(stringBounder, i); final Component comp = getComponent(stringBounder, note);
final Dimension2D dim = comp.getPreferredDimension(stringBounder); final Dimension2D dim = comp.getPreferredDimension(stringBounder);
final double x = getX(stringBounder, i).getCurrentValue(); final double x = getX(stringBounder, note).getCurrentValue();
final Area area = new Area(getUsedWidth(stringBounder, i), dim.getHeight()); final Area area = new Area(getUsedWidth(stringBounder, note), dim.getHeight());
final UGraphic ug2 = ug.apply(new UTranslate(x, 0)); final UGraphic ug2 = ug.apply(new UTranslate(x, 0));
comp.drawU(ug2, area, (Context2D) ug2); comp.drawU(ug2, area, (Context2D) ug2);
} }
// final Component comp = getComponent(stringBounder);
// final Dimension2D dim = comp.getPreferredDimension(stringBounder);
// final double x = getX(stringBounder).getCurrentValue();
// final Area area = new Area(getUsedWidth(stringBounder), dim.getHeight());
//
// ug = ug.apply(new UTranslate(x, 0));
// comp.drawU(ug, area, (Context2D) ug);
} }
private double getUsedWidth(StringBounder stringBounder, int i) { private double getUsedWidth(StringBounder stringBounder, Note note) {
final Component comp = getComponent(stringBounder, i); final Component comp = getComponent(stringBounder, note);
final Dimension2D dim = comp.getPreferredDimension(stringBounder); final Dimension2D dim = comp.getPreferredDimension(stringBounder);
final double width = dim.getWidth(); final double width = dim.getWidth();
// if (note.getPosition() == NotePosition.OVER_SEVERAL) {
// final double x1 = livingSpace1.getPosB().getCurrentValue();
// final double x2 = livingSpace2.getPosD(stringBounder).getCurrentValue();
// final double w = x2 - x1;
// if (width < w) {
// return w;
// }
// }
return width; return width;
} }
private Real getX(StringBounder stringBounder, int i) { private Real getX(StringBounder stringBounder, Note note) {
final Note note = notes.get(i); final LivingSpace livingSpace1 = livingSpaces.get(note.getParticipant());
final LivingSpace livingSpace1 = noteLivingSpaces.get(i);
final NotePosition position = note.getPosition(); final NotePosition position = note.getPosition();
final double width = getUsedWidth(stringBounder, i); final double width = getUsedWidth(stringBounder, note);
if (position == NotePosition.LEFT) { if (position == NotePosition.LEFT) {
return livingSpace1.getPosC(stringBounder).addFixed(-width); return livingSpace1.getPosC(stringBounder).addFixed(-width);
} else if (position == NotePosition.RIGHT) { } else if (position == NotePosition.RIGHT) {
@ -138,10 +120,10 @@ public class NotesTile implements Tile {
final double dx = level * CommunicationTile.LIVE_DELTA_SIZE; final double dx = level * CommunicationTile.LIVE_DELTA_SIZE;
return livingSpace1.getPosC(stringBounder).addFixed(dx); return livingSpace1.getPosC(stringBounder).addFixed(dx);
} else if (position == NotePosition.OVER_SEVERAL) { } else if (position == NotePosition.OVER_SEVERAL) {
// final Real x1 = livingSpace1.getPosC(stringBounder); final LivingSpace livingSpace2 = livingSpaces.get(note.getParticipant2());
// final Real x2 = livingSpace2.getPosC(stringBounder); final Real x1 = livingSpace1.getPosC(stringBounder);
// return RealUtils.middle(x1, x2).addFixed(-width / 2); final Real x2 = livingSpace2.getPosC(stringBounder);
throw new UnsupportedOperationException(position.toString()); return RealUtils.middle(x1, x2).addFixed(-width / 2);
} else if (position == NotePosition.OVER) { } else if (position == NotePosition.OVER) {
return livingSpace1.getPosC(stringBounder).addFixed(-width / 2); return livingSpace1.getPosC(stringBounder).addFixed(-width / 2);
} else { } else {
@ -151,8 +133,8 @@ public class NotesTile implements Tile {
public double getPreferredHeight(StringBounder stringBounder) { public double getPreferredHeight(StringBounder stringBounder) {
double result = 0; double result = 0;
for (int i = 0; i < noteLivingSpaces.size(); i++) { for (Note note : notes) {
final Component comp = getComponent(stringBounder, i); final Component comp = getComponent(stringBounder, note);
final Dimension2D dim = comp.getPreferredDimension(stringBounder); final Dimension2D dim = comp.getPreferredDimension(stringBounder);
result = Math.max(result, dim.getHeight()); result = Math.max(result, dim.getHeight());
} }
@ -160,10 +142,11 @@ public class NotesTile implements Tile {
} }
public void addConstraints(StringBounder stringBounder) { public void addConstraints(StringBounder stringBounder) {
for (int i = 0; i < noteLivingSpaces.size() - 1; i++) { final List<Note> all = notes.asList();
for (int j = i + 1; j < noteLivingSpaces.size(); j++) { for (int i = 0; i < all.size() - 1; i++) {
final Real point1 = getX2(stringBounder, i); for (int j = i + 1; j < all.size(); j++) {
final Real point2 = getX(stringBounder, j); final Real point1 = getX2(stringBounder, all.get(i));
final Real point2 = getX(stringBounder, all.get(j));
point2.ensureBiggerThan(point1); point2.ensureBiggerThan(point1);
} }
} }
@ -171,20 +154,20 @@ public class NotesTile implements Tile {
public Real getMinX(StringBounder stringBounder) { public Real getMinX(StringBounder stringBounder) {
final List<Real> reals = new ArrayList<Real>(); final List<Real> reals = new ArrayList<Real>();
for (int i = 0; i < noteLivingSpaces.size(); i++) { for (Note note : notes) {
reals.add(getX(stringBounder, i)); reals.add(getX(stringBounder, note));
} }
return RealUtils.min(reals); return RealUtils.min(reals);
} }
private Real getX2(StringBounder stringBounder, int i) { private Real getX2(StringBounder stringBounder, Note note) {
return getX(stringBounder, i).addFixed(getUsedWidth(stringBounder, i)); return getX(stringBounder, note).addFixed(getUsedWidth(stringBounder, note));
} }
public Real getMaxX(StringBounder stringBounder) { public Real getMaxX(StringBounder stringBounder) {
final List<Real> reals = new ArrayList<Real>(); final List<Real> reals = new ArrayList<Real>();
for (int i = 0; i < noteLivingSpaces.size(); i++) { for (Note note : notes) {
reals.add(getX2(stringBounder, i)); reals.add(getX2(stringBounder, note));
} }
return RealUtils.max(reals); return RealUtils.max(reals);
} }

View File

@ -47,6 +47,7 @@ import net.sourceforge.plantuml.sequencediagram.Event;
import net.sourceforge.plantuml.sequencediagram.GroupingLeaf; import net.sourceforge.plantuml.sequencediagram.GroupingLeaf;
import net.sourceforge.plantuml.sequencediagram.GroupingStart; import net.sourceforge.plantuml.sequencediagram.GroupingStart;
import net.sourceforge.plantuml.sequencediagram.GroupingType; import net.sourceforge.plantuml.sequencediagram.GroupingType;
import net.sourceforge.plantuml.sequencediagram.HSpace;
import net.sourceforge.plantuml.sequencediagram.LifeEvent; import net.sourceforge.plantuml.sequencediagram.LifeEvent;
import net.sourceforge.plantuml.sequencediagram.Message; import net.sourceforge.plantuml.sequencediagram.Message;
import net.sourceforge.plantuml.sequencediagram.MessageExo; import net.sourceforge.plantuml.sequencediagram.MessageExo;
@ -129,11 +130,7 @@ public class TileBuilder {
tiles.add(new NoteTile(livingSpace1, livingSpace2, note, skin, skinParam)); tiles.add(new NoteTile(livingSpace1, livingSpace2, note, skin, skinParam));
} else if (ev instanceof Notes) { } else if (ev instanceof Notes) {
final Notes notes = (Notes) ev; final Notes notes = (Notes) ev;
final List<LivingSpace> noteLivingSpaces = new ArrayList<LivingSpace>(); tiles.add(new NotesTile(livingSpaces, notes, skin, skinParam));
for (Note n : notes) {
noteLivingSpaces.add(livingSpaces.get(n.getParticipant()));
}
tiles.add(new NotesTile(noteLivingSpaces, notes, skin, skinParam));
} else if (ev instanceof Divider) { } else if (ev instanceof Divider) {
final Divider divider = (Divider) ev; final Divider divider = (Divider) ev;
tiles.add(new DividerTile(divider, tileArguments)); tiles.add(new DividerTile(divider, tileArguments));
@ -153,6 +150,9 @@ public class TileBuilder {
} else if (ev instanceof Delay) { } else if (ev instanceof Delay) {
final Delay delay = (Delay) ev; final Delay delay = (Delay) ev;
tiles.add(new DelayTile(delay, tileArguments)); tiles.add(new DelayTile(delay, tileArguments));
} else if (ev instanceof HSpace) {
final HSpace hspace = (HSpace) ev;
tiles.add(new HSpaceTile(hspace, tileArguments));
} else if (ev instanceof LifeEvent) { } else if (ev instanceof LifeEvent) {
final LifeEvent lifeEvent = (LifeEvent) ev; final LifeEvent lifeEvent = (LifeEvent) ev;
final LivingSpace livingSpace = livingSpaces.get(lifeEvent.getParticipant()); final LivingSpace livingSpace = livingSpaces.get(lifeEvent.getParticipant());

View File

@ -28,14 +28,13 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 17092 $ * Revision $Revision: 17431 $
* *
*/ */
package net.sourceforge.plantuml.skin.rose; package net.sourceforge.plantuml.skin.rose;
import java.awt.geom.Dimension2D; import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
@ -48,7 +47,6 @@ import net.sourceforge.plantuml.skin.AbstractTextualComponent;
import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.URectangle;
@ -66,7 +64,7 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent {
private final SymbolContext symbolContext; private final SymbolContext symbolContext;
public ComponentRoseGroupingHeader(HtmlColor background, SymbolContext symbolContext, FontConfiguration bigFont, public ComponentRoseGroupingHeader(HtmlColor background, SymbolContext symbolContext, FontConfiguration bigFont,
UFont smallFont, Display strings, ISkinSimple spriteContainer, FontParam sequenceGroupHeader) { FontConfiguration smallFont2, Display strings, ISkinSimple spriteContainer) {
super(strings.get(0), bigFont, HorizontalAlignment.LEFT, 15, 30, 1, spriteContainer, 0, null, null); super(strings.get(0), bigFont, HorizontalAlignment.LEFT, 15, 30, 1, spriteContainer, 0, null, null);
this.symbolContext = symbolContext; this.symbolContext = symbolContext;
this.background = background; this.background = background;
@ -74,17 +72,17 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent {
this.commentTextBlock = null; this.commentTextBlock = null;
} else { } else {
final Display display = Display.getWithNewlines("[" + strings.get(1) + "]"); final Display display = Display.getWithNewlines("[" + strings.get(1) + "]");
final FontConfiguration fontConfiguration = bigFont.forceFont(smallFont, null); // final FontConfiguration smallFont2 = bigFont.forceFont(smallFont, null);
// new FontConfiguration(smallFont, bigFont.getColor(), this.commentTextBlock = display.create(smallFont2, HorizontalAlignment.LEFT, spriteContainer);
// bigFont.getHyperlinkColor(), bigFont.useUnderlineForHyperlink());
this.commentTextBlock = display.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer);
} }
if (this.background == null) { if (this.background == null) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
} }
// new FontConfiguration(smallFont, bigFont.getColor(), bigFont.getHyperlinkColor(),
// bigFont.useUnderlineForHyperlink());
private double getSuppHeightForComment(StringBounder stringBounder) { private double getSuppHeightForComment(StringBounder stringBounder) {
if (commentTextBlock == null) { if (commentTextBlock == null) {
return 0; return 0;

View File

@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 17124 $ * Revision $Revision: 17432 $
* *
*/ */
package net.sourceforge.plantuml.skin.rose; package net.sourceforge.plantuml.skin.rose;
@ -38,6 +38,7 @@ import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
@ -186,10 +187,15 @@ public class Rose implements Skin {
return new ComponentRoseNoteBox(getSymbolContext(param, ColorParam.noteBorder), getUFont2(param, return new ComponentRoseNoteBox(getSymbolContext(param, ColorParam.noteBorder), getUFont2(param,
FontParam.NOTE), stringsToDisplay, param); FontParam.NOTE), stringsToDisplay, param);
} }
final FontConfiguration bigFont = getUFont2(param, FontParam.SEQUENCE_GROUP_HEADER);
if (type == ComponentType.GROUPING_HEADER) { if (type == ComponentType.GROUPING_HEADER) {
FontConfiguration smallFont = bigFont.forceFont(fontGrouping, null);
final HtmlColor smallColor = SkinParamUtils.getFontColor(param, FontParam.SEQUENCE_GROUP, null);
if (smallColor != null) {
smallFont = smallFont.changeColor(smallColor);
}
return new ComponentRoseGroupingHeader(param.getBackgroundColor(), getSymbolContext(param, return new ComponentRoseGroupingHeader(param.getBackgroundColor(), getSymbolContext(param,
ColorParam.sequenceGroupBorder), getUFont2(param, FontParam.SEQUENCE_GROUP_HEADER), fontGrouping, ColorParam.sequenceGroupBorder), bigFont, smallFont, stringsToDisplay, param);
stringsToDisplay, param, FontParam.SEQUENCE_GROUP_HEADER);
} }
if (type == ComponentType.GROUPING_ELSE) { if (type == ComponentType.GROUPING_ELSE) {
return new ComponentRoseGroupingElse(getHtmlColor(param, ColorParam.sequenceGroupBorder), getUFont2(param, return new ComponentRoseGroupingElse(getHtmlColor(param, ColorParam.sequenceGroupBorder), getUFont2(param,
@ -229,9 +235,9 @@ public class Rose implements Skin {
} }
if (type == ComponentType.REFERENCE) { if (type == ComponentType.REFERENCE) {
return new ComponentRoseReference(getUFont2(param, FontParam.SEQUENCE_REFERENCE), getSymbolContext(param, return new ComponentRoseReference(getUFont2(param, FontParam.SEQUENCE_REFERENCE), getSymbolContext(param,
ColorParam.sequenceReferenceBorder), getUFont2(param, FontParam.SEQUENCE_GROUP_HEADER), ColorParam.sequenceReferenceBorder), bigFont, stringsToDisplay,
stringsToDisplay, param.getHorizontalAlignment(AlignParam.SEQUENCE_REFERENCE_ALIGN), param, param.getHorizontalAlignment(AlignParam.SEQUENCE_REFERENCE_ALIGN), param, getHtmlColor(param,
getHtmlColor(param, ColorParam.sequenceReferenceBackground)); ColorParam.sequenceReferenceBackground));
} }
if (type == ComponentType.TITLE) { if (type == ComponentType.TITLE) {
return new ComponentRoseTitle(getUFont2(param, FontParam.SEQUENCE_TITLE), stringsToDisplay, param); return new ComponentRoseTitle(getUFont2(param, FontParam.SEQUENCE_TITLE), stringsToDisplay, param);

View File

@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 15147 $ * Revision $Revision: 17451 $
* *
*/ */
package net.sourceforge.plantuml.statediagram; package net.sourceforge.plantuml.statediagram;
@ -42,12 +42,13 @@ import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Rankdir;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.utils.UniqueSequence; import net.sourceforge.plantuml.utils.UniqueSequence;
public class StateDiagram extends AbstractEntityDiagram { public class StateDiagram extends AbstractEntityDiagram {
private static final String CONCURRENT_PREFIX = "CONC";
public boolean checkConcurrentStateOk(Code code) { public boolean checkConcurrentStateOk(Code code) {
if (leafExist(code) == false) { if (leafExist(code) == false) {
return true; return true;
@ -121,12 +122,12 @@ public class StateDiagram extends AbstractEntityDiagram {
super.endGroup(); super.endGroup();
} }
getCurrentGroup().setConcurrentSeparator(direction); getCurrentGroup().setConcurrentSeparator(direction);
final IGroup conc1 = getOrCreateGroup(UniqueSequence.getCode("CONC"), Display.create(""), final IGroup conc1 = getOrCreateGroup(UniqueSequence.getCode(CONCURRENT_PREFIX), Display.create(""),
GroupType.CONCURRENT_STATE, getCurrentGroup()); GroupType.CONCURRENT_STATE, getCurrentGroup());
if (EntityUtils.groupRoot(cur) == false && cur.getGroupType() == GroupType.STATE) { if (EntityUtils.groupRoot(cur) == false && cur.getGroupType() == GroupType.STATE) {
cur.moveEntitiesTo(conc1); cur.moveEntitiesTo(conc1);
super.endGroup(); super.endGroup();
getOrCreateGroup(UniqueSequence.getCode("CONC"), Display.create(""), GroupType.CONCURRENT_STATE, getOrCreateGroup(UniqueSequence.getCode(CONCURRENT_PREFIX), Display.create(""), GroupType.CONCURRENT_STATE,
getCurrentGroup()); getCurrentGroup());
} }
// printlink("AFTER"); // printlink("AFTER");

View File

@ -40,7 +40,6 @@ import java.util.List;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.EntityUtils; import net.sourceforge.plantuml.cucadiagram.EntityUtils;
@ -58,10 +57,8 @@ import net.sourceforge.plantuml.cucadiagram.dot.DotData;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockEmpty; import net.sourceforge.plantuml.graphic.TextBlockEmpty;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.TextBlockWidth; import net.sourceforge.plantuml.graphic.TextBlockWidth;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
@ -114,7 +111,7 @@ public final class GroupPngMakerState {
new FontConfiguration(skinParam, FontParam.STATE, group.getStereotype()), HorizontalAlignment.CENTER, new FontConfiguration(skinParam, FontParam.STATE, group.getStereotype()), HorizontalAlignment.CENTER,
diagram.getSkinParam()); diagram.getSkinParam());
if (group.size() == 0) { if (group.size() == 0 && group.getChildren().size() == 0) {
return new EntityImageState(group, diagram.getSkinParam()); return new EntityImageState(group, diagram.getSkinParam());
} }
final List<Link> links = getPureInnerLinks(); final List<Link> links = getPureInnerLinks();

View File

@ -42,6 +42,10 @@ import net.sourceforge.plantuml.command.regex.MyPattern;
public class StartUtils { public class StartUtils {
public static final String PAUSE_PATTERN = "(?i)((?:\\W|\\<[^<>]*\\>)*)@unpause";
public static final String START_PATTERN = "(?i)((?:[^\\w~]|\\<[^<>]*\\>)*)@start";
public static boolean isArobaseStartDiagram(CharSequence s) { public static boolean isArobaseStartDiagram(CharSequence s) {
return StringUtils.trinNoTrace(s).startsWith("@start"); return StringUtils.trinNoTrace(s).startsWith("@start");
} }

View File

@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 17343 $ * Revision $Revision: 17510 $
* *
*/ */
package net.sourceforge.plantuml.version; package net.sourceforge.plantuml.version;
@ -39,7 +39,7 @@ import java.util.Date;
public class Version { public class Version {
public static int version() { public static int version() {
return 8031; return 8032;
} }
public static String versionString() { public static String versionString() {
@ -63,7 +63,7 @@ public class Version {
} }
private static long compileTime() { private static long compileTime() {
return 1443460759164L; return 1446389976158L;
} }
public static String compileTimeString() { public static String compileTimeString() {