mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-22 04:55:10 +00:00
Version 5930
This commit is contained in:
parent
a8bf09d279
commit
a80a3daf68
@ -67,7 +67,7 @@ public class CommandIf extends SingleLineCommand2<ActivityDiagram> {
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexLeaf("BRACKET", "(?:\\[([^\\]*]+[^\\]]*)\\])?"),
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexLeaf("IF", "if\\s*\"([^\"]*)\"\\s*(?:as\\s+([\\p{L}0-9_.]+)\\s+)?then$"));
|
||||
new RegexLeaf("IF", "if\\s*\"([^\"]*)\"\\s*(?:as\\s+([\\p{L}0-9_.]+)\\s+)?(?:then)?$"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram2;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram2.command.CommandEndif2;
|
||||
import net.sourceforge.plantuml.activitydiagram2.command.CommandIf2;
|
||||
import net.sourceforge.plantuml.activitydiagram2.command.CommandNewActivity;
|
||||
import net.sourceforge.plantuml.activitydiagram2.command.CommandStart;
|
||||
@ -54,6 +55,7 @@ public class ActivityDiagramFactory2 extends AbstractUmlSystemCommandFactory {
|
||||
addCommand(new CommandStart(system));
|
||||
addCommand(new CommandNewActivity(system));
|
||||
addCommand(new CommandIf2(system));
|
||||
addCommand(new CommandEndif2(system));
|
||||
|
||||
// addCommand(new CommandLinkActivity(system));
|
||||
// addCommand(new CommandPartition(system));
|
||||
|
@ -54,7 +54,7 @@ public class CommandIf2 extends SingleLineCommand2<ActivityDiagram2> {
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexLeaf("TEST", "\"([^\"]+)\""),
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexLeaf("then"),
|
||||
new RegexLeaf("(then)?"),
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
|
@ -65,15 +65,15 @@ public class ComponentTextArrow implements Component {
|
||||
|
||||
final int yarrow = height - 2;
|
||||
charArea.drawHLine(fileFormat == FileFormat.UTXT ? '\u2500' : '-', yarrow, 1, width);
|
||||
if (type == ComponentType.DOTTED_ARROW || type == ComponentType.RETURN_DOTTED_ARROW) {
|
||||
if (type.getArrowConfiguration().isDotted()) {
|
||||
for (int i = 1; i < width; i += 2) {
|
||||
charArea.drawChar(' ', i, yarrow);
|
||||
}
|
||||
}
|
||||
|
||||
if (type == ComponentType.ARROW || type == ComponentType.DOTTED_ARROW) {
|
||||
if (type.getArrowConfiguration().isLeftToRightNormal()) {
|
||||
charArea.drawChar('>', width - 1, yarrow);
|
||||
} else if (type == ComponentType.RETURN_ARROW || type == ComponentType.RETURN_DOTTED_ARROW) {
|
||||
} else if (type.getArrowConfiguration().isRightToLeftReverse()) {
|
||||
charArea.drawChar('<', 1, yarrow);
|
||||
} else {
|
||||
throw new UnsupportedOperationException();
|
||||
|
@ -66,24 +66,24 @@ public class ComponentTextSelfArrow implements Component {
|
||||
charArea.fillRect(' ', 0, 0, width, height);
|
||||
|
||||
if (fileFormat == FileFormat.UTXT) {
|
||||
if (type == ComponentType.SELF_ARROW) {
|
||||
charArea.drawStringLR("\u2500\u2500\u2500\u2500\u2510", 0, 0);
|
||||
charArea.drawStringLR("\u2502", 4, 1);
|
||||
charArea.drawStringLR("<\u2500\u2500\u2500\u2518", 0, 2);
|
||||
} else if (type == ComponentType.DOTTED_SELF_ARROW) {
|
||||
if (type.getArrowConfiguration().isDotted()) {
|
||||
charArea.drawStringLR("\u2500 \u2500 \u2510", 0, 0);
|
||||
charArea.drawStringLR("|", 4, 1);
|
||||
charArea.drawStringLR("< \u2500 \u2518", 0, 2);
|
||||
} else {
|
||||
charArea.drawStringLR("\u2500\u2500\u2500\u2500\u2510", 0, 0);
|
||||
charArea.drawStringLR("\u2502", 4, 1);
|
||||
charArea.drawStringLR("<\u2500\u2500\u2500\u2518", 0, 2);
|
||||
}
|
||||
} else {
|
||||
if (type == ComponentType.SELF_ARROW) {
|
||||
charArea.drawStringLR("----.", 0, 0);
|
||||
charArea.drawStringLR("|", 4, 1);
|
||||
charArea.drawStringLR("<---'", 0, 2);
|
||||
} else if (type == ComponentType.DOTTED_SELF_ARROW) {
|
||||
if (type.getArrowConfiguration().isDotted()) {
|
||||
charArea.drawStringLR("- - .", 0, 0);
|
||||
charArea.drawStringLR("|", 4, 1);
|
||||
charArea.drawStringLR("< - '", 0, 2);
|
||||
} else {
|
||||
charArea.drawStringLR("----.", 0, 0);
|
||||
charArea.drawStringLR("|", 4, 1);
|
||||
charArea.drawStringLR("<---'", 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5140 $
|
||||
* Revision $Revision: 5921 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.asciiart;
|
||||
@ -56,11 +56,12 @@ public class TextSkin implements Skin {
|
||||
if (type == ComponentType.ACTOR_HEAD || type == ComponentType.ACTOR_TAIL) {
|
||||
return new ComponentTextActor(type, stringsToDisplay, fileFormat);
|
||||
}
|
||||
if (type == ComponentType.ARROW || type == ComponentType.RETURN_ARROW || type == ComponentType.DOTTED_ARROW
|
||||
|| type == ComponentType.RETURN_DOTTED_ARROW) {
|
||||
if (type.isArrow()
|
||||
&& (type.getArrowConfiguration().isLeftToRightNormal() || type.getArrowConfiguration()
|
||||
.isRightToLeftReverse())) {
|
||||
return new ComponentTextArrow(type, stringsToDisplay, fileFormat);
|
||||
}
|
||||
if (type == ComponentType.SELF_ARROW || type == ComponentType.DOTTED_SELF_ARROW) {
|
||||
if (type.isArrow() && type.getArrowConfiguration().isSelfArrow()) {
|
||||
return new ComponentTextSelfArrow(type, stringsToDisplay, fileFormat);
|
||||
}
|
||||
if (type == ComponentType.PARTICIPANT_LINE || type == ComponentType.ACTOR_LINE) {
|
||||
|
@ -194,12 +194,12 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
|
||||
removeLink(existingLink);
|
||||
}
|
||||
|
||||
entity1ToPoint = new Link(entity1, point, existingLink.getType().getPart2(), existingLink.getLabel(), existingLink
|
||||
.getLength(), existingLink.getQualifier1(), null, existingLink.getLabeldistance(), existingLink
|
||||
.getLabelangle());
|
||||
pointToEntity2 = new Link(point, entity2, existingLink.getType().getPart1(), existingLink.getLabel(), existingLink
|
||||
.getLength(), null, existingLink.getQualifier2(), existingLink.getLabeldistance(), existingLink
|
||||
.getLabelangle());
|
||||
entity1ToPoint = new Link(entity1, point, existingLink.getType().getPart2(), existingLink.getLabel(),
|
||||
existingLink.getLength(), existingLink.getQualifier1(), null, existingLink.getLabeldistance(),
|
||||
existingLink.getLabelangle());
|
||||
pointToEntity2 = new Link(point, entity2, existingLink.getType().getPart1(), null,
|
||||
existingLink.getLength(), null, existingLink.getQualifier2(), existingLink.getLabeldistance(),
|
||||
existingLink.getLabelangle());
|
||||
addLink(entity1ToPoint);
|
||||
addLink(pointToEntity2);
|
||||
|
||||
@ -217,8 +217,21 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
|
||||
}
|
||||
|
||||
void createInSecond(LinkType linkType, String label) {
|
||||
entity1ToPoint = new Link(entity1, point, existingLink.getType(), null, 2);
|
||||
pointToEntity2 = new Link(point, entity2, existingLink.getType(), null, 2);
|
||||
existingLink = foundLink(entity1, entity2);
|
||||
if (existingLink == null) {
|
||||
existingLink = new Link(entity1, entity2, new LinkType(LinkDecor.NONE, LinkDecor.NONE), null, 2);
|
||||
} else {
|
||||
removeLink(existingLink);
|
||||
}
|
||||
|
||||
entity1ToPoint = new Link(entity1, point, existingLink.getType().getPart2(), existingLink.getLabel(), 2,
|
||||
existingLink.getQualifier1(), null, existingLink.getLabeldistance(), existingLink.getLabelangle());
|
||||
pointToEntity2 = new Link(point, entity2, existingLink.getType().getPart1(), null, 2, null, existingLink
|
||||
.getQualifier2(), existingLink.getLabeldistance(), existingLink.getLabelangle());
|
||||
// entity1ToPoint = new Link(entity1, point, existingLink.getType(),
|
||||
// null, 2);
|
||||
// pointToEntity2 = new Link(point, entity2, existingLink.getType(),
|
||||
// null, 2);
|
||||
addLink(entity1ToPoint);
|
||||
addLink(pointToEntity2);
|
||||
if (other.pointToAssocied.getEntity1().getType() == EntityType.POINT_FOR_ASSOCIATION) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5872 $
|
||||
* Revision $Revision: 5924 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.printskin;
|
||||
@ -88,18 +88,18 @@ class PrintSkin extends AbstractPSystem {
|
||||
}
|
||||
|
||||
private BufferedImage createImage() {
|
||||
final EmptyImageBuilder builder = new EmptyImageBuilder(1000, 1000, Color.WHITE);
|
||||
final EmptyImageBuilder builder = new EmptyImageBuilder(1500, 830, Color.WHITE);
|
||||
|
||||
final BufferedImage im = builder.getBufferedImage();
|
||||
final Graphics2D g2d = builder.getGraphics2D();
|
||||
|
||||
ug = new UGraphicG2d(g2d, null, 1.0);
|
||||
|
||||
for (ComponentType type : EnumSet.allOf(ComponentType.class)) {
|
||||
for (ComponentType type : ComponentType.all() ) {
|
||||
printComponent(type);
|
||||
ypos += 10;
|
||||
maxYpos = Math.max(maxYpos, ypos);
|
||||
if (ypos > 500) {
|
||||
if (ypos > 620) {
|
||||
ypos = 0;
|
||||
xpos += 200;
|
||||
}
|
||||
|
@ -38,12 +38,14 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.skin.ArrowConfiguration;
|
||||
|
||||
public abstract class AbstractMessage implements Event {
|
||||
|
||||
final private List<String> label;
|
||||
final private boolean dotted;
|
||||
final private boolean full;
|
||||
// final private boolean dotted;
|
||||
// final private boolean full;
|
||||
final private ArrowConfiguration arrowConfiguration;
|
||||
final private List<LifeEvent> lifeEvents = new ArrayList<LifeEvent>();
|
||||
|
||||
private List<String> notes;
|
||||
@ -51,10 +53,9 @@ public abstract class AbstractMessage implements Event {
|
||||
private HtmlColor noteBackColor;
|
||||
private final String messageNumber;
|
||||
|
||||
public AbstractMessage(List<String> label, boolean dotted, boolean full, String messageNumber) {
|
||||
public AbstractMessage(List<String> label, ArrowConfiguration arrowConfiguration, String messageNumber) {
|
||||
this.label = label;
|
||||
this.dotted = dotted;
|
||||
this.full = full;
|
||||
this.arrowConfiguration = arrowConfiguration;
|
||||
this.messageNumber = messageNumber;
|
||||
}
|
||||
|
||||
@ -87,12 +88,8 @@ public abstract class AbstractMessage implements Event {
|
||||
return Collections.unmodifiableList(label);
|
||||
}
|
||||
|
||||
public final boolean isDotted() {
|
||||
return dotted;
|
||||
}
|
||||
|
||||
public final boolean isFull() {
|
||||
return full;
|
||||
public final ArrowConfiguration getArrowConfiguration() {
|
||||
return arrowConfiguration;
|
||||
}
|
||||
|
||||
public final List<String> getNote() {
|
||||
|
@ -28,21 +28,23 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4663 $
|
||||
* Revision $Revision: 5923 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.skin.ArrowConfiguration;
|
||||
|
||||
public class Message extends AbstractMessage {
|
||||
|
||||
final private Participant p1;
|
||||
final private Participant p2;
|
||||
|
||||
public Message(Participant p1, Participant p2, List<String> label,
|
||||
boolean dotted, boolean full, String messageNumber) {
|
||||
super(label, dotted, full, messageNumber);
|
||||
public Message(Participant p1, Participant p2, List<String> label, ArrowConfiguration arrowConfiguration,
|
||||
String messageNumber) {
|
||||
super(label, arrowConfiguration, messageNumber);
|
||||
this.p1 = p1;
|
||||
this.p2 = p2;
|
||||
}
|
||||
|
@ -35,14 +35,16 @@ package net.sourceforge.plantuml.sequencediagram;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.skin.ArrowConfiguration;
|
||||
|
||||
public class MessageExo extends AbstractMessage {
|
||||
|
||||
final private MessageExoType type;
|
||||
final private Participant participant;
|
||||
|
||||
public MessageExo(Participant p, MessageExoType type, List<String> label,
|
||||
boolean dotted, boolean full, String messageNumber) {
|
||||
super(label, dotted, full, messageNumber);
|
||||
public MessageExo(Participant p, MessageExoType type, List<String> label, ArrowConfiguration arrowConfiguration,
|
||||
String messageNumber) {
|
||||
super(label, arrowConfiguration, messageNumber);
|
||||
this.participant = p;
|
||||
this.type = type;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5731 $
|
||||
* Revision $Revision: 5925 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram;
|
||||
@ -36,7 +36,7 @@ package net.sourceforge.plantuml.sequencediagram;
|
||||
import net.sourceforge.plantuml.command.AbstractUmlSystemCommandFactory;
|
||||
import net.sourceforge.plantuml.sequencediagram.command.CommandActivate;
|
||||
import net.sourceforge.plantuml.sequencediagram.command.CommandActivate2;
|
||||
import net.sourceforge.plantuml.sequencediagram.command.CommandArrow2;
|
||||
import net.sourceforge.plantuml.sequencediagram.command.CommandArrow;
|
||||
import net.sourceforge.plantuml.sequencediagram.command.CommandAutoNewpage;
|
||||
import net.sourceforge.plantuml.sequencediagram.command.CommandAutonumber;
|
||||
import net.sourceforge.plantuml.sequencediagram.command.CommandBoxEnd;
|
||||
@ -71,7 +71,7 @@ public class SequenceDiagramFactory extends AbstractUmlSystemCommandFactory {
|
||||
|
||||
addCommand(new CommandParticipant(system));
|
||||
addCommand(new CommandParticipant2(system));
|
||||
addCommand(new CommandArrow2(system));
|
||||
addCommand(new CommandArrow(system));
|
||||
addCommand(new CommandExoArrowLeft(system));
|
||||
addCommand(new CommandExoArrowRight(system));
|
||||
addCommand(new CommandNoteSequence(system));
|
||||
|
@ -47,34 +47,36 @@ import net.sourceforge.plantuml.command.regex.RegexPartialMatch;
|
||||
import net.sourceforge.plantuml.sequencediagram.Message;
|
||||
import net.sourceforge.plantuml.sequencediagram.Participant;
|
||||
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
import net.sourceforge.plantuml.skin.ArrowConfiguration;
|
||||
import net.sourceforge.plantuml.skin.ArrowDirection;
|
||||
import net.sourceforge.plantuml.skin.ArrowPart;
|
||||
|
||||
public class CommandArrow2 extends SingleLineCommand2<SequenceDiagram> {
|
||||
public class CommandArrow extends SingleLineCommand2<SequenceDiagram> {
|
||||
|
||||
public CommandArrow2(SequenceDiagram sequenceDiagram) {
|
||||
super(sequenceDiagram,
|
||||
getRegexConcat());
|
||||
public CommandArrow(SequenceDiagram sequenceDiagram) {
|
||||
super(sequenceDiagram, getRegexConcat());
|
||||
}
|
||||
|
||||
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(
|
||||
new RegexLeaf("^"),
|
||||
new RegexOr("PART1",
|
||||
new RegexLeaf("PART1CODE", "([\\p{L}0-9_.]+)"),
|
||||
new RegexLeaf("PART1LONG", "\"([^\"]+)\""),
|
||||
new RegexLeaf("PART1LONGCODE", "\"([^\"]+)\"\\s*as\\s+([\\p{L}0-9_.]+)"),
|
||||
new RegexLeaf("^"), //
|
||||
new RegexOr("PART1", //
|
||||
new RegexLeaf("PART1CODE", "([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf("PART1LONG", "\"([^\"]+)\""), //
|
||||
new RegexLeaf("PART1LONGCODE", "\"([^\"]+)\"\\s*as\\s+([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf("PART1CODELONG", "([\\p{L}0-9_.]+)\\s+as\\s*\"([^\"]+)\"")),
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexLeaf("ARROW", "([=-]+[>\\]]{1,2}|[<\\[]{1,2}[=-]+)"),
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexOr("PART2",
|
||||
new RegexLeaf("PART2CODE", "([\\p{L}0-9_.]+)"),
|
||||
new RegexLeaf("PART2LONG", "\"([^\"]+)\""),
|
||||
new RegexLeaf("PART2LONGCODE", "\"([^\"]+)\"\\s*as\\s+([\\p{L}0-9_.]+)"),
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexLeaf("ARROW", "([=-]+(?:>>?|//?|\\\\\\\\?)|(?:<<?|//?|\\\\\\\\?)[=-]+)"), //
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexOr("PART2", //
|
||||
new RegexLeaf("PART2CODE", "([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf("PART2LONG", "\"([^\"]+)\""), //
|
||||
new RegexLeaf("PART2LONGCODE", "\"([^\"]+)\"\\s*as\\s+([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf("PART2CODELONG", "([\\p{L}0-9_.]+)\\s+as\\s*\"([^\"]+)\"")),
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexLeaf("\\s*"), //
|
||||
new RegexLeaf("MESSAGE", "(?::\\s*(.*))?$"));
|
||||
}
|
||||
|
||||
|
||||
private Participant getOrCreateParticipant(Map<String, RegexPartialMatch> arg2, String n) {
|
||||
final String code;
|
||||
final List<String> display;
|
||||
@ -104,17 +106,18 @@ public class CommandArrow2 extends SingleLineCommand2<SequenceDiagram> {
|
||||
|
||||
final String arrow = StringUtils.manageArrowForSequence(arg2.get("ARROW").get(0));
|
||||
|
||||
if (arrow.endsWith(">")) {
|
||||
if (arrow.endsWith(">") || arrow.endsWith("\\") || arrow.endsWith("/")) {
|
||||
p1 = getOrCreateParticipant(arg2, "PART1");
|
||||
p2 = getOrCreateParticipant(arg2, "PART2");
|
||||
} else if (arrow.startsWith("<")) {
|
||||
} else if (arrow.startsWith("<") || arrow.startsWith("\\") || arrow.startsWith("/")) {
|
||||
p2 = getOrCreateParticipant(arg2, "PART1");
|
||||
p1 = getOrCreateParticipant(arg2, "PART2");
|
||||
} else {
|
||||
throw new IllegalStateException(arg2.toString());
|
||||
}
|
||||
|
||||
final boolean full = (arrow.endsWith(">>") || arrow.startsWith("<<"))==false;
|
||||
|
||||
final boolean sync = arrow.endsWith(">>") || arrow.startsWith("<<") || arrow.contains("\\\\")
|
||||
|| arrow.contains("//");
|
||||
|
||||
final boolean dotted = arrow.contains("--");
|
||||
|
||||
@ -125,7 +128,21 @@ public class CommandArrow2 extends SingleLineCommand2<SequenceDiagram> {
|
||||
labels = StringUtils.getWithNewlines(arg2.get("MESSAGE").get(0));
|
||||
}
|
||||
|
||||
getSystem().addMessage(new Message(p1, p2, labels, dotted, full, getSystem().getNextMessageNumber()));
|
||||
ArrowConfiguration config = ArrowConfiguration.withDirection(ArrowDirection.LEFT_TO_RIGHT_NORMAL);
|
||||
if (dotted) {
|
||||
config = config.withDotted();
|
||||
}
|
||||
if (sync) {
|
||||
config = config.withAsync();
|
||||
}
|
||||
if (arrow.endsWith("\\") || arrow.startsWith("/")) {
|
||||
config = config.withPart(ArrowPart.TOP_PART);
|
||||
}
|
||||
if (arrow.endsWith("/") || arrow.startsWith("\\")) {
|
||||
config = config.withPart(ArrowPart.BOTTOM_PART);
|
||||
}
|
||||
|
||||
getSystem().addMessage(new Message(p1, p2, labels, config, getSystem().getNextMessageNumber()));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -43,12 +43,15 @@ import net.sourceforge.plantuml.sequencediagram.MessageExo;
|
||||
import net.sourceforge.plantuml.sequencediagram.MessageExoType;
|
||||
import net.sourceforge.plantuml.sequencediagram.Participant;
|
||||
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
import net.sourceforge.plantuml.skin.ArrowConfiguration;
|
||||
import net.sourceforge.plantuml.skin.ArrowDirection;
|
||||
import net.sourceforge.plantuml.skin.ArrowPart;
|
||||
|
||||
abstract class CommandExoArrowAny extends SingleLineCommand<SequenceDiagram> {
|
||||
|
||||
private final int posArrow;
|
||||
private final int posParticipant;
|
||||
|
||||
|
||||
public CommandExoArrowAny(SequenceDiagram sequenceDiagram, String pattern, int posArrow, int posParticipant) {
|
||||
super(sequenceDiagram, pattern);
|
||||
this.posArrow = posArrow;
|
||||
@ -58,9 +61,11 @@ abstract class CommandExoArrowAny extends SingleLineCommand<SequenceDiagram> {
|
||||
@Override
|
||||
final protected CommandExecutionResult executeArg(List<String> arg) {
|
||||
final String arrow = StringUtils.manageArrowForSequence(arg.get(posArrow));
|
||||
final Participant p = getSystem().getOrCreateParticipant(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get(posParticipant)));
|
||||
final Participant p = getSystem().getOrCreateParticipant(
|
||||
StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get(posParticipant)));
|
||||
|
||||
final boolean full = (arrow.endsWith(">>") || arrow.startsWith("<<")) == false;
|
||||
final boolean sync = arrow.endsWith(">>") || arrow.startsWith("<<") || arrow.contains("//")
|
||||
|| arrow.contains("\\\\");
|
||||
final boolean dotted = arrow.contains("--");
|
||||
|
||||
final List<String> labels;
|
||||
@ -70,28 +75,30 @@ abstract class CommandExoArrowAny extends SingleLineCommand<SequenceDiagram> {
|
||||
labels = StringUtils.getWithNewlines(arg.get(2));
|
||||
}
|
||||
|
||||
ArrowConfiguration config = ArrowConfiguration.withDirection(ArrowDirection.LEFT_TO_RIGHT_NORMAL);
|
||||
if (dotted) {
|
||||
config = config.withDotted();
|
||||
}
|
||||
if (sync) {
|
||||
config = config.withAsync();
|
||||
}
|
||||
config = config.withPart(getArrowPart(arrow));
|
||||
|
||||
getSystem().addMessage(
|
||||
new MessageExo(p, getMessageExoType(arrow), labels, dotted,
|
||||
full, getSystem().getNextMessageNumber()));
|
||||
new MessageExo(p, getMessageExoType(arrow), labels, config, getSystem().getNextMessageNumber()));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
private ArrowPart getArrowPart(String arrow) {
|
||||
if (arrow.contains("/")) {
|
||||
return ArrowPart.BOTTOM_PART;
|
||||
}
|
||||
if (arrow.contains("\\")) {
|
||||
return ArrowPart.TOP_PART;
|
||||
}
|
||||
return ArrowPart.FULL;
|
||||
}
|
||||
|
||||
abstract MessageExoType getMessageExoType(String arrow);
|
||||
|
||||
// final MessageExoType getMessageExoType(String arrow) {
|
||||
// if (arrow.startsWith("[") && arrow.endsWith(">")) {
|
||||
// return MessageExoType.FROM_LEFT;
|
||||
// }
|
||||
// if (arrow.startsWith("[<")) {
|
||||
// return MessageExoType.TO_LEFT;
|
||||
// }
|
||||
// if (arrow.startsWith("<") && arrow.endsWith("]")) {
|
||||
// return MessageExoType.FROM_RIGHT;
|
||||
// }
|
||||
// if (arrow.endsWith(">]")) {
|
||||
// return MessageExoType.TO_RIGHT;
|
||||
// }
|
||||
// throw new IllegalArgumentException(arrow);
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -39,8 +39,10 @@ import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
public class CommandExoArrowLeft extends CommandExoArrowAny {
|
||||
|
||||
public CommandExoArrowLeft(SequenceDiagram sequenceDiagram) {
|
||||
super(sequenceDiagram,
|
||||
"(?i)^(\\[?[=-]+>{1,2}|\\[?\\<{1,2}[=-]+)\\s*([\\p{L}0-9_.]+|\"[^\"]+\")\\s*(?::\\s*(.*))?$", 0, 1);
|
||||
super(
|
||||
sequenceDiagram,
|
||||
"(?i)^(\\[?[=-]+(?:>>?|//?|\\\\\\\\?)|\\[?(?:<<?|//?|\\\\\\\\?)[=-]+)\\s*([\\p{L}0-9_.]+|\"[^\"]+\")\\s*(?::\\s*(.*))?$",
|
||||
0, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -51,6 +53,12 @@ public class CommandExoArrowLeft extends CommandExoArrowAny {
|
||||
if (arrow.contains("<")) {
|
||||
return MessageExoType.TO_LEFT;
|
||||
}
|
||||
if (arrow.startsWith("/") || arrow.startsWith("[/") || arrow.startsWith("\\") || arrow.startsWith("[\\")) {
|
||||
return MessageExoType.TO_LEFT;
|
||||
}
|
||||
if (arrow.endsWith("\\") || arrow.endsWith("/")) {
|
||||
return MessageExoType.FROM_LEFT;
|
||||
}
|
||||
throw new IllegalArgumentException(arrow);
|
||||
}
|
||||
|
||||
|
@ -39,10 +39,8 @@ import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
public class CommandExoArrowRight extends CommandExoArrowAny {
|
||||
|
||||
public CommandExoArrowRight(SequenceDiagram sequenceDiagram) {
|
||||
super(
|
||||
sequenceDiagram,
|
||||
"(?i)^([\\p{L}0-9_.]+|\"[^\"]+\")\\s*([=-]+>{1,2}\\]?|\\<{1,2}[=-]+\\]?)\\s*(?::\\s*(.*))?$",
|
||||
1, 0);
|
||||
super(sequenceDiagram,
|
||||
"(?i)^([\\p{L}0-9_.]+|\"[^\"]+\")\\s*([=-]+(?:>>?|//?|\\\\\\\\?)\\]?|(?:<<?|//?|\\\\\\\\?)[=-]+\\]?)\\s*(?::\\s*(.*))?$", 1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -53,7 +51,13 @@ public class CommandExoArrowRight extends CommandExoArrowAny {
|
||||
if (arrow.contains(">")) {
|
||||
return MessageExoType.TO_RIGHT;
|
||||
}
|
||||
if (arrow.startsWith("/") || arrow.startsWith("\\")) {
|
||||
return MessageExoType.FROM_RIGHT;
|
||||
}
|
||||
if (arrow.endsWith("\\]") || arrow.endsWith("/]") || arrow.endsWith("\\") || arrow.endsWith("/")) {
|
||||
return MessageExoType.TO_RIGHT;
|
||||
}
|
||||
throw new IllegalArgumentException(arrow);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5275 $
|
||||
* Revision $Revision: 5928 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
@ -43,6 +43,7 @@ import net.sourceforge.plantuml.sequencediagram.InGroupableList;
|
||||
import net.sourceforge.plantuml.sequencediagram.LifeEvent;
|
||||
import net.sourceforge.plantuml.sequencediagram.Message;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.skin.ArrowDirection;
|
||||
import net.sourceforge.plantuml.skin.ComponentType;
|
||||
|
||||
class Step1Message extends Step1Abstract {
|
||||
@ -78,8 +79,8 @@ class Step1Message extends Step1Abstract {
|
||||
final Arrow graphic = createArrow();
|
||||
final double arrowYStartLevel = graphic.getArrowYStartLevel(getStringBounder());
|
||||
final double arrowYEndLevel = graphic.getArrowYEndLevel(getStringBounder());
|
||||
|
||||
//final double delta1 = isSelfMessage() ? 4 : 0;
|
||||
|
||||
// final double delta1 = isSelfMessage() ? 4 : 0;
|
||||
final double delta1 = 0;
|
||||
|
||||
for (LifeEvent lifeEvent : getMessage().getLiveEvents()) {
|
||||
@ -192,22 +193,32 @@ class Step1Message extends Step1Abstract {
|
||||
}
|
||||
|
||||
private ComponentType getSelfArrowType(Message m) {
|
||||
return m.isDotted() ? ComponentType.DOTTED_SELF_ARROW : ComponentType.SELF_ARROW;
|
||||
ComponentType result = m.getArrowConfiguration().isDotted() ? ComponentType.getArrow(ArrowDirection.SELF)
|
||||
.withDotted() : ComponentType.getArrow(ArrowDirection.SELF);
|
||||
if (m.getArrowConfiguration().isDotted()) {
|
||||
result = result.withDotted();
|
||||
}
|
||||
if (m.getArrowConfiguration().isASync()) {
|
||||
result = result.withAsync();
|
||||
}
|
||||
result = result.withPart(m.getArrowConfiguration().getPart());
|
||||
return result;
|
||||
}
|
||||
|
||||
private ComponentType getArrowType(Message m, final double x1, final double x2) {
|
||||
ComponentType result = null;
|
||||
if (x2 > x1) {
|
||||
result = ComponentType.ARROW;
|
||||
result = ComponentType.getArrow(ArrowDirection.LEFT_TO_RIGHT_NORMAL);
|
||||
} else {
|
||||
result = ComponentType.RETURN_ARROW;
|
||||
result = ComponentType.getArrow(ArrowDirection.RIGHT_TO_LEFT_REVERSE);
|
||||
}
|
||||
if (m.isDotted()) {
|
||||
result = result.getDotted();
|
||||
if (m.getArrowConfiguration().isDotted()) {
|
||||
result = result.withDotted();
|
||||
}
|
||||
if (m.isFull() == false) {
|
||||
result = result.getAsync();
|
||||
if (m.getArrowConfiguration().isASync()) {
|
||||
result = result.withAsync();
|
||||
}
|
||||
result = result.withPart(m.getArrowConfiguration().getPart());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,9 @@ import net.sourceforge.plantuml.sequencediagram.LifeEvent;
|
||||
import net.sourceforge.plantuml.sequencediagram.MessageExo;
|
||||
import net.sourceforge.plantuml.sequencediagram.MessageExoType;
|
||||
import net.sourceforge.plantuml.sequencediagram.MessageNumber;
|
||||
import net.sourceforge.plantuml.skin.ArrowBody;
|
||||
import net.sourceforge.plantuml.skin.ArrowDirection;
|
||||
import net.sourceforge.plantuml.skin.ArrowHead;
|
||||
import net.sourceforge.plantuml.skin.ComponentType;
|
||||
|
||||
class Step1MessageExo extends Step1Abstract {
|
||||
@ -139,16 +142,17 @@ class Step1MessageExo extends Step1Abstract {
|
||||
ComponentType result = null;
|
||||
final MessageExoType type = m.getType();
|
||||
if (type.getDirection() == 1) {
|
||||
result = ComponentType.ARROW;
|
||||
result = ComponentType.getArrow(ArrowDirection.LEFT_TO_RIGHT_NORMAL);
|
||||
} else {
|
||||
result = ComponentType.RETURN_ARROW;
|
||||
result = ComponentType.getArrow(ArrowDirection.RIGHT_TO_LEFT_REVERSE);
|
||||
}
|
||||
if (m.isDotted()) {
|
||||
result = result.getDotted();
|
||||
if (m.getArrowConfiguration().isDotted()) {
|
||||
result = result.withDotted();
|
||||
}
|
||||
if (m.isFull() == false) {
|
||||
result = result.getAsync();
|
||||
if (m.getArrowConfiguration().isASync()) {
|
||||
result = result.withAsync();
|
||||
}
|
||||
result = result.withPart(m.getArrowConfiguration().getPart());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
38
src/net/sourceforge/plantuml/skin/ArrowBody.java
Normal file
38
src/net/sourceforge/plantuml/skin/ArrowBody.java
Normal file
@ -0,0 +1,38 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, 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 Lesser 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: 5191 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin;
|
||||
|
||||
public enum ArrowBody {
|
||||
NORMAL, DOTTED;
|
||||
}
|
116
src/net/sourceforge/plantuml/skin/ArrowConfiguration.java
Normal file
116
src/net/sourceforge/plantuml/skin/ArrowConfiguration.java
Normal file
@ -0,0 +1,116 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, 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 Lesser 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: 5191 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin;
|
||||
|
||||
public class ArrowConfiguration {
|
||||
|
||||
private final ArrowDirection direction;
|
||||
private final ArrowBody body;
|
||||
private final ArrowHead head;
|
||||
private final ArrowPart part;
|
||||
|
||||
private ArrowConfiguration(ArrowDirection direction, ArrowBody body, ArrowHead head, ArrowPart part) {
|
||||
if (direction == null || body == null || head == null || part == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.part = part;
|
||||
this.direction = direction;
|
||||
this.body = body;
|
||||
this.head = head;
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return direction.name().substring(0, 4) + "-" + body.name() + "-" + head.name() + "-"
|
||||
+ part.name().substring(0, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return direction.hashCode() + body.hashCode() + head.hashCode() + part.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
final ArrowConfiguration this2 = (ArrowConfiguration) other;
|
||||
return direction == this2.direction && body == this2.body && head == this2.head && part == this2.part;
|
||||
}
|
||||
|
||||
public static ArrowConfiguration withDirection(ArrowDirection direction) {
|
||||
return new ArrowConfiguration(direction, ArrowBody.NORMAL, ArrowHead.NORMAL, ArrowPart.FULL);
|
||||
}
|
||||
|
||||
public ArrowConfiguration withAsync() {
|
||||
return new ArrowConfiguration(direction, body, ArrowHead.ASYNC, part);
|
||||
}
|
||||
|
||||
public ArrowConfiguration withDotted() {
|
||||
return new ArrowConfiguration(direction, ArrowBody.DOTTED, head, part);
|
||||
}
|
||||
|
||||
public ArrowConfiguration withPart(ArrowPart part) {
|
||||
// if (part != ArrowPart.BOTTOM_PART && part != ArrowPart.TOP_PART) {
|
||||
// throw new IllegalArgumentException();
|
||||
// }
|
||||
return new ArrowConfiguration(direction, body, head, part);
|
||||
}
|
||||
|
||||
public boolean isLeftToRightNormal() {
|
||||
return this.direction == ArrowDirection.LEFT_TO_RIGHT_NORMAL;
|
||||
}
|
||||
|
||||
public boolean isRightToLeftReverse() {
|
||||
return this.direction == ArrowDirection.RIGHT_TO_LEFT_REVERSE;
|
||||
}
|
||||
|
||||
public boolean isSelfArrow() {
|
||||
return this.direction == ArrowDirection.SELF;
|
||||
}
|
||||
|
||||
public boolean isDotted() {
|
||||
return body == ArrowBody.DOTTED;
|
||||
}
|
||||
|
||||
// public boolean isSync() {
|
||||
// return this.head == ArrowHead.NORMAL;
|
||||
// }
|
||||
|
||||
public boolean isASync() {
|
||||
return this.head == ArrowHead.ASYNC;
|
||||
}
|
||||
|
||||
public final ArrowPart getPart() {
|
||||
return part;
|
||||
}
|
||||
|
||||
}
|
38
src/net/sourceforge/plantuml/skin/ArrowDirection.java
Normal file
38
src/net/sourceforge/plantuml/skin/ArrowDirection.java
Normal file
@ -0,0 +1,38 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, 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 Lesser 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: 5191 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin;
|
||||
|
||||
public enum ArrowDirection {
|
||||
LEFT_TO_RIGHT_NORMAL, RIGHT_TO_LEFT_REVERSE, SELF
|
||||
}
|
38
src/net/sourceforge/plantuml/skin/ArrowHead.java
Normal file
38
src/net/sourceforge/plantuml/skin/ArrowHead.java
Normal file
@ -0,0 +1,38 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, 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 Lesser 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: 5191 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin;
|
||||
|
||||
public enum ArrowHead {
|
||||
NORMAL, ASYNC
|
||||
}
|
38
src/net/sourceforge/plantuml/skin/ArrowPart.java
Normal file
38
src/net/sourceforge/plantuml/skin/ArrowPart.java
Normal file
@ -0,0 +1,38 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, 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 Lesser 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: 5191 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin;
|
||||
|
||||
public enum ArrowPart {
|
||||
FULL, TOP_PART, BOTTOM_PART
|
||||
}
|
@ -33,98 +33,134 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin;
|
||||
|
||||
public enum ComponentType {
|
||||
ACTOR_HEAD, ACTOR_LINE, ACTOR_TAIL,
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
ALIVE_LINE, DESTROY,
|
||||
public class ComponentType {
|
||||
|
||||
ARROW, DOTTED_ARROW, DOTTED_SELF_ARROW, RETURN_ARROW, RETURN_DOTTED_ARROW, SELF_ARROW,
|
||||
private static final Map<ArrowConfiguration, ComponentType> arrows = new HashMap<ArrowConfiguration, ComponentType>();
|
||||
private static final List<ComponentType> nonArrows = new ArrayList<ComponentType>();
|
||||
|
||||
ASYNC_ARROW, ASYNC_DOTTED_ARROW, ASYNC_RETURN_ARROW, ASYNC_RETURN_DOTTED_ARROW,
|
||||
static public final ComponentType ACTOR_HEAD = new ComponentType("ACTOR_HEAD");
|
||||
static public final ComponentType ACTOR_LINE = new ComponentType("ACTOR_LINE");
|
||||
static public final ComponentType ACTOR_TAIL = new ComponentType("ACTOR_TAIL");
|
||||
|
||||
GROUPING_BODY, GROUPING_ELSE, GROUPING_HEADER, GROUPING_TAIL,
|
||||
//
|
||||
static public final ComponentType ALIVE_LINE = new ComponentType("ALIVE_LINE");
|
||||
static public final ComponentType DESTROY = new ComponentType("DESTROY");
|
||||
|
||||
NEWPAGE, NOTE, DIVIDER,
|
||||
|
||||
ENGLOBER,
|
||||
//
|
||||
static public final ComponentType GROUPING_BODY = new ComponentType("GROUPING_BODY");
|
||||
static public final ComponentType GROUPING_ELSE = new ComponentType("GROUPING_ELSE");
|
||||
static public final ComponentType GROUPING_HEADER = new ComponentType("GROUPING_HEADER");
|
||||
static public final ComponentType GROUPING_TAIL = new ComponentType("GROUPING_TAIL");
|
||||
//
|
||||
static public final ComponentType NEWPAGE = new ComponentType("NEWPAGE");
|
||||
static public final ComponentType NOTE = new ComponentType("NOTE");
|
||||
static public final ComponentType DIVIDER = new ComponentType("DIVIDER");
|
||||
static public final ComponentType ENGLOBER = new ComponentType("ENGLOBER");
|
||||
|
||||
PARTICIPANT_HEAD, PARTICIPANT_LINE, PARTICIPANT_TAIL,
|
||||
//
|
||||
static public final ComponentType PARTICIPANT_HEAD = new ComponentType("PARTICIPANT_HEAD");
|
||||
static public final ComponentType PARTICIPANT_LINE = new ComponentType("PARTICIPANT_LINE");
|
||||
static public final ComponentType PARTICIPANT_TAIL = new ComponentType("PARTICIPANT_TAIL");
|
||||
|
||||
TITLE, SIGNATURE;
|
||||
//
|
||||
static public final ComponentType TITLE = new ComponentType("TITLE");
|
||||
static public final ComponentType SIGNATURE = new ComponentType("SIGNATURE");
|
||||
|
||||
public ComponentType getDotted() {
|
||||
if (this == ComponentType.ARROW) {
|
||||
return ComponentType.DOTTED_ARROW;
|
||||
} else if (this == ComponentType.DOTTED_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
} else if (this == ComponentType.DOTTED_SELF_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
} else if (this == ComponentType.RETURN_ARROW) {
|
||||
return ComponentType.RETURN_DOTTED_ARROW;
|
||||
} else if (this == ComponentType.RETURN_DOTTED_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
} else if (this == ComponentType.SELF_ARROW) {
|
||||
return ComponentType.DOTTED_SELF_ARROW;
|
||||
} else if (this == ComponentType.ASYNC_ARROW) {
|
||||
return ComponentType.ASYNC_DOTTED_ARROW;
|
||||
} else if (this == ComponentType.ASYNC_DOTTED_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
} else if (this == ComponentType.ASYNC_RETURN_ARROW) {
|
||||
return ComponentType.ASYNC_RETURN_DOTTED_ARROW;
|
||||
} else if (this == ComponentType.ASYNC_RETURN_DOTTED_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public ComponentType getAsync() {
|
||||
if (this == ComponentType.ARROW) {
|
||||
return ComponentType.ASYNC_ARROW;
|
||||
} else if (this == ComponentType.DOTTED_ARROW) {
|
||||
return ComponentType.ASYNC_DOTTED_ARROW;
|
||||
} else if (this == ComponentType.DOTTED_SELF_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
} else if (this == ComponentType.RETURN_ARROW) {
|
||||
return ComponentType.ASYNC_RETURN_ARROW;
|
||||
} else if (this == ComponentType.RETURN_DOTTED_ARROW) {
|
||||
return ComponentType.ASYNC_RETURN_DOTTED_ARROW;
|
||||
} else if (this == ComponentType.SELF_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
} else if (this == ComponentType.ASYNC_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
} else if (this == ComponentType.ASYNC_DOTTED_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
} else if (this == ComponentType.ASYNC_RETURN_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
} else if (this == ComponentType.ASYNC_RETURN_DOTTED_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
throw new UnsupportedOperationException();
|
||||
private final ArrowConfiguration arrowConfiguration;
|
||||
private final String name;
|
||||
|
||||
private ComponentType(String name) {
|
||||
this(name, null);
|
||||
nonArrows.add(this);
|
||||
}
|
||||
|
||||
public ComponentType getReverse() {
|
||||
if (this == ComponentType.ARROW) {
|
||||
return ComponentType.RETURN_ARROW;
|
||||
} else if (this == ComponentType.DOTTED_ARROW) {
|
||||
return ComponentType.RETURN_DOTTED_ARROW;
|
||||
} else if (this == ComponentType.DOTTED_SELF_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
} else if (this == ComponentType.RETURN_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
} else if (this == ComponentType.RETURN_DOTTED_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
} else if (this == ComponentType.SELF_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
} else if (this == ComponentType.ASYNC_ARROW) {
|
||||
return ComponentType.ASYNC_RETURN_ARROW;
|
||||
} else if (this == ComponentType.ASYNC_DOTTED_ARROW) {
|
||||
return ComponentType.ASYNC_RETURN_DOTTED_ARROW;
|
||||
} else if (this == ComponentType.ASYNC_RETURN_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
} else if (this == ComponentType.ASYNC_RETURN_DOTTED_ARROW) {
|
||||
throw new IllegalStateException();
|
||||
private ComponentType(String name, ArrowConfiguration arrowConfiguration) {
|
||||
this.name = name;
|
||||
this.arrowConfiguration = arrowConfiguration;
|
||||
}
|
||||
|
||||
public static ComponentType getArrow(ArrowDirection direction) {
|
||||
final ArrowConfiguration config = ArrowConfiguration.withDirection(direction);
|
||||
return getArrow(config);
|
||||
}
|
||||
|
||||
private static ComponentType getArrow(ArrowConfiguration config) {
|
||||
ComponentType result = arrows.get(config);
|
||||
if (result == null) {
|
||||
result = new ComponentType(config.name(), config);
|
||||
arrows.put(config, result);
|
||||
}
|
||||
throw new UnsupportedOperationException();
|
||||
return result;
|
||||
}
|
||||
|
||||
public ComponentType withAsync() {
|
||||
checkArrow();
|
||||
return ComponentType.getArrow(arrowConfiguration.withAsync());
|
||||
}
|
||||
|
||||
public ComponentType withDotted() {
|
||||
checkArrow();
|
||||
return ComponentType.getArrow(arrowConfiguration.withDotted());
|
||||
}
|
||||
|
||||
public ComponentType withPart(ArrowPart part) {
|
||||
checkArrow();
|
||||
return ComponentType.getArrow(arrowConfiguration.withPart(part));
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public boolean isArrow() {
|
||||
return this.arrowConfiguration != null;
|
||||
}
|
||||
|
||||
private void checkArrow() {
|
||||
if (this.arrowConfiguration == null) {
|
||||
throw new IllegalArgumentException(name());
|
||||
}
|
||||
}
|
||||
|
||||
public static Collection<ComponentType> all() {
|
||||
// ARROW, DOTTED_ARROW, DOTTED_SELF_ARROW, RETURN_ARROW,
|
||||
// RETURN_DOTTED_ARROW, SELF_ARROW,
|
||||
// ASYNC_ARROW, ASYNC_DOTTED_ARROW, ASYNC_RETURN_ARROW,
|
||||
// ASYNC_RETURN_DOTTED_ARROW,
|
||||
|
||||
final List<ComponentType> all = new ArrayList<ComponentType>();
|
||||
all.add(ComponentType.getArrow(ArrowDirection.LEFT_TO_RIGHT_NORMAL));
|
||||
all.add(ComponentType.getArrow(ArrowDirection.RIGHT_TO_LEFT_REVERSE));
|
||||
all.add(ComponentType.getArrow(ArrowDirection.SELF));
|
||||
all.add(ComponentType.getArrow(ArrowDirection.LEFT_TO_RIGHT_NORMAL).withDotted());
|
||||
all.add(ComponentType.getArrow(ArrowDirection.RIGHT_TO_LEFT_REVERSE).withDotted());
|
||||
all.add(ComponentType.getArrow(ArrowDirection.SELF).withDotted());
|
||||
|
||||
for (ComponentType type : new ArrayList<ComponentType>(all)) {
|
||||
all.add(type.withAsync());
|
||||
}
|
||||
|
||||
final List<ComponentType> simples = new ArrayList<ComponentType>(all);
|
||||
for (ComponentType type : simples) {
|
||||
all.add(type.withPart(ArrowPart.TOP_PART));
|
||||
}
|
||||
for (ComponentType type : simples) {
|
||||
all.add(type.withPart(ArrowPart.BOTTOM_PART));
|
||||
}
|
||||
|
||||
all.addAll(nonArrows);
|
||||
return Collections.unmodifiableCollection(all);
|
||||
}
|
||||
|
||||
public final ArrowConfiguration getArrowConfiguration() {
|
||||
return arrowConfiguration;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5728 $
|
||||
* Revision $Revision: 5926 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin.bluemodern;
|
||||
@ -65,6 +65,15 @@ public class BlueModern implements Skin {
|
||||
|
||||
public Component createComponent(ComponentType type, ISkinParam param, List<? extends CharSequence> stringsToDisplay) {
|
||||
|
||||
if (type.isArrow()) {
|
||||
if (type.getArrowConfiguration().isSelfArrow()) {
|
||||
return new ComponentBlueModernSelfArrow(Color.BLACK, Color.BLACK, normalFont, stringsToDisplay, type
|
||||
.getArrowConfiguration().isDotted(), true);
|
||||
}
|
||||
return new ComponentBlueModernArrow(Color.BLACK, Color.BLACK, normalFont, stringsToDisplay, type
|
||||
.getArrowConfiguration().isLeftToRightNormal() ? 1 : -1, type.getArrowConfiguration().isDotted(),
|
||||
type.getArrowConfiguration().isASync()==false);
|
||||
}
|
||||
if (type == ComponentType.PARTICIPANT_HEAD) {
|
||||
return new ComponentBlueModernParticipant(blue1, blue2, Color.WHITE, participantFont, stringsToDisplay);
|
||||
}
|
||||
@ -74,37 +83,6 @@ public class BlueModern implements Skin {
|
||||
if (type == ComponentType.PARTICIPANT_LINE) {
|
||||
return new ComponentBlueModernLine(lineColor);
|
||||
}
|
||||
if (type == ComponentType.SELF_ARROW) {
|
||||
return new ComponentBlueModernSelfArrow(Color.BLACK, Color.BLACK, normalFont, stringsToDisplay, false, true);
|
||||
}
|
||||
if (type == ComponentType.DOTTED_SELF_ARROW) {
|
||||
return new ComponentBlueModernSelfArrow(Color.BLACK, Color.BLACK, normalFont, stringsToDisplay, true, true);
|
||||
}
|
||||
if (type == ComponentType.ARROW) {
|
||||
return new ComponentBlueModernArrow(Color.BLACK, Color.BLACK, normalFont, stringsToDisplay, 1, false, true);
|
||||
}
|
||||
if (type == ComponentType.ASYNC_ARROW) {
|
||||
return new ComponentBlueModernArrow(Color.BLACK, Color.BLACK, normalFont, stringsToDisplay, 1, false, false);
|
||||
}
|
||||
if (type == ComponentType.DOTTED_ARROW) {
|
||||
return new ComponentBlueModernArrow(Color.BLACK, Color.BLACK, normalFont, stringsToDisplay, 1, true, true);
|
||||
}
|
||||
if (type == ComponentType.ASYNC_DOTTED_ARROW) {
|
||||
return new ComponentBlueModernArrow(Color.BLACK, Color.BLACK, normalFont, stringsToDisplay, 1, true, false);
|
||||
}
|
||||
if (type == ComponentType.RETURN_ARROW) {
|
||||
return new ComponentBlueModernArrow(Color.BLACK, Color.BLACK, normalFont, stringsToDisplay, -1, false, true);
|
||||
}
|
||||
if (type == ComponentType.ASYNC_RETURN_ARROW) {
|
||||
return new ComponentBlueModernArrow(Color.BLACK, Color.BLACK, normalFont, stringsToDisplay, -1, false,
|
||||
false);
|
||||
}
|
||||
if (type == ComponentType.RETURN_DOTTED_ARROW) {
|
||||
return new ComponentBlueModernArrow(Color.BLACK, Color.BLACK, normalFont, stringsToDisplay, -1, true, true);
|
||||
}
|
||||
if (type == ComponentType.ASYNC_RETURN_DOTTED_ARROW) {
|
||||
return new ComponentBlueModernArrow(Color.BLACK, Color.BLACK, normalFont, stringsToDisplay, -1, true, false);
|
||||
}
|
||||
if (type == ComponentType.ACTOR_HEAD) {
|
||||
return new ComponentBlueModernActor(blue2, blue1, blue1, participantFont, stringsToDisplay, true);
|
||||
}
|
||||
@ -150,8 +128,8 @@ public class BlueModern implements Skin {
|
||||
"in April 2009."));
|
||||
}
|
||||
if (type == ComponentType.ENGLOBER) {
|
||||
return new ComponentBlueModernEnglober(blue1, blue3, stringsToDisplay, Color.BLACK, param
|
||||
.getFont(FontParam.SEQUENCE_ENGLOBER, null));
|
||||
return new ComponentBlueModernEnglober(blue1, blue3, stringsToDisplay, Color.BLACK, param.getFont(
|
||||
FontParam.SEQUENCE_ENGLOBER, null));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4631 $
|
||||
* Revision $Revision: 5922 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin.rose;
|
||||
@ -40,20 +40,21 @@ import java.util.List;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.skin.AbstractTextualComponent;
|
||||
import net.sourceforge.plantuml.skin.ArrowComponent;
|
||||
import net.sourceforge.plantuml.skin.ArrowConfiguration;
|
||||
|
||||
public abstract class AbstractComponentRoseArrow extends AbstractTextualComponent implements ArrowComponent {
|
||||
|
||||
private final int arrowDeltaX = 10;
|
||||
private final int arrowDeltaY = 4;
|
||||
private final boolean dotted;
|
||||
private final boolean full;
|
||||
// private final boolean dotted;
|
||||
// private final boolean full;
|
||||
private final Color foregroundColor;
|
||||
private final ArrowConfiguration arrowConfiguration;
|
||||
|
||||
public AbstractComponentRoseArrow(Color foregroundColor, Color fontColor, Font font,
|
||||
List<? extends CharSequence> stringsToDisplay, boolean dotted, boolean full) {
|
||||
List<? extends CharSequence> stringsToDisplay, ArrowConfiguration arrowConfiguration) {
|
||||
super(stringsToDisplay, fontColor, font, HorizontalAlignement.LEFT, 7, 7, 2);
|
||||
this.dotted = dotted;
|
||||
this.full = full;
|
||||
this.arrowConfiguration = arrowConfiguration;
|
||||
this.foregroundColor = foregroundColor;
|
||||
}
|
||||
|
||||
@ -74,12 +75,16 @@ public abstract class AbstractComponentRoseArrow extends AbstractTextualComponen
|
||||
return 6;
|
||||
}
|
||||
|
||||
final protected boolean isDotted() {
|
||||
return dotted;
|
||||
public final ArrowConfiguration getArrowConfiguration() {
|
||||
return arrowConfiguration;
|
||||
}
|
||||
|
||||
final protected boolean isFull() {
|
||||
return full;
|
||||
}
|
||||
// final protected boolean isDotted() {
|
||||
// return dotted;
|
||||
// }
|
||||
//
|
||||
// final protected boolean isFull() {
|
||||
// return full;
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4632 $
|
||||
* Revision $Revision: 5926 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin.rose;
|
||||
@ -40,6 +40,8 @@ import java.awt.geom.Point2D;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.skin.ArrowConfiguration;
|
||||
import net.sourceforge.plantuml.skin.ArrowPart;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
@ -47,15 +49,9 @@ import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
|
||||
public class ComponentRoseArrow extends AbstractComponentRoseArrow {
|
||||
|
||||
private final int direction;
|
||||
|
||||
public ComponentRoseArrow(Color foregroundColor, Color fontColor, Font font,
|
||||
List<? extends CharSequence> stringsToDisplay, int direction, boolean dotted, boolean full) {
|
||||
super(foregroundColor, fontColor, font, stringsToDisplay, dotted, full);
|
||||
this.direction = direction;
|
||||
if (direction != 1 && direction != -1) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
List<? extends CharSequence> stringsToDisplay, ArrowConfiguration arrowConfiguration) {
|
||||
super(foregroundColor, fontColor, font, stringsToDisplay, arrowConfiguration);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -66,49 +62,87 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
|
||||
|
||||
final int x2 = (int) dimensionToUse.getWidth();
|
||||
|
||||
if (isDotted()) {
|
||||
if (getArrowConfiguration().isDotted()) {
|
||||
stroke(ug, 2);
|
||||
}
|
||||
|
||||
//
|
||||
ug.draw(0, textHeight, new ULine(x2, 0));
|
||||
if (isDotted()) {
|
||||
if (getArrowConfiguration().isDotted()) {
|
||||
ug.getParam().setStroke(new UStroke());
|
||||
}
|
||||
final int direction = getDirection();
|
||||
if (direction == 1) {
|
||||
if (isFull()) {
|
||||
if (getArrowConfiguration().isASync()) {
|
||||
if (getArrowConfiguration().getPart() != ArrowPart.BOTTOM_PART) {
|
||||
ug.draw(x2, textHeight, new ULine(-getArrowDeltaX(), -getArrowDeltaY()));
|
||||
}
|
||||
if (getArrowConfiguration().getPart() != ArrowPart.TOP_PART) {
|
||||
ug.draw(x2, textHeight, new ULine(-getArrowDeltaX(), getArrowDeltaY()));
|
||||
}
|
||||
} else {
|
||||
ug.getParam().setBackcolor(getForegroundColor());
|
||||
final UPolygon polygon = new UPolygon();
|
||||
polygon.addPoint(x2 - getArrowDeltaX(), textHeight - getArrowDeltaY());
|
||||
polygon.addPoint(x2, textHeight);
|
||||
polygon.addPoint(x2 - getArrowDeltaX(), textHeight + getArrowDeltaY());
|
||||
final UPolygon polygon = getPolygonNormal(textHeight, x2);
|
||||
ug.draw(0, 0, polygon);
|
||||
ug.getParam().setBackcolor(null);
|
||||
} else {
|
||||
ug.draw(x2, textHeight, new ULine(-getArrowDeltaX(), -getArrowDeltaY()));
|
||||
ug.draw(x2, textHeight, new ULine(-getArrowDeltaX(), getArrowDeltaY()));
|
||||
}
|
||||
} else {
|
||||
if (isFull()) {
|
||||
if (getArrowConfiguration().isASync()) {
|
||||
if (getArrowConfiguration().getPart() != ArrowPart.BOTTOM_PART) {
|
||||
ug.draw(0, textHeight, new ULine(getArrowDeltaX(), -getArrowDeltaY()));
|
||||
}
|
||||
if (getArrowConfiguration().getPart() != ArrowPart.TOP_PART) {
|
||||
ug.draw(0, textHeight, new ULine(getArrowDeltaX(), getArrowDeltaY()));
|
||||
}
|
||||
} else {
|
||||
ug.getParam().setBackcolor(getForegroundColor());
|
||||
final UPolygon polygon = new UPolygon();
|
||||
polygon.addPoint(getArrowDeltaX(), textHeight - getArrowDeltaY());
|
||||
polygon.addPoint(0, textHeight);
|
||||
polygon.addPoint(getArrowDeltaX(), textHeight + getArrowDeltaY());
|
||||
final UPolygon polygon = getPolygonReverse(textHeight);
|
||||
ug.draw(0, 0, polygon);
|
||||
ug.getParam().setBackcolor(null);
|
||||
} else {
|
||||
ug.draw(0, textHeight, new ULine(getArrowDeltaX(), -getArrowDeltaY()));
|
||||
ug.draw(0, textHeight, new ULine(getArrowDeltaX(), getArrowDeltaY()));
|
||||
}
|
||||
}
|
||||
getTextBlock().drawU(ug, getMarginX1(), 0);
|
||||
}
|
||||
|
||||
private UPolygon getPolygonNormal(final int textHeight, final int x2) {
|
||||
final UPolygon polygon = new UPolygon();
|
||||
if (getArrowConfiguration().getPart() == ArrowPart.TOP_PART) {
|
||||
polygon.addPoint(x2 - getArrowDeltaX(), textHeight - getArrowDeltaY());
|
||||
polygon.addPoint(x2, textHeight);
|
||||
polygon.addPoint(x2 - getArrowDeltaX(), textHeight);
|
||||
} else if (getArrowConfiguration().getPart() == ArrowPart.BOTTOM_PART) {
|
||||
polygon.addPoint(x2 - getArrowDeltaX(), textHeight);
|
||||
polygon.addPoint(x2, textHeight);
|
||||
polygon.addPoint(x2 - getArrowDeltaX(), textHeight + getArrowDeltaY());
|
||||
} else {
|
||||
polygon.addPoint(x2 - getArrowDeltaX(), textHeight - getArrowDeltaY());
|
||||
polygon.addPoint(x2, textHeight);
|
||||
polygon.addPoint(x2 - getArrowDeltaX(), textHeight + getArrowDeltaY());
|
||||
}
|
||||
return polygon;
|
||||
}
|
||||
|
||||
private UPolygon getPolygonReverse(final int textHeight) {
|
||||
final UPolygon polygon = new UPolygon();
|
||||
if (getArrowConfiguration().getPart() == ArrowPart.TOP_PART) {
|
||||
polygon.addPoint(getArrowDeltaX(), textHeight - getArrowDeltaY());
|
||||
polygon.addPoint(0, textHeight);
|
||||
polygon.addPoint(getArrowDeltaX(), textHeight);
|
||||
} else if (getArrowConfiguration().getPart() == ArrowPart.BOTTOM_PART) {
|
||||
polygon.addPoint(getArrowDeltaX(), textHeight);
|
||||
polygon.addPoint(0, textHeight);
|
||||
polygon.addPoint(getArrowDeltaX(), textHeight + getArrowDeltaY());
|
||||
} else {
|
||||
polygon.addPoint(getArrowDeltaX(), textHeight - getArrowDeltaY());
|
||||
polygon.addPoint(0, textHeight);
|
||||
polygon.addPoint(getArrowDeltaX(), textHeight + getArrowDeltaY());
|
||||
}
|
||||
return polygon;
|
||||
}
|
||||
|
||||
public Point2D getStartPoint(StringBounder stringBounder, Dimension2D dimensionToUse) {
|
||||
final int textHeight = (int) getTextHeight(stringBounder);
|
||||
if (direction == 1) {
|
||||
if (getDirection() == 1) {
|
||||
return new Point2D.Double(getPaddingX(), textHeight + getPaddingY());
|
||||
}
|
||||
return new Point2D.Double(dimensionToUse.getWidth() + getPaddingX(), textHeight + getPaddingY());
|
||||
@ -116,14 +150,20 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
|
||||
|
||||
public Point2D getEndPoint(StringBounder stringBounder, Dimension2D dimensionToUse) {
|
||||
final int textHeight = (int) getTextHeight(stringBounder);
|
||||
if (direction == 1) {
|
||||
if (getDirection() == 1) {
|
||||
return new Point2D.Double(dimensionToUse.getWidth() + getPaddingX(), textHeight + getPaddingY());
|
||||
}
|
||||
return new Point2D.Double(getPaddingX(), textHeight + getPaddingY());
|
||||
}
|
||||
|
||||
final protected int getDirection() {
|
||||
return direction;
|
||||
if (getArrowConfiguration().isLeftToRightNormal()) {
|
||||
return 1;
|
||||
}
|
||||
if (getArrowConfiguration().isRightToLeftReverse()) {
|
||||
return -1;
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4633 $
|
||||
* Revision $Revision: 5926 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin.rose;
|
||||
@ -40,6 +40,8 @@ import java.awt.geom.Point2D;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.skin.ArrowConfiguration;
|
||||
import net.sourceforge.plantuml.skin.ArrowPart;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
@ -50,8 +52,8 @@ public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow {
|
||||
private final double arrowWidth = 45;
|
||||
|
||||
public ComponentRoseSelfArrow(Color foregroundColor, Color colorFont, Font font,
|
||||
List<? extends CharSequence> stringsToDisplay, boolean dotted, boolean full) {
|
||||
super(foregroundColor, colorFont, font, stringsToDisplay, dotted, full);
|
||||
List<? extends CharSequence> stringsToDisplay, ArrowConfiguration arrowConfiguration) {
|
||||
super(foregroundColor, colorFont, font, stringsToDisplay, arrowConfiguration);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -62,7 +64,7 @@ public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow {
|
||||
ug.getParam().setColor(getForegroundColor());
|
||||
final double x2 = arrowWidth;
|
||||
|
||||
if (isDotted()) {
|
||||
if (getArrowConfiguration().isDotted()) {
|
||||
stroke(ug, 2);
|
||||
}
|
||||
|
||||
@ -73,28 +75,45 @@ public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow {
|
||||
ug.draw(x2, textHeight, new ULine(0, textAndArrowHeight - textHeight));
|
||||
ug.draw(0, textAndArrowHeight, new ULine(x2, 0));
|
||||
|
||||
if (isDotted()) {
|
||||
if (getArrowConfiguration().isDotted()) {
|
||||
ug.getParam().setStroke(new UStroke());
|
||||
}
|
||||
|
||||
// ug.draw(0, textAndArrowHeight, new ULine(getArrowDeltaX(), -getArrowDeltaY()));
|
||||
// ug.draw(0, textAndArrowHeight, new ULine(getArrowDeltaX(), getArrowDeltaY()));
|
||||
if (isFull()) {
|
||||
if (getArrowConfiguration().isASync()) {
|
||||
if (getArrowConfiguration().getPart() != ArrowPart.BOTTOM_PART) {
|
||||
ug.draw(0, textAndArrowHeight, new ULine(getArrowDeltaX(), -getArrowDeltaY()));
|
||||
}
|
||||
if (getArrowConfiguration().getPart() != ArrowPart.TOP_PART) {
|
||||
ug.draw(0, textAndArrowHeight, new ULine(getArrowDeltaX(), getArrowDeltaY()));
|
||||
}
|
||||
} else {
|
||||
ug.getParam().setBackcolor(getForegroundColor());
|
||||
final UPolygon polygon = new UPolygon();
|
||||
polygon.addPoint(getArrowDeltaX(), textAndArrowHeight - getArrowDeltaY());
|
||||
polygon.addPoint(0, textAndArrowHeight);
|
||||
polygon.addPoint(getArrowDeltaX(), textAndArrowHeight + getArrowDeltaY());
|
||||
final UPolygon polygon = getPolygon(textAndArrowHeight);
|
||||
ug.draw(0, 0, polygon);
|
||||
ug.getParam().setBackcolor(null);
|
||||
} else {
|
||||
ug.draw(0, textHeight, new ULine(getArrowDeltaX(), -getArrowDeltaY()));
|
||||
ug.draw(0, textHeight, new ULine(getArrowDeltaX(), getArrowDeltaY()));
|
||||
}
|
||||
|
||||
getTextBlock().drawU(ug, getMarginX1(), 0);
|
||||
}
|
||||
|
||||
private UPolygon getPolygon(final double textAndArrowHeight) {
|
||||
final UPolygon polygon = new UPolygon();
|
||||
if (getArrowConfiguration().getPart() == ArrowPart.TOP_PART) {
|
||||
polygon.addPoint(getArrowDeltaX(), textAndArrowHeight - getArrowDeltaY());
|
||||
polygon.addPoint(0, textAndArrowHeight);
|
||||
polygon.addPoint(getArrowDeltaX(), textAndArrowHeight);
|
||||
} else if (getArrowConfiguration().getPart() == ArrowPart.BOTTOM_PART) {
|
||||
polygon.addPoint(getArrowDeltaX(), textAndArrowHeight);
|
||||
polygon.addPoint(0, textAndArrowHeight);
|
||||
polygon.addPoint(getArrowDeltaX(), textAndArrowHeight + getArrowDeltaY());
|
||||
} else {
|
||||
polygon.addPoint(getArrowDeltaX(), textAndArrowHeight - getArrowDeltaY());
|
||||
polygon.addPoint(0, textAndArrowHeight);
|
||||
polygon.addPoint(getArrowDeltaX(), textAndArrowHeight + getArrowDeltaY());
|
||||
}
|
||||
return polygon;
|
||||
}
|
||||
|
||||
public Point2D getStartPoint(StringBounder stringBounder, Dimension2D dimensionToUse) {
|
||||
final int textHeight = (int) getTextHeight(stringBounder);
|
||||
return new Point2D.Double(getPaddingX(), textHeight + getPaddingY());
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5823 $
|
||||
* Revision $Revision: 5922 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin.rose;
|
||||
@ -124,12 +124,11 @@ public class Rose implements Skin {
|
||||
public Color getFontColor(ISkinParam skin, FontParam fontParam) {
|
||||
return skin.getFontHtmlColor(fontParam, null).getColor();
|
||||
}
|
||||
|
||||
|
||||
public HtmlColor getHtmlColor(ISkinParam param, ColorParam color) {
|
||||
return getHtmlColor(param, color, null);
|
||||
}
|
||||
|
||||
|
||||
public HtmlColor getHtmlColor(ISkinParam param, ColorParam color, String stereotype) {
|
||||
HtmlColor result = param.getHtmlColor(color, stereotype);
|
||||
if (result == null) {
|
||||
@ -158,48 +157,15 @@ public class Rose implements Skin {
|
||||
final Font fontParticipant = param.getFont(FontParam.SEQUENCE_PARTICIPANT, null);
|
||||
final Font fontActor = param.getFont(FontParam.SEQUENCE_ACTOR, null);
|
||||
|
||||
if (type == ComponentType.SELF_ARROW) {
|
||||
return new ComponentRoseSelfArrow(sequenceArrow, getFontColor(param, FontParam.SEQUENCE_ARROW), fontArrow,
|
||||
stringsToDisplay, false, true);
|
||||
}
|
||||
if (type == ComponentType.DOTTED_SELF_ARROW) {
|
||||
return new ComponentRoseSelfArrow(sequenceArrow, getFontColor(param, FontParam.SEQUENCE_ARROW), fontArrow,
|
||||
stringsToDisplay, true, true);
|
||||
}
|
||||
if (type == ComponentType.ARROW) {
|
||||
if (type.isArrow()) {
|
||||
if (type.getArrowConfiguration().isSelfArrow()) {
|
||||
return new ComponentRoseSelfArrow(sequenceArrow, getFontColor(param, FontParam.SEQUENCE_ARROW),
|
||||
fontArrow, stringsToDisplay, type.getArrowConfiguration());
|
||||
}
|
||||
return new ComponentRoseArrow(sequenceArrow, getFontColor(param, FontParam.SEQUENCE_ARROW), fontArrow,
|
||||
stringsToDisplay, 1, false, true);
|
||||
}
|
||||
if (type == ComponentType.ASYNC_ARROW) {
|
||||
return new ComponentRoseArrow(sequenceArrow, getFontColor(param, FontParam.SEQUENCE_ARROW), fontArrow,
|
||||
stringsToDisplay, 1, false, false);
|
||||
}
|
||||
stringsToDisplay, type.getArrowConfiguration());
|
||||
|
||||
if (type == ComponentType.RETURN_ARROW) {
|
||||
return new ComponentRoseArrow(sequenceArrow, getFontColor(param, FontParam.SEQUENCE_ARROW), fontArrow,
|
||||
stringsToDisplay, -1, false, true);
|
||||
}
|
||||
if (type == ComponentType.ASYNC_RETURN_ARROW) {
|
||||
return new ComponentRoseArrow(sequenceArrow, getFontColor(param, FontParam.SEQUENCE_ARROW), fontArrow,
|
||||
stringsToDisplay, -1, false, false);
|
||||
}
|
||||
if (type == ComponentType.DOTTED_ARROW) {
|
||||
return new ComponentRoseArrow(sequenceArrow, getFontColor(param, FontParam.SEQUENCE_ARROW), fontArrow,
|
||||
stringsToDisplay, 1, true, true);
|
||||
}
|
||||
if (type == ComponentType.ASYNC_DOTTED_ARROW) {
|
||||
return new ComponentRoseArrow(sequenceArrow, getFontColor(param, FontParam.SEQUENCE_ARROW), fontArrow,
|
||||
stringsToDisplay, 1, true, false);
|
||||
}
|
||||
if (type == ComponentType.RETURN_DOTTED_ARROW) {
|
||||
return new ComponentRoseArrow(sequenceArrow, getFontColor(param, FontParam.SEQUENCE_ARROW), fontArrow,
|
||||
stringsToDisplay, -1, true, true);
|
||||
}
|
||||
if (type == ComponentType.ASYNC_RETURN_DOTTED_ARROW) {
|
||||
return new ComponentRoseArrow(sequenceArrow, getFontColor(param, FontParam.SEQUENCE_ARROW), fontArrow,
|
||||
stringsToDisplay, -1, true, false);
|
||||
}
|
||||
|
||||
if (type == ComponentType.PARTICIPANT_HEAD) {
|
||||
final Color borderColor = getHtmlColor(param, ColorParam.sequenceParticipantBorder).getColor();
|
||||
return new ComponentRoseParticipant(sequenceParticipantBackground, borderColor, getFontColor(param,
|
||||
@ -262,12 +228,12 @@ public class Rose implements Skin {
|
||||
return new ComponentRoseNewpage(getFontColor(param, FontParam.SEQUENCE_GROUPING));
|
||||
}
|
||||
if (type == ComponentType.DIVIDER) {
|
||||
return new ComponentRoseDivider(getFontColor(param, FontParam.SEQUENCE_DIVIDER), param
|
||||
.getFont(FontParam.SEQUENCE_DIVIDER, null), sequenceDividerBackground, stringsToDisplay);
|
||||
return new ComponentRoseDivider(getFontColor(param, FontParam.SEQUENCE_DIVIDER), param.getFont(
|
||||
FontParam.SEQUENCE_DIVIDER, null), sequenceDividerBackground, stringsToDisplay);
|
||||
}
|
||||
if (type == ComponentType.TITLE) {
|
||||
return new ComponentRoseTitle(getFontColor(param, FontParam.SEQUENCE_TITLE), param
|
||||
.getFont(FontParam.SEQUENCE_TITLE, null), stringsToDisplay);
|
||||
return new ComponentRoseTitle(getFontColor(param, FontParam.SEQUENCE_TITLE), param.getFont(
|
||||
FontParam.SEQUENCE_TITLE, null), stringsToDisplay);
|
||||
}
|
||||
if (type == ComponentType.SIGNATURE) {
|
||||
return new ComponentRoseTitle(Color.BLACK, fontGrouping, Arrays.asList("This skin was created ",
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5912 $
|
||||
* Revision $Revision: 5931 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.version;
|
||||
@ -36,11 +36,11 @@ package net.sourceforge.plantuml.version;
|
||||
public class Version {
|
||||
|
||||
public static int version() {
|
||||
return 5911;
|
||||
return 5930;
|
||||
}
|
||||
|
||||
public static long compileTime() {
|
||||
return 1294598580421L;
|
||||
return 1294686127593L;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user