Version 5994

This commit is contained in:
Arnaud Roques 2011-01-12 20:06:53 +01:00
parent a80a3daf68
commit 6ace15b789
34 changed files with 762 additions and 165 deletions

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5218 $
* Revision $Revision: 5942 $
*
*/
package net.sourceforge.plantuml;
@ -57,6 +57,7 @@ public enum FontParam {
SEQUENCE_ARROW(13, Font.PLAIN, "black", null),
SEQUENCE_ENGLOBER(13, Font.BOLD, "black", null),
SEQUENCE_DIVIDER(13, Font.BOLD, "black", null),
SEQUENCE_DELAY(11, Font.PLAIN, "black", null),
SEQUENCE_GROUPING(11, Font.BOLD, "black", null),
SEQUENCE_GROUPING_HEADER(13, Font.BOLD, "black", null),
SEQUENCE_PARTICIPANT(13, Font.PLAIN, "black", null),

View File

@ -33,13 +33,14 @@
*/
package net.sourceforge.plantuml.activitydiagram2;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.UniqueSequence;
import net.sourceforge.plantuml.activitydiagram.ConditionalContext;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Entity;
import net.sourceforge.plantuml.cucadiagram.EntityType;
@ -50,8 +51,9 @@ import net.sourceforge.plantuml.cucadiagram.LinkType;
public class ActivityDiagram2 extends CucaDiagram {
private IEntity last;
private ConditionalContext currentContext;
private Collection<IEntity> last2 = new ArrayList<IEntity>();
private ConditionalContext2 currentContext;
private int futureLength = 2;
final protected List<String> getDotStrings() {
return Arrays.asList("nodesep=.20;", "ranksep=0.4;", "edge [fontsize=11,labelfontsize=11];",
@ -68,12 +70,16 @@ public class ActivityDiagram2 extends CucaDiagram {
}
public void newActivity(String display) {
if (last == null) {
if (last2.size() == 0) {
throw new IllegalStateException();
}
final Entity act = createEntity(getAutoCode(), display, EntityType.ACTIVITY);
this.addLink(new Link(last, act, new LinkType(LinkDecor.ARROW, LinkDecor.NONE), null, 2));
last = act;
for (IEntity last : this.last2) {
this.addLink(new Link(last, act, new LinkType(LinkDecor.ARROW, LinkDecor.NONE), null, futureLength));
}
this.last2.clear();
this.last2.add(act);
this.futureLength = 2;
}
@ -82,25 +88,36 @@ public class ActivityDiagram2 extends CucaDiagram {
}
public void start() {
if (last != null) {
if (last2.size() != 0) {
throw new IllegalStateException();
}
last = createEntity("start", "start", EntityType.CIRCLE_START);
this.last2.add(createEntity("start", "start", EntityType.CIRCLE_START));
}
public void startIf(String test) {
final IEntity br = createEntity(getAutoCode(), "", EntityType.BRANCH);
currentContext = new ConditionalContext(currentContext, br, Direction.DOWN);
this.addLink(new Link(last, br, new LinkType(LinkDecor.ARROW, LinkDecor.NONE), null, 2));
last = br;
currentContext = new ConditionalContext2(currentContext, br, Direction.DOWN);
for (IEntity last : this.last2) {
this.addLink(new Link(last, br, new LinkType(LinkDecor.ARROW, LinkDecor.NONE), null, futureLength));
}
this.last2.clear();
this.last2.add(br);
this.futureLength = 1;
}
public IEntity getLastEntityConsulted() {
return last;
public Collection<IEntity> getLastEntityConsulted2() {
return this.last2;
}
public void endif() {
this.last2.add(currentContext.getPending());
currentContext = currentContext.getParent();
}
public void else2() {
this.currentContext.setPending(this.last2.iterator().next());
this.last2.clear();
this.last2.add(currentContext.getBranch());
}
}

View File

@ -33,6 +33,7 @@
*/
package net.sourceforge.plantuml.activitydiagram2;
import net.sourceforge.plantuml.activitydiagram2.command.CommandElse2;
import net.sourceforge.plantuml.activitydiagram2.command.CommandEndif2;
import net.sourceforge.plantuml.activitydiagram2.command.CommandIf2;
import net.sourceforge.plantuml.activitydiagram2.command.CommandNewActivity;
@ -56,6 +57,7 @@ public class ActivityDiagramFactory2 extends AbstractUmlSystemCommandFactory {
addCommand(new CommandNewActivity(system));
addCommand(new CommandIf2(system));
addCommand(new CommandEndif2(system));
addCommand(new CommandElse2(system));
// addCommand(new CommandLinkActivity(system));
// addCommand(new CommandPartition(system));

View File

@ -0,0 +1,81 @@
/* ========================================================================
* 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: 3828 $
*
*/
package net.sourceforge.plantuml.activitydiagram2;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.cucadiagram.EntityType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
public class ConditionalContext2 {
private IEntity pending;
private final IEntity branch;
private final Direction direction;
private final ConditionalContext2 parent;
public ConditionalContext2(ConditionalContext2 parent, IEntity branch, Direction direction) {
if (branch.getType() != EntityType.BRANCH) {
throw new IllegalArgumentException();
}
this.branch = branch;
this.direction = direction;
this.parent = parent;
this.pending = branch;
}
public Direction getDirection() {
return direction;
}
public final ConditionalContext2 getParent() {
return parent;
}
public final IEntity getPending() {
return pending;
}
public final void setPending(IEntity pending) {
this.pending = pending;
}
public final IEntity getBranch() {
return branch;
}
}

View File

@ -0,0 +1,68 @@
/* ========================================================================
* 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: 4762 $
*
*/
package net.sourceforge.plantuml.activitydiagram2.command;
import java.util.Map;
import net.sourceforge.plantuml.activitydiagram2.ActivityDiagram2;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexPartialMatch;
public class CommandElse2 extends SingleLineCommand2<ActivityDiagram2> {
public CommandElse2(ActivityDiagram2 diagram) {
super(diagram, getRegexConcat());
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"),
new RegexLeaf("else"),
new RegexLeaf("$"));
}
@Override
protected CommandExecutionResult executeArg(Map<String, RegexPartialMatch> arg) {
// if (getSystem().getLastEntityConsulted() == null) {
// return CommandExecutionResult.error("No if for this endif");
// }
getSystem().else2();
return CommandExecutionResult.ok();
}
}

View File

@ -57,9 +57,9 @@ public class CommandEndif2 extends SingleLineCommand2<ActivityDiagram2> {
@Override
protected CommandExecutionResult executeArg(Map<String, RegexPartialMatch> arg) {
if (getSystem().getLastEntityConsulted() == null) {
return CommandExecutionResult.error("No if for this endif");
}
// if (getSystem().getLastEntityConsulted() == null) {
// return CommandExecutionResult.error("No if for this endif");
// }
getSystem().endif();
return CommandExecutionResult.ok();

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5921 $
* Revision $Revision: 5941 $
*
*/
package net.sourceforge.plantuml.asciiart;
@ -67,6 +67,9 @@ public class TextSkin implements Skin {
if (type == ComponentType.PARTICIPANT_LINE || type == ComponentType.ACTOR_LINE) {
return new ComponentTextLine(fileFormat);
}
if (type == ComponentType.DELAY_LINE) {
return new ComponentTextLine(fileFormat);
}
if (type == ComponentType.ALIVE_LINE) {
return new ComponentTextActiveLine(fileFormat);
}

View File

@ -46,9 +46,6 @@ import net.sourceforge.plantuml.cucadiagram.LinkType;
public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram {
// private Link last = null;
// private IEntity lastNode = null;
final public boolean insertBetween(IEntity entity1, IEntity entity2, IEntity node) {
final Link link = foundLink(entity1, entity2);
if (link == null) {
@ -65,18 +62,14 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
}
private Link foundLink(IEntity entity1, IEntity entity2) {
Link result = null;
final List<Link> links = getLinks();
for (int i = links.size() - 1; i >= 0; i--) {
final Link l = links.get(i);
if (l.isBetween(entity1, entity2)) {
if (result != null) {
return null;
}
result = l;
return l;
}
}
return result;
return null;
}
public int getNbOfHozizontalLollipop(IEntity entity) {
@ -93,35 +86,6 @@ public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram
return result;
}
// final public void insertBetweenNew(IEntity entity1, IEntity entity2,
// IEntity node) {
// Link link = foundLink(entity1, entity2);
// if (link == null) {
// link = last;
// }
// final Link l1 = new Link(entity1, node, link.getType(), link.getLabel(),
// link.getLength(),
// link.getQualifier1(), null, link.getLabeldistance(),
// link.getLabelangle());
// final Link l2 = new Link(node, entity2, link.getType(), link.getLabel(),
// link.getLength(), null, link
// .getQualifier2(), link.getLabeldistance(), link.getLabelangle());
// addLink(l1);
// addLink(l2);
// if (last == null) {
// removeLink(link);
// } else {
// final Link lnode = new Link(lastNode, node, link.getType(),
// link.getLabel(), 1);
// lnode.setInvis(true);
// // lnode.setWeight(100);
// addLink(lnode);
// }
// last = link;
// lastNode = node;
// // return true;
// }
private final List<Association> assocations = new ArrayList<Association>();
public boolean associationClass(int mode, String clName1, String clName2, IEntity associed, LinkType linkType,

View File

@ -77,7 +77,7 @@ public class PathDrawerInterface implements PathDrawer {
}
private void goDash(UGraphic ug) {
ug.getParam().setStroke(new UStroke(8, 1.0));
ug.getParam().setStroke(new UStroke(8, 8, 1.0));
}
public void drawPathAfter(UGraphic ug, Positionable start, Positionable end, Path path) {

View File

@ -0,0 +1,50 @@
/* ========================================================================
* 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: 3835 $
*
*/
package net.sourceforge.plantuml.sequencediagram;
import java.util.List;
public class Delay implements Event {
private final List<String> text;
public Delay(List<String> text) {
this.text = text;
}
public final List<String> getText() {
return text;
}
}

View File

@ -143,6 +143,10 @@ public class SequenceDiagram extends UmlDiagram {
events.add(new Divider(strings));
}
public void delay(List<String> strings) {
events.add(new Delay(strings));
}
public List<Event> events() {
return Collections.unmodifiableList(events);
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5925 $
* Revision $Revision: 5933 $
*
*/
package net.sourceforge.plantuml.sequencediagram;
@ -41,6 +41,7 @@ import net.sourceforge.plantuml.sequencediagram.command.CommandAutoNewpage;
import net.sourceforge.plantuml.sequencediagram.command.CommandAutonumber;
import net.sourceforge.plantuml.sequencediagram.command.CommandBoxEnd;
import net.sourceforge.plantuml.sequencediagram.command.CommandBoxStart;
import net.sourceforge.plantuml.sequencediagram.command.CommandDelay;
import net.sourceforge.plantuml.sequencediagram.command.CommandDivider;
import net.sourceforge.plantuml.sequencediagram.command.CommandExoArrowLeft;
import net.sourceforge.plantuml.sequencediagram.command.CommandExoArrowRight;
@ -97,6 +98,7 @@ public class SequenceDiagramFactory extends AbstractUmlSystemCommandFactory {
addCommand(new CommandSkin(system));
addCommand(new CommandAutonumber(system));
addCommand(new CommandFootbox(system));
addCommand(new CommandDelay(system));
addCommand(new CommandFootboxOld(system));
}

View File

@ -0,0 +1,57 @@
/* ========================================================================
* 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: 5158 $
*
*/
package net.sourceforge.plantuml.sequencediagram.command;
import java.util.Collections;
import java.util.List;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
public class CommandDelay extends SingleLineCommand<SequenceDiagram> {
public CommandDelay(SequenceDiagram sequenceDiagram) {
super(sequenceDiagram, "(?i)^\\.{3}(?:(.*)\\.{3})?$$");
}
@Override
protected CommandExecutionResult executeArg(List<String> arg) {
final List<String> strings = arg.get(0) == null ? Collections.<String> emptyList() : StringUtils
.getWithNewlines(arg.get(0));
getSystem().delay(strings);
return CommandExecutionResult.ok();
}
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5875 $
* Revision $Revision: 5942 $
*
*/
package net.sourceforge.plantuml.sequencediagram.graphic;
@ -42,6 +42,7 @@ import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParamBackcolored;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.sequencediagram.Delay;
import net.sourceforge.plantuml.sequencediagram.Divider;
import net.sourceforge.plantuml.sequencediagram.Event;
import net.sourceforge.plantuml.sequencediagram.GroupingLeaf;
@ -136,6 +137,8 @@ class DrawableSetInitializer {
prepareNewpage(stringBounder, (Newpage) ev);
} else if (ev instanceof Divider) {
prepareDivider(stringBounder, (Divider) ev);
} else if (ev instanceof Delay) {
prepareDelay(stringBounder, (Delay) ev, col);
} else {
throw new IllegalStateException();
}
@ -251,6 +254,17 @@ class DrawableSetInitializer {
drawableSet.addEvent(divider, graphicalDivider);
}
private void prepareDelay(StringBounder stringBounder, Delay delay, Collection<ParticipantBox> participants) {
final Component compText = drawableSet.getSkin().createComponent(ComponentType.DELAY_TEXT,
drawableSet.getSkinParam(), delay.getText());
final GraphicalDelayText graphicalDivider = new GraphicalDelayText(freeY, compText);
for (ParticipantBox p : participants) {
p.addDelay(graphicalDivider);
}
freeY += graphicalDivider.getPreferredHeight(stringBounder);
drawableSet.addEvent(delay, graphicalDivider);
}
private List<InGroupableList> inGroupableLists = new ArrayList<InGroupableList>();
private void prepareGroupingStart(StringBounder stringBounder, GroupingStart m) {
@ -375,7 +389,9 @@ class DrawableSetInitializer {
p.getDisplay());
final Component line = drawableSet.getSkin().createComponent(ComponentType.PARTICIPANT_LINE,
drawableSet.getSkinParam(), p.getDisplay());
box = new ParticipantBox(head, line, tail, this.freeX);
final Component delayLine = drawableSet.getSkin().createComponent(ComponentType.DELAY_LINE,
drawableSet.getSkinParam(), p.getDisplay());
box = new ParticipantBox(head, line, tail, delayLine, this.freeX);
} else if (p.getType() == ParticipantType.ACTOR) {
final ISkinParam skinParam = new SkinParamBackcolored(drawableSet.getSkinParam(), p.getSpecificBackColor());
final Component head = drawableSet.getSkin().createComponent(ComponentType.ACTOR_HEAD, skinParam,
@ -384,7 +400,9 @@ class DrawableSetInitializer {
p.getDisplay());
final Component line = drawableSet.getSkin().createComponent(ComponentType.ACTOR_LINE,
drawableSet.getSkinParam(), p.getDisplay());
box = new ParticipantBox(head, line, tail, this.freeX);
final Component delayLine = drawableSet.getSkin().createComponent(ComponentType.DELAY_LINE,
drawableSet.getSkinParam(), p.getDisplay());
box = new ParticipantBox(head, line, tail, delayLine, this.freeX);
} else {
throw new IllegalArgumentException();
}

View File

@ -0,0 +1,80 @@
/* ========================================================================
* 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: 3916 $
*
*/
package net.sourceforge.plantuml.sequencediagram.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.ugraphic.UGraphic;
class GraphicalDelayText extends GraphicalElement {
private final Component compText;
public GraphicalDelayText(double startingY, Component compText) {
super(startingY);
this.compText = compText;
}
@Override
protected void drawInternalU(UGraphic ug, double maxX, Context2D context) {
ug.translate(0, getStartingY());
final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D dim = new Dimension2DDouble(maxX, compText.getPreferredHeight(stringBounder));
compText.drawU(ug, dim, context);
}
@Override
public double getPreferredHeight(StringBounder stringBounder) {
return compText.getPreferredHeight(stringBounder);
}
@Override
public double getPreferredWidth(StringBounder stringBounder) {
return compText.getPreferredWidth(stringBounder);
}
@Override
public double getStartingX(StringBounder stringBounder) {
return 0;
}
public double getEndingY(StringBounder stringBounder) {
return getStartingY() + compText.getPreferredHeight(stringBounder);
}
}

View File

@ -52,7 +52,6 @@ class GraphicalDivider extends GraphicalElement {
@Override
protected void drawInternalU(UGraphic ug, double maxX, Context2D context) {
//final double x = ug.getTranslateX();
ug.translate(0, getStartingY());
final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D dim = new Dimension2DDouble(maxX, comp.getPreferredHeight(stringBounder));

View File

@ -28,11 +28,14 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5249 $
* Revision $Revision: 5942 $
*
*/
package net.sourceforge.plantuml.sequencediagram.graphic;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.skin.Component;
@ -50,13 +53,15 @@ public class ParticipantBox implements Pushable {
private final Component head;
private final Component line;
private final Component tail;
private final Component delayLine;
private int cpt = CPT++;
public ParticipantBox(Component head, Component line, Component tail, double startingX) {
public ParticipantBox(Component head, Component line, Component tail, Component delayLine, double startingX) {
this.startingX = startingX;
this.head = head;
this.line = line;
this.tail = tail;
this.delayLine = delayLine;
}
@Override
@ -107,11 +112,12 @@ public class ParticipantBox implements Pushable {
}
if (positionTail > 0) {
// final double y2 = positionTail - topStartingY + line.getPreferredHeight(stringBounder) / 2 - 1;
// final double y2 = positionTail - topStartingY +
// line.getPreferredHeight(stringBounder) / 2 - 1;
positionTail += line.getPreferredHeight(stringBounder) / 2 - 1;
// if (y2 != y22) {
// throw new IllegalStateException();
// }
// if (y2 != y22) {
// throw new IllegalStateException();
// }
ug.translate(startingX + outMargin, positionTail);
tail.drawU(ug, new Dimension2DDouble(tail.getPreferredWidth(stringBounder), tail
.getPreferredHeight(stringBounder)), new SimpleContext2D(false));
@ -130,16 +136,33 @@ public class ParticipantBox implements Pushable {
public void drawLineU(UGraphic ug, double startingY, double endingY, boolean showTail) {
final double atX = ug.getTranslateX();
final double atY = ug.getTranslateY();
final StringBounder stringBounder = ug.getStringBounder();
ug.translate(startingX, startingY);
line.drawU(ug,
new Dimension2DDouble(head.getPreferredWidth(stringBounder) + outMargin * 2, endingY - startingY),
new SimpleContext2D(false));
ug.translate(startingX, 0);
if (delays.size() > 0) {
final StringBounder stringBounder = ug.getStringBounder();
for (GraphicalDelayText delay : delays) {
drawLine(ug, startingY, delay.getStartingY(), line);
drawLine(ug, delay.getStartingY(), delay.getEndingY(stringBounder), delayLine);
startingY = delay.getEndingY(stringBounder);
}
drawLine(ug, delays.get(delays.size() - 1).getEndingY(stringBounder), endingY, line);
} else {
drawLine(ug, startingY, endingY, line);
}
ug.setTranslate(atX, atY);
}
private void drawLine(UGraphic ug, double startingY, double endingY, Component comp) {
final double atY = ug.getTranslateY();
ug.translate(0, startingY);
final StringBounder stringBounder = ug.getStringBounder();
comp.drawU(ug,
new Dimension2DDouble(head.getPreferredWidth(stringBounder) + outMargin * 2, endingY - startingY),
new SimpleContext2D(false));
ug.setTranslate(ug.getTranslateX(), atY);
}
public double magicMargin(StringBounder stringBounder) {
return line.getPreferredHeight(stringBounder) / 2;
}
@ -148,4 +171,11 @@ public class ParticipantBox implements Pushable {
return startingX;
}
private final List<GraphicalDelayText> delays = new ArrayList<GraphicalDelayText>();
public void addDelay(GraphicalDelayText delay) {
this.delays.add(delay);
}
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 4168 $
* Revision $Revision: 5939 $
*
*/
package net.sourceforge.plantuml.skin;
@ -48,16 +48,16 @@ public abstract class AbstractComponent implements Component {
g2d.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, style, 0));
}
final protected void stroke(UGraphic ug, int dash, double thickness) {
ug.getParam().setStroke(new UStroke(dash, thickness));
final protected void stroke(UGraphic ug, double dashVisible, double dashSpace, double thickness) {
ug.getParam().setStroke(new UStroke(dashVisible, dashSpace, thickness));
}
final protected void stroke(Graphics2D g2d, float dash) {
stroke(g2d, dash, 1);
}
final protected void stroke(UGraphic ug, int dash) {
stroke(ug, dash, 1);
final protected void stroke(UGraphic ug, double dashVisible, double dashSpace) {
stroke(ug, dashVisible, dashSpace, 1);
}
abstract protected void drawInternalU(UGraphic ug, Dimension2D dimensionToUse);

View File

@ -51,6 +51,8 @@ public class ComponentType {
//
static public final ComponentType ALIVE_LINE = new ComponentType("ALIVE_LINE");
static public final ComponentType DELAY_LINE = new ComponentType("DELAY_LINE");
static public final ComponentType DELAY_TEXT = new ComponentType("DELAY_TEXT");
static public final ComponentType DESTROY = new ComponentType("DESTROY");
//

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5355 $
* Revision $Revision: 5944 $
*
*/
package net.sourceforge.plantuml.skin.bluemodern;
@ -39,6 +39,7 @@ import java.util.List;
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
import net.sourceforge.plantuml.skin.AbstractTextualComponent;
import net.sourceforge.plantuml.skin.ArrowConfiguration;
public abstract class AbstractComponentBlueModernArrow extends AbstractTextualComponent {
@ -47,15 +48,13 @@ public abstract class AbstractComponentBlueModernArrow extends AbstractTextualCo
private final int arrowDeltaX2 = 10;
private final int arrowDeltaY2 = 5;
private final boolean dotted;
private final boolean full;
private final ArrowConfiguration arrowConfiguration;
private final Color foregroundColor;
public AbstractComponentBlueModernArrow(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, 17, 17, 2);
this.dotted = dotted;
this.full = full;
this.arrowConfiguration = arrowConfiguration;
this.foregroundColor = foregroundColor;
}
@ -84,12 +83,8 @@ public abstract class AbstractComponentBlueModernArrow extends AbstractTextualCo
return 6;
}
final protected boolean isDotted() {
return dotted;
}
final protected boolean isFull() {
return full;
final protected ArrowConfiguration getArrowConfiguration() {
return arrowConfiguration;
}
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5926 $
* Revision $Revision: 5944 $
*
*/
package net.sourceforge.plantuml.skin.bluemodern;
@ -68,11 +68,10 @@ public class BlueModern implements Skin {
if (type.isArrow()) {
if (type.getArrowConfiguration().isSelfArrow()) {
return new ComponentBlueModernSelfArrow(Color.BLACK, Color.BLACK, normalFont, stringsToDisplay, type
.getArrowConfiguration().isDotted(), true);
.getArrowConfiguration());
}
return new ComponentBlueModernArrow(Color.BLACK, Color.BLACK, normalFont, stringsToDisplay, type
.getArrowConfiguration().isLeftToRightNormal() ? 1 : -1, type.getArrowConfiguration().isDotted(),
type.getArrowConfiguration().isASync()==false);
.getArrowConfiguration());
}
if (type == ComponentType.PARTICIPANT_HEAD) {
return new ComponentBlueModernParticipant(blue1, blue2, Color.WHITE, participantFont, stringsToDisplay);

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 4634 $
* Revision $Revision: 5945 $
*
*/
package net.sourceforge.plantuml.skin.bluemodern;
@ -40,6 +40,8 @@ import java.awt.geom.Dimension2D;
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 ComponentBlueModernArrow extends AbstractComponentBlueModernArrow {
private final int direction;
public ComponentBlueModernArrow(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
@ -68,7 +64,7 @@ public class ComponentBlueModernArrow extends AbstractComponentBlueModernArrow {
final int x2 = (int) dimensionToUse.getWidth();
if (isDotted()) {
if (getArrowConfiguration().isDotted()) {
stroke(ug, 5, 2);
} else {
ug.getParam().setStroke(new UStroke(2));
@ -80,40 +76,82 @@ public class ComponentBlueModernArrow extends AbstractComponentBlueModernArrow {
final int direction = getDirection();
final UPolygon polygon = new UPolygon();
if (isFull() == false) {
if (getArrowConfiguration().isASync()) {
ug.getParam().setStroke(new UStroke(1.5));
if (direction == 1) {
ug.draw(x2 - getArrowDeltaX2(), textHeight - getArrowDeltaY2(), new ULine(getArrowDeltaX2(),
getArrowDeltaY2()));
ug.draw(x2 - getArrowDeltaX2(), textHeight + getArrowDeltaY2(), new ULine(getArrowDeltaX2(),
-getArrowDeltaY2()));
if (getArrowConfiguration().getPart() != ArrowPart.BOTTOM_PART) {
ug.draw(x2 - getArrowDeltaX2(), textHeight - getArrowDeltaY2(), new ULine(getArrowDeltaX2(),
getArrowDeltaY2()));
}
if (getArrowConfiguration().getPart() != ArrowPart.TOP_PART) {
ug.draw(x2 - getArrowDeltaX2(), textHeight + getArrowDeltaY2(), new ULine(getArrowDeltaX2(),
-getArrowDeltaY2()));
}
} else {
ug.draw(getArrowDeltaX2(), textHeight - getArrowDeltaY2(), new ULine(-getArrowDeltaX2(),
getArrowDeltaY2()));
ug.draw(getArrowDeltaX2(), textHeight + getArrowDeltaY2(), new ULine(-getArrowDeltaX2(),
-getArrowDeltaY2()));
if (getArrowConfiguration().getPart() != ArrowPart.BOTTOM_PART) {
ug.draw(getArrowDeltaX2(), textHeight - getArrowDeltaY2(), new ULine(-getArrowDeltaX2(),
getArrowDeltaY2()));
}
if (getArrowConfiguration().getPart() != ArrowPart.TOP_PART) {
ug.draw(getArrowDeltaX2(), textHeight + getArrowDeltaY2(), new ULine(-getArrowDeltaX2(),
-getArrowDeltaY2()));
}
}
ug.getParam().setStroke(new UStroke());
} else if (direction == 1) {
polygon.addPoint(x2 - getArrowDeltaX(), textHeight - getArrowDeltaY());
polygon.addPoint(x2, textHeight);
polygon.addPoint(x2 - getArrowDeltaX(), textHeight + getArrowDeltaY());
createPolygonNormal(textHeight, x2, polygon);
} else {
polygon.addPoint(getArrowDeltaX(), textHeight - getArrowDeltaY());
polygon.addPoint(0, textHeight);
polygon.addPoint(getArrowDeltaX(), textHeight + getArrowDeltaY());
createPolygonReverse(textHeight, polygon);
}
ug.draw(0, 0, polygon);
getTextBlock().drawU(ug, getMarginX1(), 0);
}
private void createPolygonReverse(final int textHeight, final UPolygon polygon) {
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());
}
}
private void createPolygonNormal(final int textHeight, final int x2, final UPolygon polygon) {
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());
}
}
protected int getDirection(Graphics2D g2d) {
return direction;
return getDirection();
}
protected int getDirection() {
return direction;
if (getArrowConfiguration().isLeftToRightNormal()) {
return 1;
}
if (getArrowConfiguration().isRightToLeftReverse()) {
return -1;
}
throw new IllegalStateException();
}
@Override

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 4634 $
* Revision $Revision: 5945 $
*
*/
package net.sourceforge.plantuml.skin.bluemodern;
@ -39,6 +39,8 @@ import java.awt.geom.Dimension2D;
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;
@ -49,8 +51,8 @@ public class ComponentBlueModernSelfArrow extends AbstractComponentBlueModernArr
private final double arrowWidth = 45;
public ComponentBlueModernSelfArrow(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 ComponentBlueModernSelfArrow extends AbstractComponentBlueModernArr
ug.getParam().setColor(getForegroundColor());
final int x2 = (int) arrowWidth;
if (isDotted()) {
if (getArrowConfiguration().isDotted()) {
stroke(ug, 5, 2);
} else {
ug.getParam().setStroke(new UStroke(2));
@ -79,25 +81,44 @@ public class ComponentBlueModernSelfArrow extends AbstractComponentBlueModernArr
final int delta = (int) getArrowOnlyHeight(stringBounder);
if (isFull()) {
final UPolygon polygon = new UPolygon();
polygon.addPoint(getArrowDeltaX(), textHeight - getArrowDeltaY() + delta);
polygon.addPoint(0, textHeight + delta);
polygon.addPoint(getArrowDeltaX(), textHeight + getArrowDeltaY() + delta);
ug.draw(0, 0, polygon);
} else {
if (getArrowConfiguration().isASync()) {
ug.getParam().setStroke(new UStroke(1.5));
ug.draw(getArrowDeltaX2(), textHeight - getArrowDeltaY2() + delta, new ULine(-getArrowDeltaX2(),
getArrowDeltaY2()));
ug.draw(getArrowDeltaX2(), textHeight + getArrowDeltaY2() + delta, new ULine(-getArrowDeltaX2(),
-getArrowDeltaY2()));
if (getArrowConfiguration().getPart() != ArrowPart.BOTTOM_PART) {
ug.draw(getArrowDeltaX2(), textHeight - getArrowDeltaY2() + delta, new ULine(-getArrowDeltaX2(),
getArrowDeltaY2()));
}
if (getArrowConfiguration().getPart() != ArrowPart.TOP_PART) {
ug.draw(getArrowDeltaX2(), textHeight + getArrowDeltaY2() + delta, new ULine(-getArrowDeltaX2(),
-getArrowDeltaY2()));
}
ug.getParam().setStroke(new UStroke());
} else {
final UPolygon polygon = getPolygon(textHeight, delta);
ug.draw(0, 0, polygon);
}
getTextBlock().drawU(ug, getMarginX1(), 0);
}
private UPolygon getPolygon(final int textHeight, final int delta) {
final UPolygon polygon = new UPolygon();
if (getArrowConfiguration().getPart() == ArrowPart.TOP_PART) {
polygon.addPoint(getArrowDeltaX(), textHeight - getArrowDeltaY() + delta);
polygon.addPoint(0, textHeight + delta);
polygon.addPoint(getArrowDeltaX(), textHeight + delta);
} else if (getArrowConfiguration().getPart() == ArrowPart.TOP_PART) {
polygon.addPoint(getArrowDeltaX(), textHeight - getArrowDeltaY() + delta);
polygon.addPoint(0, textHeight + delta);
polygon.addPoint(getArrowDeltaX(), textHeight + getArrowDeltaY() + delta);
} else {
polygon.addPoint(getArrowDeltaX(), textHeight + delta);
polygon.addPoint(0, textHeight + delta);
polygon.addPoint(getArrowDeltaX(), textHeight + getArrowDeltaY() + delta);
}
return polygon;
}
@Override
public double getPreferredHeight(StringBounder stringBounder) {
return getTextHeight(stringBounder) + getArrowDeltaY() + getArrowOnlyHeight(stringBounder) + 2 * getPaddingY();

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5926 $
* Revision $Revision: 5937 $
*
*/
package net.sourceforge.plantuml.skin.rose;
@ -63,7 +63,7 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
final int x2 = (int) dimensionToUse.getWidth();
if (getArrowConfiguration().isDotted()) {
stroke(ug, 2);
stroke(ug, 2, 2);
}
//

View File

@ -0,0 +1,73 @@
/* ========================================================================
* 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: 5937 $
*
*/
package net.sourceforge.plantuml.skin.rose;
import java.awt.Color;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.skin.AbstractComponent;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UStroke;
public class ComponentRoseDelayLine extends AbstractComponent {
private final Color color;
public ComponentRoseDelayLine(Color color) {
this.color = color;
}
@Override
protected void drawInternalU(UGraphic ug, Dimension2D dimensionToUse) {
ug.getParam().setColor(color);
//stroke(ug, 0.4, 2.5);
stroke(ug, 0.2, 1.5);
final int x = (int) (dimensionToUse.getWidth() / 2);
ug.draw(x, 0, new ULine(0, dimensionToUse.getHeight()));
ug.getParam().setStroke(new UStroke());
}
@Override
public double getPreferredHeight(StringBounder stringBounder) {
return 20;
}
@Override
public double getPreferredWidth(StringBounder stringBounder) {
return 1;
}
}

View File

@ -0,0 +1,77 @@
/* ========================================================================
* 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: 3837 $
*
*/
package net.sourceforge.plantuml.skin.rose;
import java.awt.Color;
import java.awt.Font;
import java.awt.geom.Dimension2D;
import java.util.List;
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.skin.AbstractTextualComponent;
import net.sourceforge.plantuml.ugraphic.UGraphic;
public class ComponentRoseDelayText extends AbstractTextualComponent {
public ComponentRoseDelayText(Color fontColor, Font font, List<? extends CharSequence> stringsToDisplay) {
super(stringsToDisplay, fontColor, font, HorizontalAlignement.CENTER, 4, 4, 4);
}
@Override
protected void drawInternalU(UGraphic ug, Dimension2D dimensionToUse) {
final TextBlock textBlock = getTextBlock();
final StringBounder stringBounder = ug.getStringBounder();
final double textWidth = getTextWidth(stringBounder);
final double textHeight = getTextHeight(stringBounder);
final double xpos = (dimensionToUse.getWidth() - textWidth) / 2;
final double ypos = (dimensionToUse.getHeight() - textHeight) / 2;
ug.getParam().setColor(getFontColor());
textBlock.drawU(ug, xpos, ypos + getMarginY());
}
@Override
public double getPreferredHeight(StringBounder stringBounder) {
return getTextHeight(stringBounder) + 20;
}
@Override
public double getPreferredWidth(StringBounder stringBounder) {
return getTextWidth(stringBounder) + 30;
}
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 4258 $
* Revision $Revision: 5937 $
*
*/
package net.sourceforge.plantuml.skin.rose;
@ -53,7 +53,7 @@ public class ComponentRoseGroupingElse extends AbstractTextualComponent {
@Override
protected void drawInternalU(UGraphic ug, Dimension2D dimensionToUse) {
stroke(ug, 2);
stroke(ug, 2, 2);
ug.getParam().setColor(getFontColor());
ug.draw(0, 1, new ULine(dimensionToUse.getWidth(), 0));
ug.getParam().setStroke(new UStroke());

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 4167 $
* Revision $Revision: 5937 $
*
*/
package net.sourceforge.plantuml.skin.rose;
@ -53,7 +53,7 @@ public class ComponentRoseLine extends AbstractComponent {
@Override
protected void drawInternalU(UGraphic ug, Dimension2D dimensionToUse) {
ug.getParam().setColor(color);
stroke(ug, 5);
stroke(ug, 5, 5);
final int x = (int) (dimensionToUse.getWidth() / 2);
ug.draw(x, 0, new ULine(0, dimensionToUse.getHeight()));
ug.getParam().setStroke(new UStroke());

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 4167 $
* Revision $Revision: 5937 $
*
*/
package net.sourceforge.plantuml.skin.rose;
@ -52,7 +52,7 @@ public class ComponentRoseNewpage extends AbstractComponent {
@Override
protected void drawInternalU(UGraphic ug, Dimension2D dimensionToUse) {
stroke(ug, 2);
stroke(ug, 2, 2);
ug.getParam().setColor(foregroundColor);
ug.draw(0, 0, new ULine(dimensionToUse.getWidth(), 0));
ug.getParam().setStroke(new UStroke());

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5926 $
* Revision $Revision: 5937 $
*
*/
package net.sourceforge.plantuml.skin.rose;
@ -65,7 +65,7 @@ public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow {
final double x2 = arrowWidth;
if (getArrowConfiguration().isDotted()) {
stroke(ug, 2);
stroke(ug, 2, 2);
}
ug.draw(0, textHeight, new ULine(x2, 0));

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5922 $
* Revision $Revision: 5943 $
*
*/
package net.sourceforge.plantuml.skin.rose;
@ -220,6 +220,15 @@ public class Rose implements Skin {
final Color borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder).getColor();
return new ComponentRoseActiveLine(borderColor, lifeLineBackgroundColor);
}
if (type == ComponentType.DELAY_LINE) {
// final Color borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder).getColor();
final Color borderColor = getFontColor(param, FontParam.SEQUENCE_DELAY);
return new ComponentRoseDelayLine(borderColor);
}
if (type == ComponentType.DELAY_TEXT) {
return new ComponentRoseDelayText(getFontColor(param, FontParam.SEQUENCE_DELAY), param.getFont(
FontParam.SEQUENCE_DELAY, null), stringsToDisplay);
}
if (type == ComponentType.DESTROY) {
final Color borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder).getColor();
return new ComponentRoseDestroy(borderColor);

View File

@ -28,31 +28,37 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5289 $
* Revision $Revision: 5939 $
*
*/
package net.sourceforge.plantuml.ugraphic;
public class UStroke {
private final int dash;
private final double dashVisible;
private final double dashSpace;
private final double thickness;
public UStroke(int dash, double thickness) {
this.dash = dash;
public UStroke(double dashVisible, double dashSpace, double thickness) {
this.dashVisible = dashVisible;
this.dashSpace = dashSpace;
this.thickness = thickness;
}
public UStroke(double thickness) {
this(0, thickness);
this(0, 0, thickness);
}
public UStroke() {
this(1.0);
}
public int getDash() {
return dash;
public double getDashVisible() {
return dashVisible;
}
public double getDashSpace() {
return dashSpace;
}
public double getThickness() {
@ -60,17 +66,17 @@ public class UStroke {
}
public String getDasharraySvg() {
if (dash == 0) {
if (dashVisible == 0) {
return null;
}
return "" + dash + "," + dash;
return "" + dashVisible + "," + dashSpace;
}
public String getDasharrayEps() {
if (dash == 0) {
if (dashVisible == 0) {
return null;
}
return "" + dash + " " + (2*dash);
return "" + dashVisible + " " + dashSpace;
}
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5546 $
* Revision $Revision: 5939 $
*
*/
package net.sourceforge.plantuml.ugraphic.g2d;
@ -58,11 +58,12 @@ public class DriverLineG2d implements UDriver<Graphics2D> {
static void manageStroke(UParam param, Graphics2D g2d) {
final UStroke stroke = param.getStroke();
final float thickness = (float) stroke.getThickness();
if (stroke.getDash() == 0) {
if (stroke.getDashVisible() == 0) {
g2d.setStroke(new BasicStroke(thickness));
} else {
final float dash = (float) stroke.getDash();
final float[] style = { dash, dash };
final float dash1 = (float) stroke.getDashVisible();
final float dash2 = (float) stroke.getDashSpace();
final float[] style = { dash1, dash2 };
g2d.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, style, 0));
}
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5931 $
* Revision $Revision: 5955 $
*
*/
package net.sourceforge.plantuml.version;
@ -36,11 +36,11 @@ package net.sourceforge.plantuml.version;
public class Version {
public static int version() {
return 5930;
return 5954;
}
public static long compileTime() {
return 1294686127593L;
return 1294857964687L;
}
}