mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-23 03:19:06 +00:00
Bug fixes
This commit is contained in:
parent
1fb75b1b0e
commit
28f253d992
@ -78,9 +78,8 @@ public class LifeEvent extends AbstractEvent implements Event {
|
||||
return type == LifeEventType.DEACTIVATE || type == LifeEventType.DESTROY;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean isDestroy() {
|
||||
return type == LifeEventType.DESTROY;
|
||||
public boolean isDeactivate() {
|
||||
return type == LifeEventType.DEACTIVATE;
|
||||
}
|
||||
|
||||
public boolean isDestroy(Participant p) {
|
||||
|
@ -44,9 +44,9 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.sequencediagram.teoz.YPositionedTile;
|
||||
import net.sourceforge.plantuml.sequencediagram.teoz.CommonTile;
|
||||
import net.sourceforge.plantuml.sequencediagram.teoz.Tile;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
@ -80,10 +80,10 @@ public class LinkAnchor {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void drawAnchor(UGraphic ug, YPositionedTile tile1, YPositionedTile tile2, ISkinParam param) {
|
||||
public void drawAnchor(UGraphic ug, CommonTile tile1, CommonTile tile2, ISkinParam param) {
|
||||
|
||||
final double y1 = tile1.getY();
|
||||
final double y2 = tile2.getY();
|
||||
final double y1 = tile1.getY() + tile1.getContactPointRelative();
|
||||
final double y2 = tile2.getY() + tile2.getContactPointRelative();
|
||||
final double xx1 = tile1.getMiddleX();
|
||||
final double xx2 = tile2.getMiddleX();
|
||||
final double x = (xx1 + xx2) / 2;
|
||||
@ -96,8 +96,8 @@ public class LinkAnchor {
|
||||
final Display display = Display.getWithNewlines(message);
|
||||
final TextBlock title = display.create(new FontConfiguration(param, FontParam.ARROW, null),
|
||||
HorizontalAlignment.CENTER, param);
|
||||
final Snake snake = Snake.create(Arrows.asToUp(), rainbow, Arrows.asToDown())
|
||||
.withLabel(title, HorizontalAlignment.CENTER);
|
||||
final Snake snake = Snake.create(Arrows.asToUp(), rainbow, Arrows.asToDown()).withLabel(title,
|
||||
HorizontalAlignment.CENTER);
|
||||
|
||||
snake.addPoint(x, ymin + 2);
|
||||
snake.addPoint(x, ymax - 2);
|
||||
|
@ -55,7 +55,7 @@ public abstract class AbstractTile extends CommonTile implements Tile {
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean matchAnchorV1(String anchor) {
|
||||
public boolean matchAnchor(String anchor) {
|
||||
final Event event = this.getEvent();
|
||||
if (event instanceof AbstractMessage) {
|
||||
final AbstractMessage msg = (AbstractMessage) event;
|
||||
|
@ -36,24 +36,37 @@
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
|
||||
public abstract class CommonTile implements Tile {
|
||||
public abstract class CommonTile implements Tile, UDrawable {
|
||||
|
||||
private final StringBounder stringBounder;
|
||||
private double y = -1;
|
||||
|
||||
public CommonTile(StringBounder stringBounder) {
|
||||
this.stringBounder = stringBounder;
|
||||
}
|
||||
|
||||
final public void callbackY(double y) {
|
||||
this.y = y;
|
||||
callbackY_internal(y);
|
||||
}
|
||||
|
||||
public void callbackY_internal(double y) {
|
||||
protected void callbackY_internal(double y) {
|
||||
}
|
||||
|
||||
protected final StringBounder getStringBounder() {
|
||||
return stringBounder;
|
||||
}
|
||||
|
||||
final public double getMiddleX() {
|
||||
final double max = getMaxX().getCurrentValue();
|
||||
final double min = getMinX().getCurrentValue();
|
||||
return (min + max) / 2;
|
||||
}
|
||||
|
||||
public final double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ public class CommunicationExoTile extends AbstractTile {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
final protected void callbackY_internal(double y) {
|
||||
final ArrowComponent comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
final double arrowY = comp.getStartPoint(getStringBounder(), dim).getY();
|
||||
|
@ -141,7 +141,7 @@ public class CommunicationTile extends AbstractTile {
|
||||
public static final double LIVE_DELTA_SIZE = 5;
|
||||
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
final protected void callbackY_internal(double y) {
|
||||
if (message.isCreate()) {
|
||||
livingSpace2.goCreate(y);
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import java.awt.geom.Dimension2D;
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.real.Real;
|
||||
import net.sourceforge.plantuml.sequencediagram.AbstractMessage;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
@ -83,7 +84,7 @@ public class CommunicationTileNoteBottom extends AbstractTile {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
final protected void callbackY_internal(double y) {
|
||||
tile.callbackY(y);
|
||||
}
|
||||
|
||||
@ -103,7 +104,7 @@ public class CommunicationTileNoteBottom extends AbstractTile {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
final Area area = new Area(dim.getWidth(), dim.getHeight());
|
||||
tile.drawU(ug);
|
||||
((UDrawable) tile).drawU(ug);
|
||||
|
||||
final double middleMsg = (tile.getMinX().getCurrentValue() + tile.getMaxX().getCurrentValue()) / 2;
|
||||
|
||||
|
@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.real.Real;
|
||||
import net.sourceforge.plantuml.sequencediagram.AbstractMessage;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
@ -81,7 +82,7 @@ public class CommunicationTileNoteLeft extends AbstractTile {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
final protected void callbackY_internal(double y) {
|
||||
tile.callbackY(y);
|
||||
}
|
||||
|
||||
@ -102,7 +103,7 @@ public class CommunicationTileNoteLeft extends AbstractTile {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
final Area area = new Area(dim.getWidth(), dim.getHeight());
|
||||
tile.drawU(ug);
|
||||
((UDrawable) tile).drawU(ug);
|
||||
final Real p = getNotePosition(stringBounder);
|
||||
|
||||
comp.drawU(ug.apply(UTranslate.dx(p.getCurrentValue())), area, (Context2D) ug);
|
||||
|
@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.real.Real;
|
||||
import net.sourceforge.plantuml.sequencediagram.AbstractMessage;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
@ -85,7 +86,7 @@ public class CommunicationTileNoteRight extends AbstractTile {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
final protected void callbackY_internal(double y) {
|
||||
tile.callbackY(y);
|
||||
}
|
||||
|
||||
@ -110,7 +111,7 @@ public class CommunicationTileNoteRight extends AbstractTile {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
final Area area = new Area(dim.getWidth(), dim.getHeight());
|
||||
tile.drawU(ug);
|
||||
((UDrawable) tile).drawU(ug);
|
||||
final Real p = getNotePosition(stringBounder);
|
||||
|
||||
comp.drawU(ug.apply(UTranslate.dx(p.getCurrentValue())), area, (Context2D) ug);
|
||||
|
@ -40,6 +40,7 @@ import java.awt.geom.Dimension2D;
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.real.Real;
|
||||
import net.sourceforge.plantuml.sequencediagram.AbstractMessage;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
@ -83,7 +84,7 @@ public class CommunicationTileNoteTop extends AbstractTile {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
final protected void callbackY_internal(double y) {
|
||||
tile.callbackY(y);
|
||||
}
|
||||
|
||||
@ -104,7 +105,7 @@ public class CommunicationTileNoteTop extends AbstractTile {
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
final Area area = new Area(dim.getWidth(), dim.getHeight());
|
||||
|
||||
tile.drawU(ug.apply(UTranslate.dy(dim.getHeight() + spacey)));
|
||||
((UDrawable) tile).drawU(ug.apply(UTranslate.dy(dim.getHeight() + spacey)));
|
||||
|
||||
final double middleMsg = (tile.getMinX().getCurrentValue() + tile.getMaxX().getCurrentValue()) / 2;
|
||||
|
||||
|
@ -100,7 +100,7 @@ public class CommunicationTileSelf extends AbstractTile {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
final protected void callbackY_internal(double y) {
|
||||
final ArrowComponent comp = getComponent(getStringBounder());
|
||||
final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
|
||||
final Point2D p1 = comp.getStartPoint(getStringBounder(), dim);
|
||||
|
@ -79,7 +79,7 @@ public class CommunicationTileSelfNoteRight extends AbstractTile {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
final protected void callbackY_internal(double y) {
|
||||
tile.callbackY(y);
|
||||
}
|
||||
|
||||
|
@ -56,17 +56,11 @@ public class DelayTile extends AbstractTile implements Tile {
|
||||
// private Real first;
|
||||
// private Real last;
|
||||
private Real middle;
|
||||
private double y;
|
||||
|
||||
public Event getEvent() {
|
||||
return delay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public DelayTile(Delay delay, TileArguments tileArguments) {
|
||||
super(tileArguments.getStringBounder());
|
||||
this.delay = delay;
|
||||
@ -102,7 +96,7 @@ public class DelayTile extends AbstractTile implements Tile {
|
||||
final Component comp = getComponent(stringBounder);
|
||||
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
||||
final Area area = new Area(getPreferredWidth(stringBounder), dim.getHeight());
|
||||
tileArguments.getLivingSpaces().delayOn(y, dim.getHeight());
|
||||
tileArguments.getLivingSpaces().delayOn(getY(), dim.getHeight());
|
||||
|
||||
ug = ug.apply(UTranslate.dx(getMinX().getCurrentValue()));
|
||||
comp.drawU(ug, area, (Context2D) ug);
|
||||
|
@ -130,15 +130,4 @@ public class ElseTile extends AbstractTile {
|
||||
return getMinX().addFixed(dim.getWidth());
|
||||
}
|
||||
|
||||
private double y;
|
||||
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public double getCallbackY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,222 +0,0 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
import net.sourceforge.plantuml.sequencediagram.AbstractMessage;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
import net.sourceforge.plantuml.sequencediagram.LifeEvent;
|
||||
import net.sourceforge.plantuml.sequencediagram.Message;
|
||||
import net.sourceforge.plantuml.sequencediagram.Note;
|
||||
import net.sourceforge.plantuml.sequencediagram.Participant;
|
||||
|
||||
public class EventsHistory {
|
||||
|
||||
private final Participant p;
|
||||
private final List<Event> events;
|
||||
private final Map<Event, Double> ys3 = new HashMap<Event, Double>();
|
||||
|
||||
public EventsHistory(Participant p, List<Event> events) {
|
||||
this.p = p;
|
||||
this.events = events;
|
||||
}
|
||||
|
||||
public void addStepForLivebox(Event event, double y) {
|
||||
ys3.put(event, y);
|
||||
}
|
||||
|
||||
public Participant getParticipant() {
|
||||
return p;
|
||||
}
|
||||
|
||||
public int getLevelAt(Event event, EventsHistoryMode mode) {
|
||||
final int result = getLevelAtInternal(event, mode);
|
||||
// System.err.println("EventsHistory::getLevelAt " + mode + " " + result + " " +
|
||||
// event);
|
||||
return result;
|
||||
}
|
||||
|
||||
private int getLevelAtInternal(Event event, EventsHistoryMode mode) {
|
||||
int level = 0; // p.getInitialLife();
|
||||
// System.err.println("--->EventsHistory for " + p + " " + event);
|
||||
for (Iterator<Event> it = events.iterator(); it.hasNext();) {
|
||||
final Event current = it.next();
|
||||
if (current instanceof LifeEvent) {
|
||||
final LifeEvent le = (LifeEvent) current;
|
||||
if (le.getParticipant() == p && le.isActivate()) {
|
||||
level++;
|
||||
}
|
||||
if (le.getParticipant() == p && le.isDeactivateOrDestroy()) {
|
||||
level--;
|
||||
}
|
||||
}
|
||||
if (event == current) {
|
||||
if (current instanceof AbstractMessage) {
|
||||
final Event next = nextButSkippingNotes(it);
|
||||
if (next instanceof LifeEvent) {
|
||||
final LifeEvent le = (LifeEvent) next;
|
||||
final AbstractMessage msg = (AbstractMessage) current;
|
||||
if (mode != EventsHistoryMode.IGNORE_FUTURE_ACTIVATE && le.isActivate() && msg.dealWith(p)
|
||||
&& le.getParticipant() == p) {
|
||||
level++;
|
||||
}
|
||||
if (mode == EventsHistoryMode.CONSIDERE_FUTURE_DEACTIVATE && le.isDeactivateOrDestroy()
|
||||
&& msg.dealWith(p) && le.getParticipant() == p) {
|
||||
level--;
|
||||
}
|
||||
// System.err.println("Warning, this is message " + current + " next=" + next);
|
||||
}
|
||||
|
||||
}
|
||||
if (level < 0) {
|
||||
return 0;
|
||||
}
|
||||
// System.err.println("<-result1 is " + level);
|
||||
return level;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
// return level;
|
||||
}
|
||||
|
||||
private boolean isNextEventADestroy(Event event) {
|
||||
for (Iterator<Event> it = events.iterator(); it.hasNext();) {
|
||||
final Event current = it.next();
|
||||
if (event != current) {
|
||||
continue;
|
||||
}
|
||||
if (current instanceof Message) {
|
||||
final Event next = nextButSkippingNotes(it);
|
||||
if (next instanceof LifeEvent) {
|
||||
final LifeEvent le = (LifeEvent) next;
|
||||
return le.isDestroy(p);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private SymbolContext getActivateColor(Event event) {
|
||||
if (event instanceof LifeEvent) {
|
||||
final LifeEvent le = (LifeEvent) event;
|
||||
if (le.isActivate()) {
|
||||
return le.getSpecificColors();
|
||||
}
|
||||
}
|
||||
for (Iterator<Event> it = events.iterator(); it.hasNext();) {
|
||||
final Event current = it.next();
|
||||
if (event != current) {
|
||||
continue;
|
||||
}
|
||||
if (current instanceof Message) {
|
||||
final Event next = nextButSkippingNotes(it);
|
||||
if (next instanceof LifeEvent) {
|
||||
final LifeEvent le = (LifeEvent) next;
|
||||
if (le.isActivate()) {
|
||||
return le.getSpecificColors();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Event nextButSkippingNotes(Iterator<Event> it) {
|
||||
while (true) {
|
||||
if (it.hasNext() == false) {
|
||||
return null;
|
||||
}
|
||||
final Event next = it.next();
|
||||
if (next instanceof Note) {
|
||||
continue;
|
||||
}
|
||||
// System.err.println("nextButSkippingNotes=" + next);
|
||||
return next;
|
||||
}
|
||||
}
|
||||
|
||||
public Stairs2 getStairs(double createY, double totalHeight) {
|
||||
// System.err.println("EventsHistory::getStairs totalHeight=" + totalHeight);
|
||||
final Stairs2 result = new Stairs2();
|
||||
int value = 0;
|
||||
for (Event event : events) {
|
||||
final Double position = ys3.get(event);
|
||||
// System.err.println("EventsHistory::getStairs event=" + event + " position=" +
|
||||
// position);
|
||||
if (position != null) {
|
||||
assert position <= totalHeight : "position=" + position + " totalHeight=" + totalHeight;
|
||||
value = getLevelAt(event, EventsHistoryMode.CONSIDERE_FUTURE_DEACTIVATE);
|
||||
final SymbolContext activateColor = getActivateColor(event);
|
||||
result.addStep(new StairsPosition(Math.max(createY, position), isNextEventADestroy(event)), value,
|
||||
activateColor);
|
||||
}
|
||||
}
|
||||
// System.err.println("EventsHistory::getStairs finishing totalHeight=" +
|
||||
// totalHeight);
|
||||
result.addStep(new StairsPosition(totalHeight, false), value, null);
|
||||
// System.err.println("EventsHistory::getStairs " + p + " result=" + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public int getMaxValue() {
|
||||
int max = 0;
|
||||
int level = 0;
|
||||
for (Event current : events) {
|
||||
if (current instanceof LifeEvent) {
|
||||
final LifeEvent le = (LifeEvent) current;
|
||||
if (le.getParticipant() == p && le.isActivate()) {
|
||||
level++;
|
||||
}
|
||||
if (level > max) {
|
||||
max = level;
|
||||
}
|
||||
if (le.getParticipant() == p && le.isDeactivateOrDestroy()) {
|
||||
level--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
}
|
@ -44,6 +44,7 @@ import java.util.List;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.real.Real;
|
||||
import net.sourceforge.plantuml.real.RealUtils;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
@ -163,7 +164,7 @@ public class GroupingTile extends AbstractTile {
|
||||
|
||||
double h = dim1.getHeight() + MARGINY_MAGIC / 2;
|
||||
for (Tile tile : tiles) {
|
||||
tile.drawU(ug.apply(UTranslate.dy(h)));
|
||||
((UDrawable) tile).drawU(ug.apply(UTranslate.dy(h)));
|
||||
final double preferredHeight = tile.getPreferredHeight();
|
||||
h += preferredHeight;
|
||||
}
|
||||
@ -182,7 +183,7 @@ public class GroupingTile extends AbstractTile {
|
||||
for (Tile tile : tiles) {
|
||||
if (tile instanceof ElseTile) {
|
||||
final ElseTile elseTile = (ElseTile) tile;
|
||||
ys.add(elseTile.getCallbackY() - y + MARGINY_MAGIC / 2);
|
||||
ys.add(elseTile.getY() - getY() + MARGINY_MAGIC / 2);
|
||||
}
|
||||
}
|
||||
ys.add(totalHeight);
|
||||
@ -217,23 +218,16 @@ public class GroupingTile extends AbstractTile {
|
||||
return max.addFixed(EXTERNAL_MARGINX2);
|
||||
}
|
||||
|
||||
private double y;
|
||||
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public static double fillPositionelTiles(StringBounder stringBounder, double y, List<Tile> tiles,
|
||||
final List<YPositionedTile> local, List<YPositionedTile> full) {
|
||||
final List<CommonTile> local, List<CommonTile> full) {
|
||||
for (Tile tile : mergeParallel(stringBounder, tiles)) {
|
||||
final YPositionedTile ytile = new YPositionedTile(tile, y);
|
||||
local.add(ytile);
|
||||
full.add(ytile);
|
||||
tile.callbackY(y);
|
||||
local.add((CommonTile) tile);
|
||||
full.add((CommonTile) tile);
|
||||
if (tile instanceof GroupingTile) {
|
||||
final GroupingTile groupingTile = (GroupingTile) tile;
|
||||
final double headerHeight = groupingTile.getHeaderHeight(stringBounder);
|
||||
final ArrayList<YPositionedTile> local2 = new ArrayList<YPositionedTile>();
|
||||
final ArrayList<CommonTile> local2 = new ArrayList<CommonTile>();
|
||||
fillPositionelTiles(stringBounder, y + headerHeight, groupingTile.tiles, local2, full);
|
||||
}
|
||||
y += tile.getPreferredHeight();
|
||||
@ -303,7 +297,7 @@ public class GroupingTile extends AbstractTile {
|
||||
((GroupingTile) tile).addYNewPages(yNewPages);
|
||||
}
|
||||
if (tile instanceof NewpageTile) {
|
||||
final double y = ((NewpageTile) tile).getCallbackY();
|
||||
final double y = ((NewpageTile) tile).getY();
|
||||
yNewPages.add(y);
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class LifeEventTile extends AbstractTile {
|
||||
private final ISkinParam skinParam;
|
||||
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
final protected void callbackY_internal(double y) {
|
||||
// System.err.println("LifeEventTile::updateStairs " + lifeEvent + " " +
|
||||
// livingSpace.getParticipant() + " y=" + y);
|
||||
livingSpace.addStepForLivebox(getEvent(), y);
|
||||
|
@ -35,12 +35,20 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
import net.sourceforge.plantuml.sequencediagram.AbstractMessage;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
import net.sourceforge.plantuml.sequencediagram.LifeEvent;
|
||||
import net.sourceforge.plantuml.sequencediagram.Message;
|
||||
import net.sourceforge.plantuml.sequencediagram.Note;
|
||||
import net.sourceforge.plantuml.sequencediagram.Participant;
|
||||
import net.sourceforge.plantuml.skin.Context2D;
|
||||
import net.sourceforge.plantuml.skin.SimpleContext2D;
|
||||
@ -50,26 +58,194 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class LiveBoxes {
|
||||
|
||||
private final EventsHistory eventsHistory;
|
||||
private final Rose skin;
|
||||
private final ISkinParam skinParam;
|
||||
private final Map<Double, Double> delays = new TreeMap<Double, Double>();
|
||||
private final Participant p;
|
||||
private final List<Event> events;
|
||||
private final Map<Event, Double> eventsStep = new HashMap<Event, Double>();
|
||||
|
||||
public LiveBoxes(EventsHistory eventsHistory, Rose skin, ISkinParam skinParam, Participant participant) {
|
||||
this.eventsHistory = eventsHistory;
|
||||
public LiveBoxes(Participant p, List<Event> events, Rose skin, ISkinParam skinParam) {
|
||||
this.p = p;
|
||||
this.events = events;
|
||||
this.skin = skin;
|
||||
this.skinParam = skinParam;
|
||||
}
|
||||
|
||||
public void addStep(Event event, double y) {
|
||||
if (event.dealWith(p)) {
|
||||
if (event instanceof LifeEvent && ((LifeEvent) event).isDeactivate() && eventsStep.containsValue(y)) {
|
||||
y += 5.0;
|
||||
}
|
||||
eventsStep.put(event, y);
|
||||
}
|
||||
}
|
||||
|
||||
public Participant getParticipant() {
|
||||
return p;
|
||||
}
|
||||
|
||||
public int getLevelAt(Event event, EventsHistoryMode mode) {
|
||||
return getLevelAtInternal(event, mode);
|
||||
}
|
||||
|
||||
private int getLevelAtInternal(Event event, EventsHistoryMode mode) {
|
||||
int level = 0; // p.getInitialLife();
|
||||
// System.err.println("--->EventsHistory for " + p + " " + event);
|
||||
for (Iterator<Event> it = events.iterator(); it.hasNext();) {
|
||||
final Event current = it.next();
|
||||
if (current instanceof LifeEvent) {
|
||||
final LifeEvent le = (LifeEvent) current;
|
||||
if (le.getParticipant() == p && le.isActivate()) {
|
||||
level++;
|
||||
}
|
||||
if (le.getParticipant() == p && le.isDeactivateOrDestroy()) {
|
||||
level--;
|
||||
}
|
||||
}
|
||||
if (event == current) {
|
||||
if (current instanceof AbstractMessage) {
|
||||
final Event next = nextButSkippingNotes(it);
|
||||
if (next instanceof LifeEvent) {
|
||||
final LifeEvent le = (LifeEvent) next;
|
||||
final AbstractMessage msg = (AbstractMessage) current;
|
||||
if (mode != EventsHistoryMode.IGNORE_FUTURE_ACTIVATE && le.isActivate() && msg.dealWith(p)
|
||||
&& le.getParticipant() == p) {
|
||||
level++;
|
||||
}
|
||||
if (mode == EventsHistoryMode.CONSIDERE_FUTURE_DEACTIVATE && le.isDeactivateOrDestroy()
|
||||
&& msg.dealWith(p) && le.getParticipant() == p) {
|
||||
level--;
|
||||
}
|
||||
// System.err.println("Warning, this is message " + current + " next=" + next);
|
||||
}
|
||||
|
||||
}
|
||||
if (level < 0) {
|
||||
return 0;
|
||||
}
|
||||
// System.err.println("<-result1 is " + level);
|
||||
return level;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
// return level;
|
||||
}
|
||||
|
||||
private boolean isNextEventADestroy(Event event) {
|
||||
for (Iterator<Event> it = events.iterator(); it.hasNext();) {
|
||||
final Event current = it.next();
|
||||
if (event != current) {
|
||||
continue;
|
||||
}
|
||||
if (current instanceof Message) {
|
||||
final Event next = nextButSkippingNotes(it);
|
||||
if (next instanceof LifeEvent) {
|
||||
final LifeEvent le = (LifeEvent) next;
|
||||
return le.isDestroy(p);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private SymbolContext getActivateColor(Event event) {
|
||||
if (event instanceof LifeEvent) {
|
||||
final LifeEvent le = (LifeEvent) event;
|
||||
if (le.isActivate()) {
|
||||
return le.getSpecificColors();
|
||||
}
|
||||
}
|
||||
for (Iterator<Event> it = events.iterator(); it.hasNext();) {
|
||||
final Event current = it.next();
|
||||
if (event != current) {
|
||||
continue;
|
||||
}
|
||||
if (current instanceof Message) {
|
||||
final Event next = nextButSkippingNotes(it);
|
||||
if (next instanceof LifeEvent) {
|
||||
final LifeEvent le = (LifeEvent) next;
|
||||
if (le.isActivate()) {
|
||||
return le.getSpecificColors();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Event nextButSkippingNotes(Iterator<Event> it) {
|
||||
while (true) {
|
||||
if (it.hasNext() == false) {
|
||||
return null;
|
||||
}
|
||||
final Event next = it.next();
|
||||
if (next instanceof Note) {
|
||||
continue;
|
||||
}
|
||||
// System.err.println("nextButSkippingNotes=" + next);
|
||||
return next;
|
||||
}
|
||||
}
|
||||
|
||||
public Stairs getStairs(double createY, double totalHeight) {
|
||||
final Stairs stair = new Stairs();
|
||||
int indent = 0;
|
||||
for (Event event : events) {
|
||||
final Double position = eventsStep.get(event);
|
||||
if (position != null) {
|
||||
assert position <= totalHeight : "position=" + position + " totalHeight=" + totalHeight;
|
||||
indent = getLevelAt(event, EventsHistoryMode.CONSIDERE_FUTURE_DEACTIVATE);
|
||||
final SymbolContext activateColor = getActivateColor(event);
|
||||
final Step step = new Step(Math.max(createY, position), isNextEventADestroy(event), indent,
|
||||
activateColor);
|
||||
stair.addStep(step);
|
||||
}
|
||||
}
|
||||
stair.addStep(new Step(totalHeight, false, indent, null));
|
||||
return stair;
|
||||
}
|
||||
|
||||
private boolean isActivateAnDeactivate(Event event) {
|
||||
if (event instanceof AbstractMessage) {
|
||||
final AbstractMessage msg = (AbstractMessage) event;
|
||||
return msg.isActivate() && msg.isDeactivate();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getMaxValue() {
|
||||
int max = 0;
|
||||
int level = 0;
|
||||
for (Event current : events) {
|
||||
if (current instanceof LifeEvent) {
|
||||
final LifeEvent le = (LifeEvent) current;
|
||||
if (le.getParticipant() == p && le.isActivate()) {
|
||||
level++;
|
||||
}
|
||||
if (level > max) {
|
||||
max = level;
|
||||
}
|
||||
if (le.getParticipant() == p && le.isDeactivateOrDestroy()) {
|
||||
level--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
public double getMaxPosition(StringBounder stringBounder) {
|
||||
final int max = eventsHistory.getMaxValue();
|
||||
final int max = getMaxValue();
|
||||
final LiveBoxesDrawer drawer = new LiveBoxesDrawer(new SimpleContext2D(true), skin, skinParam, delays);
|
||||
return drawer.getWidth(stringBounder) / 2.0 * max;
|
||||
}
|
||||
|
||||
public void drawBoxes(UGraphic ug, Context2D context, double createY, double endY) {
|
||||
final Stairs2 stairs = eventsHistory.getStairs(createY, endY);
|
||||
final int max = stairs.getMaxValue();
|
||||
final Stairs stairs = getStairs(createY, endY);
|
||||
final int max = stairs.getMaxIndent();
|
||||
if (max == 0) {
|
||||
drawDestroys(ug, stairs, context);
|
||||
}
|
||||
@ -78,27 +254,26 @@ public class LiveBoxes {
|
||||
}
|
||||
}
|
||||
|
||||
private void drawDestroys(UGraphic ug, Stairs2 stairs, Context2D context) {
|
||||
private void drawDestroys(UGraphic ug, Stairs stairs, Context2D context) {
|
||||
final LiveBoxesDrawer drawer = new LiveBoxesDrawer(context, skin, skinParam, delays);
|
||||
for (StairsPosition yposition : stairs.getYs()) {
|
||||
for (Step yposition : stairs.getSteps()) {
|
||||
drawer.drawDestroyIfNeeded(ug, yposition);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawOneLevel(UGraphic ug, int levelToDraw, Stairs2 stairs, Context2D context) {
|
||||
private void drawOneLevel(UGraphic ug, int levelToDraw, Stairs stairs, Context2D context) {
|
||||
final LiveBoxesDrawer drawer = new LiveBoxesDrawer(context, skin, skinParam, delays);
|
||||
ug = ug.apply(UTranslate.dx((levelToDraw - 1) * drawer.getWidth(ug.getStringBounder()) / 2.0));
|
||||
|
||||
boolean pending = true;
|
||||
for (Iterator<StairsPosition> it = stairs.getYs().iterator(); it.hasNext();) {
|
||||
final StairsPosition yposition = it.next();
|
||||
final IntegerColored integerColored = stairs.getValue(yposition.getValue());
|
||||
final int level = integerColored.getValue();
|
||||
if (pending && level == levelToDraw) {
|
||||
drawer.addStart(yposition.getValue(), integerColored.getColors());
|
||||
for (Iterator<Step> it = stairs.getSteps().iterator(); it.hasNext();) {
|
||||
final Step yposition = it.next();
|
||||
final int indent = yposition.getIndent();
|
||||
if (pending && indent == levelToDraw) {
|
||||
drawer.addStart(yposition.getValue(), yposition.getColors());
|
||||
pending = false;
|
||||
} else if (pending == false && (it.hasNext() == false || level < levelToDraw)) {
|
||||
drawer.doDrawing(ug, yposition);
|
||||
} else if (pending == false && (it.hasNext() == false || indent < levelToDraw)) {
|
||||
drawer.doDrawing(ug, yposition.getValue());
|
||||
drawer.drawDestroyIfNeeded(ug, yposition);
|
||||
pending = true;
|
||||
}
|
||||
|
@ -94,8 +94,8 @@ public class LiveBoxesDrawer {
|
||||
this.symbolContext = symbolContext;
|
||||
}
|
||||
|
||||
public void doDrawing(UGraphic ug, StairsPosition yposition) {
|
||||
final Segment full = new Segment(y1, yposition.getValue());
|
||||
public void doDrawing(UGraphic ug, double yposition) {
|
||||
final Segment full = new Segment(y1, yposition);
|
||||
final Collection<Segment> segments = full.cutSegmentIfNeed(delays);
|
||||
ComponentType type = ComponentType.ALIVE_BOX_CLOSE_CLOSE;
|
||||
if (segments.size() > 1) {
|
||||
@ -106,22 +106,21 @@ public class LiveBoxesDrawer {
|
||||
if (it.hasNext() == false && type != ComponentType.ALIVE_BOX_CLOSE_CLOSE) {
|
||||
type = ComponentType.ALIVE_BOX_OPEN_CLOSE;
|
||||
}
|
||||
drawInternal(ug, yposition, seg.getPos1(), seg.getPos2(), type);
|
||||
drawInternal(ug, seg.getPos1(), seg.getPos2(), type);
|
||||
type = ComponentType.ALIVE_BOX_OPEN_OPEN;
|
||||
}
|
||||
y1 = Double.MAX_VALUE;
|
||||
}
|
||||
|
||||
public void drawDestroyIfNeeded(UGraphic ug, StairsPosition yposition) {
|
||||
if (yposition.isDestroy()) {
|
||||
public void drawDestroyIfNeeded(UGraphic ug, Step step) {
|
||||
if (step.isDestroy()) {
|
||||
final Dimension2D dimCross = cross.getPreferredDimension(ug.getStringBounder());
|
||||
cross.drawU(
|
||||
ug.apply(new UTranslate(-dimCross.getWidth() / 2, yposition.getValue() - dimCross.getHeight() / 2)),
|
||||
cross.drawU(ug.apply(new UTranslate(-dimCross.getWidth() / 2, step.getValue() - dimCross.getHeight() / 2)),
|
||||
null, context);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawInternal(UGraphic ug, StairsPosition yposition, double ya, double yb, ComponentType type) {
|
||||
private void drawInternal(UGraphic ug, double ya, double yb, ComponentType type) {
|
||||
final double width = getWidth(ug.getStringBounder());
|
||||
final Area area = new Area(width, yb - ya);
|
||||
ISkinParam skinParam2 = new SkinParamBackcolored(skinParam,
|
||||
|
@ -60,15 +60,15 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
public class LivingSpace {
|
||||
|
||||
private final Participant p;
|
||||
private final Rose skin;
|
||||
private final ISkinParam skinParam;
|
||||
private final ComponentType headType;
|
||||
private final ComponentType tailType;
|
||||
private final boolean useContinueLineBecauseOfDelay;
|
||||
private final MutingLine mutingLine;
|
||||
private final Rose rose = new Rose();
|
||||
private final LiveBoxes liveBoxes;
|
||||
private final LiveBoxes liveboxes;
|
||||
|
||||
// private final Rose skin;
|
||||
// private final boolean useContinueLineBecauseOfDelay;
|
||||
// private final LivingSpaceImpl previous;
|
||||
// private LivingSpace next;
|
||||
|
||||
@ -76,7 +76,6 @@ public class LivingSpace {
|
||||
private Real posC;
|
||||
private Real posD;
|
||||
|
||||
private final EventsHistory eventsHistory;
|
||||
private boolean create = false;
|
||||
private double createY = 0;
|
||||
|
||||
@ -84,11 +83,11 @@ public class LivingSpace {
|
||||
|
||||
public int getLevelAt(Tile tile, EventsHistoryMode mode) {
|
||||
// assert mode == EventsHistoryMode.IGNORE_FUTURE_DEACTIVATE;
|
||||
return eventsHistory.getLevelAt(tile.getEvent(), mode);
|
||||
return liveboxes.getLevelAt(tile.getEvent(), mode);
|
||||
}
|
||||
|
||||
public void addStepForLivebox(Event event, double y) {
|
||||
eventsHistory.addStepForLivebox(event, y);
|
||||
liveboxes.addStep(event, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,9 +104,8 @@ public class LivingSpace {
|
||||
|
||||
public LivingSpace(Participant p, ParticipantEnglober englober, Rose skin, ISkinParam skinParam, Real position,
|
||||
List<Event> events) {
|
||||
this.eventsHistory = new EventsHistory(p, events);
|
||||
this.p = p;
|
||||
this.skin = skin;
|
||||
// this.skin = skin;
|
||||
this.skinParam = skinParam;
|
||||
this.englober = englober;
|
||||
this.posB = position;
|
||||
@ -140,9 +138,9 @@ public class LivingSpace {
|
||||
}
|
||||
// this.stairs2.addStep2(0, p.getInitialLife());
|
||||
// this.stairs2.addStep2(0, 0);
|
||||
this.useContinueLineBecauseOfDelay = useContinueLineBecauseOfDelay(events);
|
||||
// this.useContinueLineBecauseOfDelay = useContinueLineBecauseOfDelay(events);
|
||||
this.mutingLine = new MutingLine(skin, skinParam, events, p);
|
||||
this.liveBoxes = new LiveBoxes(eventsHistory, skin, skinParam, p);
|
||||
this.liveboxes = new LiveBoxes(p, events, skin, skinParam);
|
||||
}
|
||||
|
||||
private boolean useContinueLineBecauseOfDelay(List<Event> events) {
|
||||
@ -158,10 +156,9 @@ public class LivingSpace {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void drawLineAndLiveBoxes(UGraphic ug, double height, Context2D context) {
|
||||
|
||||
public void drawLineAndLiveboxes(UGraphic ug, double height, Context2D context) {
|
||||
mutingLine.drawLine(ug, context, createY, height);
|
||||
liveBoxes.drawBoxes(ug, context, createY, height);
|
||||
liveboxes.drawBoxes(ug, context, createY, height);
|
||||
}
|
||||
|
||||
// public void addDelayTile(DelayTile tile) {
|
||||
@ -212,7 +209,7 @@ public class LivingSpace {
|
||||
}
|
||||
|
||||
public Real getPosC2(StringBounder stringBounder) {
|
||||
final double delta = liveBoxes.getMaxPosition(stringBounder);
|
||||
final double delta = liveboxes.getMaxPosition(stringBounder);
|
||||
return getPosC(stringBounder).addFixed(delta);
|
||||
}
|
||||
|
||||
@ -243,7 +240,7 @@ public class LivingSpace {
|
||||
|
||||
public void delayOn(double y, double height) {
|
||||
mutingLine.delayOn(y, height);
|
||||
liveBoxes.delayOn(y, height);
|
||||
liveboxes.delayOn(y, height);
|
||||
}
|
||||
|
||||
public ParticipantEnglober getEnglober() {
|
||||
|
@ -136,7 +136,7 @@ public class LivingSpaces {
|
||||
// }
|
||||
// System.err.println("drawing lines " + livingSpace);
|
||||
final double x = livingSpace.getPosC(ug.getStringBounder()).getCurrentValue();
|
||||
livingSpace.drawLineAndLiveBoxes(ug.apply(UTranslate.dx(x)), height, context);
|
||||
livingSpace.drawLineAndLiveboxes(ug.apply(UTranslate.dx(x)), height, context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,17 +74,6 @@ public class NewpageTile extends AbstractTile {
|
||||
return tileArguments.getOrigin();
|
||||
}
|
||||
|
||||
private double y;
|
||||
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public double getCallbackY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public Event getEvent() {
|
||||
return newpage;
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ import net.sourceforge.plantuml.sequencediagram.LinkAnchor;
|
||||
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
import net.sourceforge.plantuml.ugraphic.LimitFinder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class PlayingSpace implements Bordered {
|
||||
|
||||
@ -106,15 +107,16 @@ public class PlayingSpace implements Bordered {
|
||||
|
||||
private double drawUInternal(UGraphic ug, boolean trace) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final List<YPositionedTile> local = new ArrayList<YPositionedTile>();
|
||||
final List<YPositionedTile> full = new ArrayList<YPositionedTile>();
|
||||
final List<CommonTile> local = new ArrayList<CommonTile>();
|
||||
final List<CommonTile> full = new ArrayList<CommonTile>();
|
||||
final double y = GroupingTile.fillPositionelTiles(stringBounder, startingY, tiles, local, full);
|
||||
for (YPositionedTile tile : local) {
|
||||
tile.drawInArea(ug);
|
||||
for (CommonTile tile : local) {
|
||||
final UTranslate dy = UTranslate.dy(((CommonTile) tile).getY());
|
||||
((CommonTile) tile).drawU(ug.apply(dy));
|
||||
}
|
||||
for (LinkAnchor linkAnchor : linkAnchors) {
|
||||
final YPositionedTile ytile1 = getFromAnchor(full, linkAnchor.getAnchor1());
|
||||
final YPositionedTile ytile2 = getFromAnchor(full, linkAnchor.getAnchor2());
|
||||
final CommonTile ytile1 = getFromAnchor(full, linkAnchor.getAnchor1());
|
||||
final CommonTile ytile2 = getFromAnchor(full, linkAnchor.getAnchor2());
|
||||
if (ytile1 != null && ytile2 != null) {
|
||||
linkAnchor.drawAnchor(ug, ytile1, ytile2, skinParam);
|
||||
}
|
||||
@ -123,10 +125,9 @@ public class PlayingSpace implements Bordered {
|
||||
return y;
|
||||
}
|
||||
|
||||
private YPositionedTile getFromAnchor(List<YPositionedTile> positionedTiles, String anchor) {
|
||||
for (YPositionedTile ytile : positionedTiles) {
|
||||
final boolean matchAnchorV2 = ytile.matchAnchorV2(anchor);
|
||||
if (matchAnchorV2) {
|
||||
private CommonTile getFromAnchor(List<CommonTile> positionedTiles, String anchor) {
|
||||
for (CommonTile ytile : positionedTiles) {
|
||||
if (ytile.matchAnchor(anchor)) {
|
||||
return ytile;
|
||||
}
|
||||
}
|
||||
@ -180,7 +181,7 @@ public class PlayingSpace implements Bordered {
|
||||
((GroupingTile) tile).addYNewPages(yNewPages);
|
||||
}
|
||||
if (tile instanceof NewpageTile) {
|
||||
final double y = ((NewpageTile) tile).getCallbackY();
|
||||
final double y = ((NewpageTile) tile).getY();
|
||||
yNewPages.add(y);
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,42 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public interface Tile2 extends UDrawable {
|
||||
public class Stairs {
|
||||
|
||||
private final List<Step> values = new ArrayList<Step>();
|
||||
|
||||
public void addStep(Step step) {
|
||||
if (step.getIndent() < 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (values.size() > 0) {
|
||||
final double lastY = values.get(values.size() - 1).getValue();
|
||||
if (step.getValue() <= lastY) {
|
||||
// throw new IllegalArgumentException();
|
||||
return;
|
||||
}
|
||||
}
|
||||
values.add(step);
|
||||
}
|
||||
|
||||
public int getMaxIndent() {
|
||||
int max = Integer.MIN_VALUE;
|
||||
for (Step step : values) {
|
||||
final int v = step.getIndent();
|
||||
if (v > max) {
|
||||
max = v;
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
public Collection<Step> getSteps() {
|
||||
return Collections.unmodifiableCollection(values);
|
||||
}
|
||||
|
||||
}
|
@ -1,125 +0,0 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
|
||||
public class Stairs2 {
|
||||
|
||||
private final List<StairsPosition> ys = new ArrayList<StairsPosition>();
|
||||
private final List<IntegerColored> values = new ArrayList<IntegerColored>();
|
||||
private final Map<Double, IntegerColored> cache = new HashMap<Double, IntegerColored>();
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ys.toString() + " " + values;
|
||||
}
|
||||
|
||||
public void addStep(StairsPosition position, int value, SymbolContext color) {
|
||||
if (value < 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
// System.err.println("Stairs2::addStep " + position + " " + value + " color=" +
|
||||
// color);
|
||||
assert ys.size() == values.size();
|
||||
if (ys.size() > 0) {
|
||||
final double lastY = ys.get(ys.size() - 1).getValue();
|
||||
if (position.getValue() <= lastY) {
|
||||
// throw new IllegalArgumentException();
|
||||
return;
|
||||
}
|
||||
if (lastY == position.getValue()) {
|
||||
values.set(ys.size() - 1, new IntegerColored(value, color));
|
||||
cache.clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
ys.add(position);
|
||||
values.add(new IntegerColored(value, color));
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
public int getMaxValue() {
|
||||
int max = Integer.MIN_VALUE;
|
||||
for (IntegerColored vc : values) {
|
||||
final int v = vc.getValue();
|
||||
if (v > max) {
|
||||
max = v;
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
public List<StairsPosition> getYs() {
|
||||
return Collections.unmodifiableList(ys);
|
||||
}
|
||||
|
||||
public IntegerColored getValue(double y) {
|
||||
IntegerColored resultc = cache.get(y);
|
||||
if (resultc == null) {
|
||||
resultc = getValueSlow(new StairsPosition(y, false));
|
||||
cache.put(y, resultc);
|
||||
}
|
||||
return resultc;
|
||||
}
|
||||
|
||||
private IntegerColored getValueSlow(StairsPosition y) {
|
||||
final int idx = Collections.binarySearch(ys, y);
|
||||
if (idx >= 0) {
|
||||
return values.get(idx);
|
||||
}
|
||||
final int insertPoint = -idx - 1;
|
||||
if (insertPoint == 0) {
|
||||
return new IntegerColored(0, null);
|
||||
}
|
||||
return values.get(insertPoint - 1);
|
||||
}
|
||||
|
||||
public int getLastValue() {
|
||||
final int size = values.size();
|
||||
if (size == 0) {
|
||||
return 0;
|
||||
}
|
||||
return values.get(size - 1).getValue();
|
||||
}
|
||||
|
||||
}
|
@ -37,30 +37,38 @@ package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
|
||||
public class IntegerColored {
|
||||
public class Step {
|
||||
|
||||
private final int value;
|
||||
private final double value;
|
||||
private final boolean destroy;
|
||||
private final int indent;
|
||||
private final SymbolContext color;
|
||||
|
||||
public IntegerColored(int value, SymbolContext color) {
|
||||
if (value < 0) {
|
||||
public Step(double value, boolean destroy, int indent, SymbolContext color) {
|
||||
if (indent < 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.value = value;
|
||||
this.indent = indent;
|
||||
this.color = color;
|
||||
this.value = value;
|
||||
this.destroy = destroy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "" + value + " " + color;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
public double getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public boolean isDestroy() {
|
||||
return destroy;
|
||||
}
|
||||
|
||||
public int getIndent() {
|
||||
return indent;
|
||||
}
|
||||
|
||||
public SymbolContext getColors() {
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -38,7 +38,7 @@ package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
import net.sourceforge.plantuml.real.Real;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
|
||||
public interface Tile extends Tile2 {
|
||||
public interface Tile {
|
||||
|
||||
public double getPreferredHeight();
|
||||
|
||||
@ -50,12 +50,14 @@ public interface Tile extends Tile2 {
|
||||
|
||||
public Real getMaxX();
|
||||
|
||||
public double getMiddleX();
|
||||
|
||||
public Event getEvent();
|
||||
|
||||
public double getContactPointRelative();
|
||||
|
||||
public double getZZZ();
|
||||
|
||||
public boolean matchAnchorV1(String anchor);
|
||||
public boolean matchAnchor(String anchor);
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.real.Real;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
@ -58,7 +59,7 @@ public class TileMarged extends AbstractTile implements Tile {
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
tile.drawU(ug.apply(new UTranslate(x1, y1)));
|
||||
((UDrawable) tile).drawU(ug.apply(new UTranslate(x1, y1)));
|
||||
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.real.Real;
|
||||
import net.sourceforge.plantuml.real.RealUtils;
|
||||
import net.sourceforge.plantuml.sequencediagram.Event;
|
||||
@ -56,7 +57,7 @@ public class TileParallel extends CommonTile {
|
||||
private final List<Tile> tiles = new ArrayList<Tile>();
|
||||
|
||||
@Override
|
||||
public void callbackY_internal(double y) {
|
||||
final protected void callbackY_internal(double y) {
|
||||
for (Tile tile : tiles) {
|
||||
tile.callbackY(y);
|
||||
}
|
||||
@ -70,7 +71,7 @@ public class TileParallel extends CommonTile {
|
||||
final double yPointAll = getContactPointRelative();
|
||||
for (Tile tile : tiles) {
|
||||
final double yPoint = tile.getContactPointRelative();
|
||||
tile.drawU(ug.apply(UTranslate.dy(yPointAll - yPoint)));
|
||||
((UDrawable) tile).drawU(ug.apply(UTranslate.dy(yPointAll - yPoint)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,9 +157,9 @@ public class TileParallel extends CommonTile {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean matchAnchorV1(String anchor) {
|
||||
public boolean matchAnchor(String anchor) {
|
||||
for (Tile tile : tiles) {
|
||||
if (tile.matchAnchorV1(anchor)) {
|
||||
if (tile.matchAnchor(anchor)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||
import net.sourceforge.plantuml.graphic.UGraphicDelegator;
|
||||
import net.sourceforge.plantuml.skin.Context2D;
|
||||
import net.sourceforge.plantuml.ugraphic.UChange;
|
||||
@ -52,7 +53,7 @@ public class UGraphicInterceptorTile extends UGraphicDelegator implements Contex
|
||||
|
||||
public void draw(UShape shape) {
|
||||
if (shape instanceof Tile) {
|
||||
final Tile drawable = (Tile) shape;
|
||||
final UDrawable drawable = (UDrawable) shape;
|
||||
drawable.drawU(this);
|
||||
} else {
|
||||
getUg().draw(shape);
|
||||
|
@ -1,77 +0,0 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2020, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* If you like this project or if you find it useful, you can support us at:
|
||||
*
|
||||
* http://plantuml.com/patreon (only 1$ per month!)
|
||||
* http://plantuml.com/paypal
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class YPositionedTile {
|
||||
|
||||
private final Tile tile;
|
||||
private final double y;
|
||||
|
||||
public YPositionedTile(Tile tile, double y) {
|
||||
this.tile = tile;
|
||||
this.y = y;
|
||||
tile.callbackY(y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "y=" + y + " " + tile;
|
||||
}
|
||||
|
||||
public void drawInArea(UGraphic ug) {
|
||||
// System.err.println("YPositionedTile::drawU y=" + y + " " + tile);
|
||||
tile.drawU(ug.apply(UTranslate.dy(y)));
|
||||
}
|
||||
|
||||
public boolean matchAnchorV2(String anchor) {
|
||||
final boolean result = tile.matchAnchorV1(anchor);
|
||||
return result;
|
||||
}
|
||||
|
||||
public final double getY() {
|
||||
return y + tile.getContactPointRelative();
|
||||
}
|
||||
|
||||
public double getMiddleX() {
|
||||
final double max = tile.getMaxX().getCurrentValue();
|
||||
final double min = tile.getMinX().getCurrentValue();
|
||||
return (min + max) / 2;
|
||||
}
|
||||
|
||||
}
|
@ -30,53 +30,31 @@
|
||||
*
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.teoz;
|
||||
package net.sourceforge.plantuml.ugraphic.svg;
|
||||
|
||||
public class StairsPosition implements Comparable<StairsPosition> {
|
||||
import net.sourceforge.plantuml.svg.SvgGraphics;
|
||||
import net.sourceforge.plantuml.ugraphic.UDriver;
|
||||
import net.sourceforge.plantuml.ugraphic.UParam;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorGradient;
|
||||
|
||||
private final double value;
|
||||
private final boolean destroy;
|
||||
public class DriverPixelSvg implements UDriver<SvgGraphics> {
|
||||
|
||||
public StairsPosition(double value, boolean destroy) {
|
||||
this.value = value;
|
||||
this.destroy = destroy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "" + value + "-(" + destroy + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return new Double(value).hashCode() + (destroy ? 17 : 37);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
final StairsPosition other = (StairsPosition) obj;
|
||||
return this.value == other.value && this.destroy == other.destroy;
|
||||
}
|
||||
|
||||
public double getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public int compareTo(StairsPosition other) {
|
||||
if (this.value > other.value) {
|
||||
return 1;
|
||||
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) {
|
||||
final HColor color = param.getColor();
|
||||
if (color instanceof HColorGradient) {
|
||||
final HColorGradient gr = (HColorGradient) color;
|
||||
svg.setStrokeColor(mapper.toSvg(gr.getColor1()));
|
||||
} else {
|
||||
svg.setStrokeColor(mapper.toSvg(color));
|
||||
}
|
||||
if (this.value < other.value) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
svg.setStrokeWidth(0.5, "");
|
||||
|
||||
public boolean isDestroy() {
|
||||
return destroy;
|
||||
}
|
||||
svg.svgRectangle(x, y, 0.5, 0.5, 0, 0, 0, null, null);
|
||||
|
||||
}
|
||||
}
|
@ -61,6 +61,7 @@ import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UImageSvg;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.UPath;
|
||||
import net.sourceforge.plantuml.ugraphic.UPixel;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UText;
|
||||
@ -148,6 +149,7 @@ public class UGraphicSvg extends AbstractUGraphic<SvgGraphics> implements ClipCo
|
||||
registerDriver(UText.class, new DriverTextSvg(getStringBounder(), this));
|
||||
}
|
||||
registerDriver(ULine.class, new DriverLineSvg(this));
|
||||
registerDriver(UPixel.class, new DriverPixelSvg());
|
||||
registerDriver(UPolygon.class, new DriverPolygonSvg(this));
|
||||
registerDriver(UEllipse.class, new DriverEllipseSvg(this));
|
||||
registerDriver(UImage.class, new DriverImagePng(this));
|
||||
|
@ -80,7 +80,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static int beta() {
|
||||
final int beta = 2;
|
||||
final int beta = 6;
|
||||
return beta;
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.3 KiB |
@ -146,7 +146,7 @@ public class WBSDiagram extends UmlDiagram {
|
||||
if (root != null) {
|
||||
return CommandExecutionResult.error("Error 44");
|
||||
}
|
||||
initRoot(backColor, label, stereotype);
|
||||
initRoot(backColor, label, stereotype, shape);
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
return add(backColor, level, label, stereotype, direction, shape);
|
||||
@ -159,9 +159,9 @@ public class WBSDiagram extends UmlDiagram {
|
||||
private WElement root;
|
||||
private WElement last;
|
||||
|
||||
private void initRoot(HColor backColor, String label, String stereotype) {
|
||||
private void initRoot(HColor backColor, String label, String stereotype, IdeaShape shape) {
|
||||
root = new WElement(backColor, Display.getWithNewlines(label), stereotype,
|
||||
getSkinParam().getCurrentStyleBuilder());
|
||||
getSkinParam().getCurrentStyleBuilder(), shape);
|
||||
last = root;
|
||||
}
|
||||
|
||||
|
@ -41,9 +41,11 @@ import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.mindmap.IdeaShape;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
@ -96,7 +98,9 @@ abstract class WBSTextBlock extends AbstractTextBlock {
|
||||
final FtileBox box = FtileBox.createWbs(style, idea.withBackColor(skinParam), label);
|
||||
return box;
|
||||
}
|
||||
throw new UnsupportedOperationException();
|
||||
final TextBlock text = label.create0(style.getFontConfiguration(skinParam.getIHtmlColorSet()),
|
||||
style.getHorizontalAlignment(), skinParam, style.wrapWidth(), CreoleMode.FULL, null, null);
|
||||
return TextBlockUtils.withMargin(text, 0, 3, 1, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -104,8 +104,8 @@ final class WElement {
|
||||
return result;
|
||||
}
|
||||
|
||||
public WElement(HColor backColor, Display label, String stereotype, StyleBuilder styleBuilder) {
|
||||
this(backColor, 0, label, stereotype, null, IdeaShape.BOX, styleBuilder);
|
||||
public WElement(HColor backColor, Display label, String stereotype, StyleBuilder styleBuilder, IdeaShape shape) {
|
||||
this(backColor, 0, label, stereotype, null, shape, styleBuilder);
|
||||
}
|
||||
|
||||
private WElement(HColor backColor, int level, Display label, String stereotype, WElement parent, IdeaShape shape,
|
||||
|
@ -55,6 +55,7 @@ public class YamlDiagramFactory extends PSystemAbstractFactory {
|
||||
}
|
||||
|
||||
public Diagram createSystem(UmlSource source) {
|
||||
final List<String> highlighted = new ArrayList<String>();
|
||||
JsonValue yaml = null;
|
||||
StyleExtractor styleExtractor = null;
|
||||
try {
|
||||
@ -67,13 +68,17 @@ public class YamlDiagramFactory extends PSystemAbstractFactory {
|
||||
if (it.hasNext() == false) {
|
||||
break;
|
||||
}
|
||||
if (line.startsWith("#highlight ")) {
|
||||
highlighted.add(line.substring("#highlight ".length()).trim());
|
||||
continue;
|
||||
}
|
||||
list.add(line);
|
||||
}
|
||||
yaml = new SimpleYamlParser().parse(list);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
final JsonDiagram result = new JsonDiagram(UmlDiagramType.YAML, yaml, new ArrayList<String>());
|
||||
final JsonDiagram result = new JsonDiagram(UmlDiagramType.YAML, yaml, highlighted);
|
||||
if (styleExtractor != null) {
|
||||
styleExtractor.applyStyles(result.getSkinParam());
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class YamlLines implements Iterable<String> {
|
||||
|
||||
public static final String KEY = "([_0-9\\w].*)";
|
||||
public static final String KEY = "([^:\\s]+)";
|
||||
|
||||
private List<String> lines = new ArrayList<String>();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user