mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
Add shadowing for nwdiag and support for D+xx notation in gantt
This commit is contained in:
parent
a083d92ac6
commit
e1fe53457a
@ -84,6 +84,9 @@ public enum UmlDiagramType {
|
|||||||
if (this == TIMING) {
|
if (this == TIMING) {
|
||||||
return SName.timingDiagram;
|
return SName.timingDiagram;
|
||||||
}
|
}
|
||||||
|
if (this == NWDIAG) {
|
||||||
|
return SName.nwdiagDiagram;
|
||||||
|
}
|
||||||
return SName.activityDiagram;
|
return SName.activityDiagram;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,8 +66,8 @@ import net.sourceforge.plantuml.graphic.UDrawable;
|
|||||||
import net.sourceforge.plantuml.nwdiag.core.NServer;
|
import net.sourceforge.plantuml.nwdiag.core.NServer;
|
||||||
import net.sourceforge.plantuml.nwdiag.core.Network;
|
import net.sourceforge.plantuml.nwdiag.core.Network;
|
||||||
import net.sourceforge.plantuml.nwdiag.core.NwGroup;
|
import net.sourceforge.plantuml.nwdiag.core.NwGroup;
|
||||||
import net.sourceforge.plantuml.nwdiag.next.GridTextBlockDecoratedNext;
|
import net.sourceforge.plantuml.nwdiag.next.GridTextBlockDecorated;
|
||||||
import net.sourceforge.plantuml.nwdiag.next.LinkedElementNext;
|
import net.sourceforge.plantuml.nwdiag.next.LinkedElement;
|
||||||
import net.sourceforge.plantuml.nwdiag.next.NBar;
|
import net.sourceforge.plantuml.nwdiag.next.NBar;
|
||||||
import net.sourceforge.plantuml.nwdiag.next.NPlayField;
|
import net.sourceforge.plantuml.nwdiag.next.NPlayField;
|
||||||
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
|
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
|
||||||
@ -127,7 +127,7 @@ public class NwDiagram extends UmlDiagram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Network createNetwork(String name) {
|
private Network createNetwork(String name) {
|
||||||
final Network network = new Network(playField.getLast(), playField.createNewStage(), name, networks.size());
|
final Network network = new Network(playField.getLast(), playField.createNewStage(), name);
|
||||||
networks.add(network);
|
networks.add(network);
|
||||||
return network;
|
return network;
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ public class NwDiagram extends UmlDiagram {
|
|||||||
final NServer element;
|
final NServer element;
|
||||||
if (currentNetwork() == null) {
|
if (currentNetwork() == null) {
|
||||||
createNetwork(name1);
|
createNetwork(name1);
|
||||||
element = new NServer(name2, currentNetwork(), this.getSkinParam());
|
element = new NServer(name2);
|
||||||
} else {
|
} else {
|
||||||
final NServer already = servers.get(name1);
|
final NServer already = servers.get(name1);
|
||||||
final Network network1 = createNetwork("");
|
final Network network1 = createNetwork("");
|
||||||
@ -147,7 +147,7 @@ public class NwDiagram extends UmlDiagram {
|
|||||||
if (already != null) {
|
if (already != null) {
|
||||||
connect(already, toSet(null));
|
connect(already, toSet(null));
|
||||||
}
|
}
|
||||||
element = new NServer(name2, currentNetwork(), this.getSkinParam());
|
element = new NServer(name2);
|
||||||
}
|
}
|
||||||
servers.put(name2, element);
|
servers.put(name2, element);
|
||||||
addInternal(element, toSet(null));
|
addInternal(element, toSet(null));
|
||||||
@ -186,13 +186,13 @@ public class NwDiagram extends UmlDiagram {
|
|||||||
assert currentGroup == null;
|
assert currentGroup == null;
|
||||||
final Network network1 = createNetwork("");
|
final Network network1 = createNetwork("");
|
||||||
network1.goInvisible();
|
network1.goInvisible();
|
||||||
server = new NServer(name, currentNetwork(), this.getSkinParam());
|
server = new NServer(name);
|
||||||
servers.put(name, server);
|
servers.put(name, server);
|
||||||
server.doNotHaveItsOwnColumn();
|
server.doNotPrintFirstLink();
|
||||||
} else {
|
} else {
|
||||||
server = servers.get(name);
|
server = servers.get(name);
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
server = new NServer(name, currentNetwork(), this.getSkinParam());
|
server = new NServer(name);
|
||||||
servers.put(name, server);
|
servers.put(name, server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -291,7 +291,7 @@ public class NwDiagram extends UmlDiagram {
|
|||||||
double deltaX = 0;
|
double deltaX = 0;
|
||||||
double deltaY = 0;
|
double deltaY = 0;
|
||||||
|
|
||||||
final GridTextBlockDecoratedNext grid = buildGrid(stringBounder);
|
final GridTextBlockDecorated grid = buildGrid(stringBounder);
|
||||||
|
|
||||||
for (int i = 0; i < networks.size(); i++) {
|
for (int i = 0; i < networks.size(); i++) {
|
||||||
final Network current = networks.get(i);
|
final Network current = networks.get(i);
|
||||||
@ -299,7 +299,7 @@ public class NwDiagram extends UmlDiagram {
|
|||||||
final TextBlock desc = toTextBlock(current.getDisplayName(), address);
|
final TextBlock desc = toTextBlock(current.getDisplayName(), address);
|
||||||
final Dimension2D dim = desc.calculateDimension(stringBounder);
|
final Dimension2D dim = desc.calculateDimension(stringBounder);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
deltaY = (dim.getHeight() - GridTextBlockDecoratedNext.NETWORK_THIN) / 2;
|
deltaY = (dim.getHeight() - GridTextBlockDecorated.NETWORK_THIN) / 2;
|
||||||
}
|
}
|
||||||
deltaX = Math.max(deltaX, dim.getWidth());
|
deltaX = Math.max(deltaX, dim.getWidth());
|
||||||
}
|
}
|
||||||
@ -335,11 +335,11 @@ public class NwDiagram extends UmlDiagram {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private GridTextBlockDecoratedNext buildGrid(StringBounder stringBounder) {
|
private GridTextBlockDecorated buildGrid(StringBounder stringBounder) {
|
||||||
|
|
||||||
playField.fixGroups(groups, servers.values());
|
playField.fixGroups(groups, servers.values());
|
||||||
|
|
||||||
final GridTextBlockDecoratedNext grid = new GridTextBlockDecoratedNext(networks.size(), servers.size(), groups,
|
final GridTextBlockDecorated grid = new GridTextBlockDecorated(networks.size(), servers.size(), groups,
|
||||||
networks, getSkinParam());
|
networks, getSkinParam());
|
||||||
|
|
||||||
final Map<NBar, Integer> layout = playField.doLayout();
|
final Map<NBar, Integer> layout = playField.doLayout();
|
||||||
@ -350,11 +350,11 @@ public class NwDiagram extends UmlDiagram {
|
|||||||
if (server.getMainNetworkNext() == current) {
|
if (server.getMainNetworkNext() == current) {
|
||||||
final Map<Network, String> conns = getLinks(server);
|
final Map<Network, String> conns = getLinks(server);
|
||||||
final int col = layout.get(server.getBar());
|
final int col = layout.get(server.getBar());
|
||||||
double topMargin = LinkedElementNext.MAGIC;
|
double topMargin = LinkedElement.MAGIC;
|
||||||
NwGroup group = getGroupOf(server);
|
NwGroup group = getGroupOf(server);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
topMargin += group.getTopHeaderHeight(stringBounder, getSkinParam());
|
topMargin += group.getTopHeaderHeight(stringBounder, getSkinParam());
|
||||||
grid.add(i, col, server.asTextBlockNext(topMargin, conns, networks, getSkinParam()));
|
grid.add(i, col, server.asTextBlock(topMargin, conns, networks, getSkinParam()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -364,7 +364,7 @@ public class NwDiagram extends UmlDiagram {
|
|||||||
|
|
||||||
private NwGroup getGroupOf(NServer server) {
|
private NwGroup getGroupOf(NServer server) {
|
||||||
for (NwGroup group : groups) {
|
for (NwGroup group : groups) {
|
||||||
if (group.containsNext(server)) {
|
if (group.contains(server)) {
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,403 +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.nwdiag;
|
|
||||||
|
|
||||||
import java.awt.geom.Dimension2D;
|
|
||||||
import java.awt.geom.Rectangle2D;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import net.sourceforge.plantuml.ColorParam;
|
|
||||||
import net.sourceforge.plantuml.FileFormatOption;
|
|
||||||
import net.sourceforge.plantuml.SpriteContainerEmpty;
|
|
||||||
import net.sourceforge.plantuml.UmlDiagram;
|
|
||||||
import net.sourceforge.plantuml.UmlDiagramType;
|
|
||||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
|
||||||
import net.sourceforge.plantuml.core.DiagramDescription;
|
|
||||||
import net.sourceforge.plantuml.core.ImageData;
|
|
||||||
import net.sourceforge.plantuml.core.UmlSource;
|
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
|
||||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
|
||||||
import net.sourceforge.plantuml.graphic.InnerStrategy;
|
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
|
||||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
|
||||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.core.NServer;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.core.Network;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.core.NwGroup;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.legacy.GridTextBlockDecorated;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.legacy.NServerLegacy;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.legacy.NetworkLegacy;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.legacy.NwGroupLegacy;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.next.NPlayField;
|
|
||||||
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
|
|
||||||
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UEmpty;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
|
||||||
|
|
||||||
public class NwDiagramLegacy extends UmlDiagram {
|
|
||||||
|
|
||||||
private boolean initDone;
|
|
||||||
private final Map<String, NServer> servers = new LinkedHashMap<>();
|
|
||||||
private final List<Network> networks = new ArrayList<>();
|
|
||||||
private final List<NwGroup> groups = new ArrayList<>();
|
|
||||||
private NwGroup currentGroup = null;
|
|
||||||
|
|
||||||
private final NPlayField playField = new NPlayField();
|
|
||||||
|
|
||||||
public DiagramDescription getDescription() {
|
|
||||||
return new DiagramDescription("(Nwdiag)");
|
|
||||||
}
|
|
||||||
|
|
||||||
public NwDiagramLegacy(UmlSource source) {
|
|
||||||
super(source, UmlDiagramType.NWDIAG);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init() {
|
|
||||||
initDone = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Network currentNetwork() {
|
|
||||||
if (networks.size() == 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return networks.get(networks.size() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandExecutionResult openGroup(String name) {
|
|
||||||
if (initDone == false) {
|
|
||||||
return errorNoInit();
|
|
||||||
}
|
|
||||||
currentGroup = new NwGroupLegacy(name, currentNetwork());
|
|
||||||
groups.add(currentGroup);
|
|
||||||
return CommandExecutionResult.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandExecutionResult openNetwork(String name) {
|
|
||||||
if (initDone == false) {
|
|
||||||
return errorNoInit();
|
|
||||||
}
|
|
||||||
createNetwork(name);
|
|
||||||
return CommandExecutionResult.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Network createNetwork(String name) {
|
|
||||||
final Network network = new NetworkLegacy(playField.createNewStage(), name, networks.size());
|
|
||||||
networks.add(network);
|
|
||||||
return network;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandExecutionResult link(String name1, String name2) {
|
|
||||||
if (initDone == false) {
|
|
||||||
return errorNoInit();
|
|
||||||
}
|
|
||||||
final NServer element;
|
|
||||||
if (currentNetwork() == null) {
|
|
||||||
createNetwork(name1);
|
|
||||||
element = new NServerLegacy(name2, currentNetwork(), this.getSkinParam());
|
|
||||||
} else {
|
|
||||||
final NServer already = servers.get(name1);
|
|
||||||
final Network network1 = createNetwork("");
|
|
||||||
network1.goInvisible();
|
|
||||||
if (already != null) {
|
|
||||||
connect(already, toSet(null));
|
|
||||||
}
|
|
||||||
element = new NServerLegacy(name2, currentNetwork(), this.getSkinParam());
|
|
||||||
((NServerLegacy)element).sameColThan(already);
|
|
||||||
}
|
|
||||||
servers.put(name2, element);
|
|
||||||
addInternal(element, toSet(null));
|
|
||||||
return CommandExecutionResult.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addInternal(NServer server, Map<String, String> props) {
|
|
||||||
connect(server, props);
|
|
||||||
final String description = props.get("description");
|
|
||||||
if (description != null) {
|
|
||||||
server.setDescription(description);
|
|
||||||
}
|
|
||||||
final String shape = props.get("shape");
|
|
||||||
if (shape != null) {
|
|
||||||
server.setShape(shape);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void connect(NServer server, final Map<String, String> props) {
|
|
||||||
((NetworkLegacy) currentNetwork()).addServer(Objects.requireNonNull((NServerLegacy) server), props);
|
|
||||||
server.connect(currentNetwork(), props);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandExecutionResult addElement(String name, String definition) {
|
|
||||||
if (initDone == false) {
|
|
||||||
return errorNoInit();
|
|
||||||
}
|
|
||||||
if (currentGroup != null) {
|
|
||||||
currentGroup.addName(name);
|
|
||||||
}
|
|
||||||
NServer server = null;
|
|
||||||
if (currentNetwork() == null) {
|
|
||||||
if (currentGroup != null) {
|
|
||||||
return CommandExecutionResult.ok();
|
|
||||||
}
|
|
||||||
assert currentGroup == null;
|
|
||||||
final Network network1 = createNetwork("");
|
|
||||||
network1.goInvisible();
|
|
||||||
server = new NServerLegacy(name, currentNetwork(), this.getSkinParam());
|
|
||||||
servers.put(name, server);
|
|
||||||
((NServerLegacy) server).doNotHaveItsOwnColumn();
|
|
||||||
} else {
|
|
||||||
server = servers.get(name);
|
|
||||||
if (server == null) {
|
|
||||||
server = new NServerLegacy(name, currentNetwork(), this.getSkinParam());
|
|
||||||
servers.put(name, server);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
addInternal(server, toSet(definition));
|
|
||||||
return CommandExecutionResult.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandExecutionResult endSomething() {
|
|
||||||
if (initDone == false) {
|
|
||||||
return errorNoInit();
|
|
||||||
}
|
|
||||||
this.currentGroup = null;
|
|
||||||
return CommandExecutionResult.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
private CommandExecutionResult errorNoInit() {
|
|
||||||
return CommandExecutionResult.error("Maybe you forget 'nwdiag {' in your diagram ?");
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, String> toSet(String definition) {
|
|
||||||
final Map<String, String> result = new HashMap<String, String>();
|
|
||||||
if (definition == null) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
final Pattern p = Pattern.compile("\\s*(\\w+)\\s*=\\s*(\"([^\"]*)\"|[^\\s,]+)");
|
|
||||||
final Matcher m = p.matcher(definition);
|
|
||||||
while (m.find()) {
|
|
||||||
final String name = m.group(1);
|
|
||||||
final String value = m.group(3) == null ? m.group(2) : m.group(3);
|
|
||||||
result.put(name, value);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
|
|
||||||
throws IOException {
|
|
||||||
|
|
||||||
return createImageBuilder(fileFormatOption).drawable(getTextBlock()).write(os);
|
|
||||||
}
|
|
||||||
|
|
||||||
private TextBlockBackcolored getTextBlock() {
|
|
||||||
return new TextBlockBackcolored() {
|
|
||||||
public void drawU(UGraphic ug) {
|
|
||||||
drawMe(ug);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
|
||||||
return getTotalDimension(stringBounder);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MinMax getMinMax(StringBounder stringBounder) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public HColor getBackcolor() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private TextBlock toTextBlock(String name, String s) {
|
|
||||||
if (s != null) {
|
|
||||||
name += "\\n" + s;
|
|
||||||
}
|
|
||||||
return Display.getWithNewlines(name).create(getFontConfiguration(), HorizontalAlignment.RIGHT,
|
|
||||||
new SpriteContainerEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
private FontConfiguration getFontConfiguration() {
|
|
||||||
final UFont font = UFont.serif(11);
|
|
||||||
return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dimension2D getTotalDimension(StringBounder stringBounder) {
|
|
||||||
return TextBlockUtils.getMinMax(new UDrawable() {
|
|
||||||
public void drawU(UGraphic ug) {
|
|
||||||
drawMe(ug);
|
|
||||||
}
|
|
||||||
}, stringBounder, true).getDimension();
|
|
||||||
}
|
|
||||||
|
|
||||||
private final double margin = 5;
|
|
||||||
|
|
||||||
private void drawMe(UGraphic ug) {
|
|
||||||
ug = ug.apply(new UTranslate(margin, margin));
|
|
||||||
|
|
||||||
final StringBounder stringBounder = ug.getStringBounder();
|
|
||||||
final GridTextBlockDecorated grid = buildGrid();
|
|
||||||
|
|
||||||
double deltaX = 0;
|
|
||||||
double deltaY = 0;
|
|
||||||
for (int i = 0; i < networks.size(); i++) {
|
|
||||||
final Network current = networks.get(i);
|
|
||||||
final String address = current.getOwnAdress();
|
|
||||||
final TextBlock desc = toTextBlock(current.getDisplayName(), address);
|
|
||||||
final Dimension2D dim = desc.calculateDimension(stringBounder);
|
|
||||||
if (i == 0) {
|
|
||||||
deltaY = (dim.getHeight() - GridTextBlockDecorated.NETWORK_THIN) / 2;
|
|
||||||
}
|
|
||||||
deltaX = Math.max(deltaX, dim.getWidth());
|
|
||||||
}
|
|
||||||
double y = 0;
|
|
||||||
for (int i = 0; i < networks.size(); i++) {
|
|
||||||
final Network current = networks.get(i);
|
|
||||||
final String address = current.getOwnAdress();
|
|
||||||
final TextBlock desc = toTextBlock(current.getDisplayName(), address);
|
|
||||||
final Dimension2D dim = desc.calculateDimension(stringBounder);
|
|
||||||
desc.drawU(ug.apply(new UTranslate(deltaX - dim.getWidth(), y)));
|
|
||||||
|
|
||||||
y += grid.lineHeight(stringBounder, i);
|
|
||||||
}
|
|
||||||
deltaX += 5;
|
|
||||||
|
|
||||||
grid.drawU(ug.apply(ColorParam.activityBorder.getDefaultValue())
|
|
||||||
.apply(ColorParam.activityBackground.getDefaultValue().bg()).apply(new UTranslate(deltaX, deltaY)));
|
|
||||||
final Dimension2D dimGrid = grid.calculateDimension(stringBounder);
|
|
||||||
|
|
||||||
ug.apply(new UTranslate(dimGrid.getWidth() + deltaX + margin, dimGrid.getHeight() + deltaY + margin))
|
|
||||||
.draw(new UEmpty(1, 1));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<NetworkLegacy, String> getLinks(NServer element) {
|
|
||||||
final Map<NetworkLegacy, String> result = new LinkedHashMap<>();
|
|
||||||
for (Network network1 : networks) {
|
|
||||||
final NetworkLegacy network = (NetworkLegacy) network1;
|
|
||||||
final String s = network.getAdress(element);
|
|
||||||
if (s != null) {
|
|
||||||
result.put(network, s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private GridTextBlockDecorated buildGrid() {
|
|
||||||
final GridTextBlockDecorated grid = new GridTextBlockDecorated(networks.size(), servers.size(), groups,
|
|
||||||
networks, getSkinParam());
|
|
||||||
|
|
||||||
for (int i = 0; i < networks.size(); i++) {
|
|
||||||
final NetworkLegacy current = (NetworkLegacy) networks.get(i);
|
|
||||||
int j = 0;
|
|
||||||
for (Map.Entry<String, NServer> ent : servers.entrySet()) {
|
|
||||||
final NServerLegacy square = (NServerLegacy) ent.getValue();
|
|
||||||
if (square.getMainNetwork() == current) {
|
|
||||||
final Map<NetworkLegacy, String> conns = getLinks(square);
|
|
||||||
final NServerLegacy sameCol = square.getSameCol();
|
|
||||||
if (sameCol != null) {
|
|
||||||
square.setNumCol(sameCol.getNumCol());
|
|
||||||
} else {
|
|
||||||
square.setNumCol(j);
|
|
||||||
}
|
|
||||||
grid.add(i, square.getNumCol(), square.asTextBlock(conns, networks));
|
|
||||||
}
|
|
||||||
if (square.hasItsOwnColumn()) {
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
grid.checkGroups();
|
|
||||||
|
|
||||||
return grid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandExecutionResult setProperty(String property, String value) {
|
|
||||||
if (initDone == false) {
|
|
||||||
return errorNoInit();
|
|
||||||
}
|
|
||||||
if ("address".equalsIgnoreCase(property) && currentNetwork() != null) {
|
|
||||||
currentNetwork().setOwnAdress(value);
|
|
||||||
}
|
|
||||||
if ("width".equalsIgnoreCase(property) && currentNetwork() != null) {
|
|
||||||
currentNetwork().setFullWidth("full".equalsIgnoreCase(value));
|
|
||||||
}
|
|
||||||
if ("color".equalsIgnoreCase(property)) {
|
|
||||||
final HColor color = value == null ? null
|
|
||||||
: NwGroup.colors.getColorOrWhite(getSkinParam().getThemeStyle(), value);
|
|
||||||
if (currentGroup != null) {
|
|
||||||
currentGroup.setColor(color);
|
|
||||||
} else if (currentNetwork() != null) {
|
|
||||||
currentNetwork().setColor(color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ("description".equalsIgnoreCase(property)) {
|
|
||||||
if (currentGroup == null) {
|
|
||||||
currentNetwork().setDescription(value);
|
|
||||||
} else {
|
|
||||||
currentGroup.setDescription(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return CommandExecutionResult.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ClockwiseTopRightBottomLeft getDefaultMargins() {
|
|
||||||
return ClockwiseTopRightBottomLeft.none();
|
|
||||||
}
|
|
||||||
}
|
|
@ -41,6 +41,7 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.ColorParam;
|
import net.sourceforge.plantuml.ColorParam;
|
||||||
import net.sourceforge.plantuml.ComponentStyle;
|
import net.sourceforge.plantuml.ComponentStyle;
|
||||||
|
import net.sourceforge.plantuml.ISkinParam;
|
||||||
import net.sourceforge.plantuml.ISkinSimple;
|
import net.sourceforge.plantuml.ISkinSimple;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
@ -49,9 +50,15 @@ import net.sourceforge.plantuml.graphic.SymbolContext;
|
|||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||||
import net.sourceforge.plantuml.graphic.USymbol;
|
import net.sourceforge.plantuml.graphic.USymbol;
|
||||||
import net.sourceforge.plantuml.nwdiag.next.LinkedElementNext;
|
import net.sourceforge.plantuml.mindmap.IdeaShape;
|
||||||
|
import net.sourceforge.plantuml.nwdiag.next.LinkedElement;
|
||||||
import net.sourceforge.plantuml.nwdiag.next.NBar;
|
import net.sourceforge.plantuml.nwdiag.next.NBar;
|
||||||
import net.sourceforge.plantuml.skin.ActorStyle;
|
import net.sourceforge.plantuml.skin.ActorStyle;
|
||||||
|
import net.sourceforge.plantuml.style.PName;
|
||||||
|
import net.sourceforge.plantuml.style.SName;
|
||||||
|
import net.sourceforge.plantuml.style.Style;
|
||||||
|
import net.sourceforge.plantuml.style.StyleBuilder;
|
||||||
|
import net.sourceforge.plantuml.style.StyleSignature;
|
||||||
import net.sourceforge.plantuml.svek.PackageStyle;
|
import net.sourceforge.plantuml.svek.PackageStyle;
|
||||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
||||||
@ -65,15 +72,14 @@ public class NServer {
|
|||||||
private String description;
|
private String description;
|
||||||
private final NBar bar = new NBar();
|
private final NBar bar = new NBar();
|
||||||
|
|
||||||
// To be renamed in "printFirstLink"
|
private boolean printFirstLink = true;
|
||||||
private boolean hasItsOwnColumn = true;
|
|
||||||
|
|
||||||
public void doNotHaveItsOwnColumn() {
|
public void doNotPrintFirstLink() {
|
||||||
this.hasItsOwnColumn = false;
|
this.printFirstLink = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean hasItsOwnColumn() {
|
public final boolean printFirstLink() {
|
||||||
return hasItsOwnColumn;
|
return printFirstLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Network getMainNetworkNext() {
|
public Network getMainNetworkNext() {
|
||||||
@ -95,18 +101,30 @@ public class NServer {
|
|||||||
return Display.getWithNewlines(s).create(getFontConfiguration(), HorizontalAlignment.LEFT, spriteContainer);
|
return Display.getWithNewlines(s).create(getFontConfiguration(), HorizontalAlignment.LEFT, spriteContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinkedElementNext asTextBlockNext(double topMargin, Map<Network, String> conns, List<Network> networks,
|
private StyleSignature getStyleDefinition() {
|
||||||
ISkinSimple spriteContainer) {
|
return StyleSignature.of(SName.root, SName.element, SName.nwdiagDiagram, SName.node);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinkedElement asTextBlock(double topMargin, Map<Network, String> conns, List<Network> networks,
|
||||||
|
ISkinParam skinParam) {
|
||||||
|
double deltaShadow = 3;
|
||||||
|
final StyleBuilder styleBuilder = skinParam.getCurrentStyleBuilder();
|
||||||
|
if (styleBuilder != null) {
|
||||||
|
final Style style = getStyleDefinition().getMergedStyle(styleBuilder);
|
||||||
|
deltaShadow = style.value(PName.Shadowing).asDouble();
|
||||||
|
}
|
||||||
|
|
||||||
final Map<Network, TextBlock> conns2 = new LinkedHashMap<Network, TextBlock>();
|
final Map<Network, TextBlock> conns2 = new LinkedHashMap<Network, TextBlock>();
|
||||||
for (Entry<Network, String> ent : conns.entrySet()) {
|
for (Entry<Network, String> ent : conns.entrySet()) {
|
||||||
conns2.put(ent.getKey(), toTextBlock(ent.getValue(), spriteContainer));
|
conns2.put(ent.getKey(), toTextBlock(ent.getValue(), skinParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
final SymbolContext symbolContext = new SymbolContext(ColorParam.activityBackground.getDefaultValue(),
|
final SymbolContext symbolContext = new SymbolContext(ColorParam.activityBackground.getDefaultValue(),
|
||||||
ColorParam.activityBorder.getDefaultValue()).withShadow(3);
|
ColorParam.activityBorder.getDefaultValue()).withShadow(deltaShadow);
|
||||||
final TextBlock desc = toTextBlock(getDescription(), spriteContainer);
|
final TextBlock desc = toTextBlock(getDescription(), skinParam);
|
||||||
final TextBlock box = getShape().asSmall(TextBlockUtils.empty(0, 0), desc, TextBlockUtils.empty(0, 0),
|
final TextBlock box = getShape().asSmall(TextBlockUtils.empty(0, 0), desc, TextBlockUtils.empty(0, 0),
|
||||||
symbolContext, HorizontalAlignment.CENTER);
|
symbolContext, HorizontalAlignment.CENTER);
|
||||||
return new LinkedElementNext(topMargin, this, box, conns2, networks);
|
return new LinkedElement(topMargin, this, box, conns2, networks);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void connect(Network network, Map<String, String> props) {
|
public void connect(Network network, Map<String, String> props) {
|
||||||
@ -138,11 +156,6 @@ public class NServer {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NServer(String name, Object... unused) {
|
|
||||||
this.description = name;
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected final FontConfiguration getFontConfiguration() {
|
protected final FontConfiguration getFontConfiguration() {
|
||||||
final UFont font = UFont.serif(11);
|
final UFont font = UFont.serif(11);
|
||||||
return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false);
|
return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false);
|
||||||
|
@ -72,7 +72,7 @@ public class Network {
|
|||||||
return up;
|
return up;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Network(NStage up, NStage nstage, String name, Object... unused) {
|
public Network(NStage up, NStage nstage, String name) {
|
||||||
this.up = up;
|
this.up = up;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.nstage = nstage;
|
this.nstage = nstage;
|
||||||
|
@ -47,7 +47,6 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
|
|||||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.nwdiag.next.LinkedElementNext;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.next.NBox;
|
import net.sourceforge.plantuml.nwdiag.next.NBox;
|
||||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
import net.sourceforge.plantuml.ugraphic.MinMax;
|
||||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||||
@ -129,12 +128,7 @@ public class NwGroup {
|
|||||||
return Collections.unmodifiableSet(names);
|
return Collections.unmodifiableSet(names);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matches(LinkedElementNext tested) {
|
public boolean contains(NServer server) {
|
||||||
// To be merged with containsNext
|
|
||||||
return names().contains(tested.getElement().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean containsNext(NServer server) {
|
|
||||||
return names.contains(server.getName());
|
return names.contains(server.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,74 +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.nwdiag.legacy;
|
|
||||||
|
|
||||||
public class Footprint {
|
|
||||||
|
|
||||||
private final int min;
|
|
||||||
private final int max;
|
|
||||||
|
|
||||||
public Footprint(int min, int max) {
|
|
||||||
if (max < min) {
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
assert max >= min;
|
|
||||||
this.min = min;
|
|
||||||
this.max = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "" + min + " -> " + max;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Footprint intersection(Footprint other) {
|
|
||||||
if (this.max < other.min) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (this.min > other.max) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Footprint(Math.max(this.min, other.min), Math.min(this.max, other.max));
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int getMin() {
|
|
||||||
return min;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int getMax() {
|
|
||||||
return max;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,195 +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.nwdiag.legacy;
|
|
||||||
|
|
||||||
import java.awt.geom.Dimension2D;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.TreeSet;
|
|
||||||
|
|
||||||
import net.sourceforge.plantuml.ColorParam;
|
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.VerticalLine;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
|
||||||
import net.sourceforge.plantuml.utils.MathUtils;
|
|
||||||
|
|
||||||
public class LinkedElement {
|
|
||||||
|
|
||||||
private final TextBlock box;
|
|
||||||
private final NetworkLegacy network;
|
|
||||||
private final NServerLegacy square;
|
|
||||||
private final Map<NetworkLegacy, TextBlock> conns;
|
|
||||||
private final List<NetworkLegacy> networks;
|
|
||||||
|
|
||||||
public LinkedElement(NServerLegacy square, TextBlock box, Map<NetworkLegacy, TextBlock> conns, List<NetworkLegacy> networks) {
|
|
||||||
this.networks = networks;
|
|
||||||
this.box = box;
|
|
||||||
this.network = square.getMainNetwork();
|
|
||||||
this.square = square;
|
|
||||||
this.conns = conns;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isLinkedTo(NetworkLegacy some) {
|
|
||||||
return conns.containsKey(some);
|
|
||||||
}
|
|
||||||
|
|
||||||
private final double marginAd = 10;
|
|
||||||
private final double marginBox = 15;
|
|
||||||
|
|
||||||
public MinMax getMinMax(StringBounder stringBounder, double width, double height) {
|
|
||||||
final double xMiddle = width / 2;
|
|
||||||
final double yMiddle = height / 2;
|
|
||||||
final Dimension2D dimBox = box.calculateDimension(stringBounder);
|
|
||||||
|
|
||||||
final double x1 = xMiddle - dimBox.getWidth() / 2;
|
|
||||||
final double y1 = yMiddle - dimBox.getHeight() / 2;
|
|
||||||
final double x2 = xMiddle + dimBox.getWidth() / 2;
|
|
||||||
final double y2 = yMiddle + dimBox.getHeight() / 2;
|
|
||||||
return MinMax.getEmpty(false).addPoint(x1 - 5, y1 - 5).addPoint(x2 + 5, y2 + 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void drawMe(UGraphic ug, double width, double height) {
|
|
||||||
final double xMiddle = width / 2;
|
|
||||||
final double yMiddle = height / 2;
|
|
||||||
drawCenter(ug, box, xMiddle, yMiddle);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void drawLinks(UGraphic ug, double xstart, double width, double height) {
|
|
||||||
|
|
||||||
ug = ug.apply(UTranslate.dx(xstart));
|
|
||||||
|
|
||||||
final double ynet1 = network.getY();
|
|
||||||
final double yMiddle = height / 2;
|
|
||||||
final StringBounder stringBounder = ug.getStringBounder();
|
|
||||||
final Dimension2D dimBox = box.calculateDimension(stringBounder);
|
|
||||||
|
|
||||||
final double alpha = yMiddle - dimBox.getHeight() / 2;
|
|
||||||
|
|
||||||
final HColor color = ColorParam.activityBorder.getDefaultValue();
|
|
||||||
ug = ug.apply(color);
|
|
||||||
|
|
||||||
final double xMiddle = width / 2;
|
|
||||||
|
|
||||||
final TreeSet<Double> skip = new TreeSet<>();
|
|
||||||
|
|
||||||
for (NetworkLegacy n : networks) {
|
|
||||||
if (xstart + xMiddle > n.getXmin() && xstart + xMiddle < n.getXmax())
|
|
||||||
skip.add(n.getY());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (square.hasItsOwnColumn()) {
|
|
||||||
if (square.getMainNetwork().isVisible()) {
|
|
||||||
new VerticalLine(ynet1 + GridTextBlockDecorated.NETWORK_THIN, ynet1 + alpha, skip)
|
|
||||||
.drawU(ug.apply(UTranslate.dx(xMiddle)));
|
|
||||||
} else {
|
|
||||||
new VerticalLine(ynet1, ynet1 + alpha, Collections.<Double>emptySet())
|
|
||||||
.drawU(ug.apply(UTranslate.dx(xMiddle)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
drawCenter(ug, link1(), xMiddle, ynet1 + alpha / 2);
|
|
||||||
|
|
||||||
final double seven = 7.0;
|
|
||||||
double x = xMiddle - (conns.size() - 2) * seven / 2;
|
|
||||||
boolean first = true;
|
|
||||||
for (Entry<NetworkLegacy, TextBlock> ent : conns.entrySet()) {
|
|
||||||
if (ent.getKey() == network) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
final double ynet2 = ent.getKey().getY();
|
|
||||||
new VerticalLine(ynet1 + yMiddle + dimBox.getHeight() / 2, ynet2, skip).drawU(ug.apply(UTranslate.dx(x)));
|
|
||||||
final double xtext;
|
|
||||||
if (first && conns.size() > 2) {
|
|
||||||
xtext = x - ent.getValue().calculateDimension(stringBounder).getWidth() / 2;
|
|
||||||
} else {
|
|
||||||
xtext = x;
|
|
||||||
}
|
|
||||||
drawCenter(ug, ent.getValue(), xtext, ynet2 - alpha / 2);
|
|
||||||
x += seven;
|
|
||||||
first = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private TextBlock link1() {
|
|
||||||
return conns.get(network);
|
|
||||||
}
|
|
||||||
|
|
||||||
private TextBlock link2() {
|
|
||||||
final int i = networks.indexOf(network);
|
|
||||||
if (i == networks.size() - 1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return conns.get(networks.get(i + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void drawCenter(UGraphic ug, TextBlock block, double x, double y) {
|
|
||||||
if (block == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Dimension2D dim = block.calculateDimension(ug.getStringBounder());
|
|
||||||
block.drawU(ug.apply(new UTranslate(x - dim.getWidth() / 2, y - dim.getHeight() / 2)));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dimension2D naturalDimension(StringBounder stringBounder) {
|
|
||||||
final Dimension2D dim1 = link1() == null ? new Dimension2DDouble(0, 0)
|
|
||||||
: link1().calculateDimension(stringBounder);
|
|
||||||
final Dimension2D dimBox = box.calculateDimension(stringBounder);
|
|
||||||
final Dimension2D dim2 = link2() == null ? new Dimension2DDouble(0, 0)
|
|
||||||
: link2().calculateDimension(stringBounder);
|
|
||||||
final double width = MathUtils.max(dim1.getWidth() + 2 * marginAd, dimBox.getWidth() + 2 * marginBox,
|
|
||||||
dim2.getWidth() + 2 * marginAd);
|
|
||||||
final double height = dim1.getHeight() + 2 * marginAd + dimBox.getHeight() + 2 * marginBox + dim2.getHeight()
|
|
||||||
+ 2 * marginAd;
|
|
||||||
return new Dimension2DDouble(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final NetworkLegacy getNetwork() {
|
|
||||||
return network;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final NServerLegacy getElement() {
|
|
||||||
return square;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,98 +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.nwdiag.legacy;
|
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import net.sourceforge.plantuml.ColorParam;
|
|
||||||
import net.sourceforge.plantuml.ISkinSimple;
|
|
||||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
|
||||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
|
||||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.core.NServer;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.core.Network;
|
|
||||||
|
|
||||||
public class NServerLegacy extends NServer {
|
|
||||||
|
|
||||||
private final NetworkLegacy mainNetwork;
|
|
||||||
private final ISkinSimple spriteContainer;
|
|
||||||
private NServerLegacy sameCol;
|
|
||||||
|
|
||||||
public NServerLegacy(String name, Network network, ISkinSimple spriteContainer) {
|
|
||||||
super(name);
|
|
||||||
this.mainNetwork = (NetworkLegacy) network;
|
|
||||||
this.spriteContainer = spriteContainer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LinkedElement asTextBlock(Map<NetworkLegacy, String> conns, List networks) {
|
|
||||||
final Map<NetworkLegacy, TextBlock> conns2 = new LinkedHashMap<NetworkLegacy, TextBlock>();
|
|
||||||
for (Entry<NetworkLegacy, String> ent : conns.entrySet()) {
|
|
||||||
conns2.put(ent.getKey(), toTextBlock(ent.getValue(), spriteContainer));
|
|
||||||
}
|
|
||||||
final SymbolContext symbolContext = new SymbolContext(ColorParam.activityBackground.getDefaultValue(),
|
|
||||||
ColorParam.activityBorder.getDefaultValue()).withShadow(3);
|
|
||||||
final TextBlock desc = toTextBlock(getDescription(), spriteContainer);
|
|
||||||
final TextBlock box = getShape().asSmall(TextBlockUtils.empty(0, 0), desc, TextBlockUtils.empty(0, 0),
|
|
||||||
symbolContext, HorizontalAlignment.CENTER);
|
|
||||||
return new LinkedElement(this, box, conns2, networks);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final NetworkLegacy getMainNetwork() {
|
|
||||||
return mainNetwork;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sameColThan(NServer sameCol) {
|
|
||||||
this.sameCol = (NServerLegacy) sameCol;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final NServerLegacy getSameCol() {
|
|
||||||
return sameCol;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int numCol = -1;
|
|
||||||
|
|
||||||
public void setNumCol(int j) {
|
|
||||||
this.numCol = j;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int getNumCol() {
|
|
||||||
return numCol;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,88 +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.nwdiag.legacy;
|
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import net.sourceforge.plantuml.nwdiag.core.NServer;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.core.Network;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.next.NStage;
|
|
||||||
|
|
||||||
public class NetworkLegacy extends Network {
|
|
||||||
|
|
||||||
private final Map<NServerLegacy, String> localServers = new LinkedHashMap<NServerLegacy, String>();
|
|
||||||
private final int stage;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return super.toString() + "(" + stage + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
public NetworkLegacy(NStage nstage, String name, int stage) {
|
|
||||||
super(null, nstage, name);
|
|
||||||
this.stage = stage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAdress(NServer server) {
|
|
||||||
return localServers.get(server);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addServer(NServerLegacy server, Map<String, String> props) {
|
|
||||||
String address = props.get("address");
|
|
||||||
if (address == null) {
|
|
||||||
address = "";
|
|
||||||
}
|
|
||||||
if (address.length() == 0 && localServers.containsKey(server)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
localServers.put(server, address);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean constainsLocally(String name) {
|
|
||||||
for (NServerLegacy server : localServers.keySet()) {
|
|
||||||
if (server.getName().equals(name)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int getStage() {
|
|
||||||
return stage;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,91 +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.nwdiag.legacy;
|
|
||||||
|
|
||||||
public class NwArray {
|
|
||||||
|
|
||||||
private final LinkedElement data[][];
|
|
||||||
|
|
||||||
public NwArray(int lines, int cols) {
|
|
||||||
this.data = new LinkedElement[lines][cols];
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getNbLines() {
|
|
||||||
return data.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getNbCols() {
|
|
||||||
return data[0].length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LinkedElement get(int i, int j) {
|
|
||||||
return data[i][j];
|
|
||||||
}
|
|
||||||
|
|
||||||
public LinkedElement[] getLine(int i) {
|
|
||||||
return data[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
public void set(int i, int j, LinkedElement value) {
|
|
||||||
data[i][j] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void swapCols(int col1, int col2) {
|
|
||||||
if (col1 == col2) {
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
for (int i = 0; i < getNbLines(); i++) {
|
|
||||||
final LinkedElement tmp = data[i][col1];
|
|
||||||
data[i][col1] = data[i][col2];
|
|
||||||
data[i][col2] = tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public Footprint getFootprint(NwGroupLegacy group) {
|
|
||||||
int min = Integer.MAX_VALUE;
|
|
||||||
int max = Integer.MIN_VALUE;
|
|
||||||
for (int i = 0; i < getNbLines(); i++) {
|
|
||||||
for (int j = 0; j < getNbCols(); j++) {
|
|
||||||
if (data[i][j] != null && group.matches(data[i][j])) {
|
|
||||||
min = Math.min(min, j);
|
|
||||||
max = Math.max(max, j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new Footprint(min, max);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,69 +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.nwdiag.legacy;
|
|
||||||
|
|
||||||
import net.sourceforge.plantuml.nwdiag.core.Network;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.core.NwGroup;
|
|
||||||
|
|
||||||
public class NwGroupLegacy extends NwGroup {
|
|
||||||
|
|
||||||
private final NetworkLegacy network;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return getName() + " " + network + " " + names();
|
|
||||||
}
|
|
||||||
|
|
||||||
public NwGroupLegacy(String name, Network network) {
|
|
||||||
super(name);
|
|
||||||
this.network = (NetworkLegacy) network;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int size() {
|
|
||||||
return names().size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean matches(LinkedElement tested) {
|
|
||||||
if (network != null && network != tested.getNetwork()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return names().contains(tested.getElement().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public final NetworkLegacy getNetwork() {
|
|
||||||
return network;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -32,12 +32,19 @@
|
|||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.nwdiag.legacy;
|
package net.sourceforge.plantuml.nwdiag.next;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.ISkinParam;
|
import net.sourceforge.plantuml.ISkinParam;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
|
import net.sourceforge.plantuml.nwdiag.core.Network;
|
||||||
|
import net.sourceforge.plantuml.nwdiag.core.NwGroup;
|
||||||
|
import net.sourceforge.plantuml.style.PName;
|
||||||
|
import net.sourceforge.plantuml.style.SName;
|
||||||
|
import net.sourceforge.plantuml.style.Style;
|
||||||
|
import net.sourceforge.plantuml.style.StyleBuilder;
|
||||||
|
import net.sourceforge.plantuml.style.StyleSignature;
|
||||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
import net.sourceforge.plantuml.ugraphic.MinMax;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||||
@ -47,11 +54,10 @@ public class GridTextBlockDecorated extends GridTextBlockSimple {
|
|||||||
|
|
||||||
public static final int NETWORK_THIN = 5;
|
public static final int NETWORK_THIN = 5;
|
||||||
|
|
||||||
private final List<NwGroupLegacy> groups;
|
private final List<NwGroup> groups;
|
||||||
private final List<NetworkLegacy> networks;
|
private final List<Network> networks;
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
public GridTextBlockDecorated(int lines, int cols, List<NwGroup> groups, List<Network> networks,
|
||||||
public GridTextBlockDecorated(int lines, int cols, List groups, List networks,
|
|
||||||
ISkinParam skinparam) {
|
ISkinParam skinparam) {
|
||||||
super(lines, cols, skinparam);
|
super(lines, cols, skinparam);
|
||||||
this.groups = groups;
|
this.groups = groups;
|
||||||
@ -60,8 +66,8 @@ public class GridTextBlockDecorated extends GridTextBlockSimple {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGrid(UGraphic ug) {
|
protected void drawGrid(UGraphic ug) {
|
||||||
for (NwGroupLegacy group : groups) {
|
for (NwGroup group : groups) {
|
||||||
drawGroups(ug, group, skinparam);
|
drawGroups(ug, group, getSkinParam());
|
||||||
}
|
}
|
||||||
drawNetworkTube(ug);
|
drawNetworkTube(ug);
|
||||||
drawLinks(ug);
|
drawLinks(ug);
|
||||||
@ -83,7 +89,7 @@ public class GridTextBlockDecorated extends GridTextBlockSimple {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawGroups(UGraphic ug, NwGroupLegacy group, ISkinParam skinParam) {
|
private void drawGroups(UGraphic ug, NwGroup group, ISkinParam skinParam) {
|
||||||
final StringBounder stringBounder = ug.getStringBounder();
|
final StringBounder stringBounder = ug.getStringBounder();
|
||||||
|
|
||||||
MinMax size = null;
|
MinMax size = null;
|
||||||
@ -94,7 +100,7 @@ public class GridTextBlockDecorated extends GridTextBlockSimple {
|
|||||||
for (int j = 0; j < data.getNbCols(); j++) {
|
for (int j = 0; j < data.getNbCols(); j++) {
|
||||||
final double colWidth = colWidth(stringBounder, j);
|
final double colWidth = colWidth(stringBounder, j);
|
||||||
final LinkedElement element = data.get(i, j);
|
final LinkedElement element = data.get(i, j);
|
||||||
if (element != null && group.matches(element)) {
|
if (element != null && group.contains(element.getServer())) {
|
||||||
final MinMax minMax = element.getMinMax(stringBounder, colWidth, lineHeight)
|
final MinMax minMax = element.getMinMax(stringBounder, colWidth, lineHeight)
|
||||||
.translate(new UTranslate(x, y));
|
.translate(new UTranslate(x, y));
|
||||||
size = size == null ? minMax : size.addMinMax(minMax);
|
size = size == null ? minMax : size.addMinMax(minMax);
|
||||||
@ -109,7 +115,7 @@ public class GridTextBlockDecorated extends GridTextBlockSimple {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isThereALink(int j, NetworkLegacy network) {
|
private boolean isThereALink(int j, Network network) {
|
||||||
for (int i = 0; i < data.getNbLines(); i++) {
|
for (int i = 0; i < data.getNbLines(); i++) {
|
||||||
final LinkedElement element = data.get(i, j);
|
final LinkedElement element = data.get(i, j);
|
||||||
if (element != null && element.isLinkedTo(network)) {
|
if (element != null && element.isLinkedTo(network)) {
|
||||||
@ -119,16 +125,27 @@ public class GridTextBlockDecorated extends GridTextBlockSimple {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private StyleSignature getStyleDefinition() {
|
||||||
|
return StyleSignature.of(SName.root, SName.element, SName.nwdiagDiagram, SName.node);
|
||||||
|
}
|
||||||
|
|
||||||
private void drawNetworkTube(final UGraphic ug) {
|
private void drawNetworkTube(final UGraphic ug) {
|
||||||
|
|
||||||
final StringBounder stringBounder = ug.getStringBounder();
|
final StringBounder stringBounder = ug.getStringBounder();
|
||||||
double y = 0;
|
double y = 0;
|
||||||
for (int i = 0; i < data.getNbLines(); i++) {
|
for (int i = 0; i < data.getNbLines(); i++) {
|
||||||
final NetworkLegacy network = getNetwork(i);
|
final Network network = getNetwork(i);
|
||||||
computeMixMax(data.getLine(i), stringBounder, network);
|
computeMixMax(data.getLine(i), stringBounder, network);
|
||||||
|
|
||||||
final URectangle rect = new URectangle(network.getXmax() - network.getXmin(), NETWORK_THIN);
|
final URectangle rect = new URectangle(network.getXmax() - network.getXmin(), NETWORK_THIN);
|
||||||
rect.setDeltaShadow(1.0);
|
double deltaShadow = 1.0;
|
||||||
|
final StyleBuilder styleBuilder = getSkinParam().getCurrentStyleBuilder();
|
||||||
|
if (styleBuilder != null) {
|
||||||
|
final Style style = getStyleDefinition().getMergedStyle(styleBuilder);
|
||||||
|
deltaShadow = style.value(PName.Shadowing).asDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
rect.setDeltaShadow(deltaShadow);
|
||||||
UGraphic ug2 = ug.apply(new UTranslate(network.getXmin(), y));
|
UGraphic ug2 = ug.apply(new UTranslate(network.getXmin(), y));
|
||||||
if (network != null && network.getColor() != null) {
|
if (network != null && network.getColor() != null) {
|
||||||
ug2 = ug2.apply(network.getColor().bg());
|
ug2 = ug2.apply(network.getColor().bg());
|
||||||
@ -143,7 +160,7 @@ public class GridTextBlockDecorated extends GridTextBlockSimple {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void computeMixMax(LinkedElement line[], StringBounder stringBounder, NetworkLegacy network) {
|
private void computeMixMax(LinkedElement line[], StringBounder stringBounder, Network network) {
|
||||||
double x = 0;
|
double x = 0;
|
||||||
double xmin = network.isFullWidth() ? 0 : -1;
|
double xmin = network.isFullWidth() ? 0 : -1;
|
||||||
double xmax = 0;
|
double xmax = 0;
|
||||||
@ -161,30 +178,8 @@ public class GridTextBlockDecorated extends GridTextBlockSimple {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private NetworkLegacy getNetwork(int i) {
|
private Network getNetwork(int i) {
|
||||||
return networks.get(i);
|
return networks.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkGroups() {
|
|
||||||
for (int i = 0; i < groups.size(); i++) {
|
|
||||||
for (int j = i + 1; j < groups.size(); j++) {
|
|
||||||
final NwGroupLegacy group1 = groups.get(i);
|
|
||||||
final NwGroupLegacy group2 = groups.get(j);
|
|
||||||
if (group1.size() == 0 || group2.size() == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (group1.getNetwork() != group2.getNetwork()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
final Footprint footprint1 = getFootprint(group1);
|
|
||||||
final Footprint footprint2 = getFootprint(group2);
|
|
||||||
final Footprint inter = footprint1.intersection(footprint2);
|
|
||||||
if (inter != null) {
|
|
||||||
data.swapCols(inter.getMin(), inter.getMax());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,169 +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.nwdiag.next;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.sourceforge.plantuml.ISkinParam;
|
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.core.Network;
|
|
||||||
import net.sourceforge.plantuml.nwdiag.core.NwGroup;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
|
||||||
|
|
||||||
public class GridTextBlockDecoratedNext extends GridTextBlockSimpleNext {
|
|
||||||
|
|
||||||
public static final int NETWORK_THIN = 5;
|
|
||||||
|
|
||||||
private final List<NwGroup> groups;
|
|
||||||
private final List<Network> networks;
|
|
||||||
|
|
||||||
public GridTextBlockDecoratedNext(int lines, int cols, List<NwGroup> groups, List<Network> networks,
|
|
||||||
ISkinParam skinparam) {
|
|
||||||
super(lines, cols, skinparam);
|
|
||||||
this.groups = groups;
|
|
||||||
this.networks = networks;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void drawGrid(UGraphic ug) {
|
|
||||||
for (NwGroup group : groups) {
|
|
||||||
drawGroups(ug, group, skinparam);
|
|
||||||
}
|
|
||||||
drawNetworkTube(ug);
|
|
||||||
drawLinks(ug);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void drawLinks(UGraphic ug) {
|
|
||||||
final StringBounder stringBounder = ug.getStringBounder();
|
|
||||||
for (int i = 0; i < data.getNbLines(); i++) {
|
|
||||||
final double lineHeight = lineHeight(stringBounder, i);
|
|
||||||
double x = 0;
|
|
||||||
for (int j = 0; j < data.getNbCols(); j++) {
|
|
||||||
final double colWidth = colWidth(stringBounder, j);
|
|
||||||
if (data.get(i, j) != null) {
|
|
||||||
data.get(i, j).drawLinks(ug, x, colWidth, lineHeight);
|
|
||||||
}
|
|
||||||
x += colWidth;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void drawGroups(UGraphic ug, NwGroup group, ISkinParam skinParam) {
|
|
||||||
final StringBounder stringBounder = ug.getStringBounder();
|
|
||||||
|
|
||||||
MinMax size = null;
|
|
||||||
double y = 0;
|
|
||||||
for (int i = 0; i < data.getNbLines(); i++) {
|
|
||||||
final double lineHeight = lineHeight(stringBounder, i);
|
|
||||||
double x = 0;
|
|
||||||
for (int j = 0; j < data.getNbCols(); j++) {
|
|
||||||
final double colWidth = colWidth(stringBounder, j);
|
|
||||||
final LinkedElementNext element = data.get(i, j);
|
|
||||||
if (element != null && group.matches(element)) {
|
|
||||||
final MinMax minMax = element.getMinMax(stringBounder, colWidth, lineHeight)
|
|
||||||
.translate(new UTranslate(x, y));
|
|
||||||
size = size == null ? minMax : size.addMinMax(minMax);
|
|
||||||
}
|
|
||||||
x += colWidth;
|
|
||||||
}
|
|
||||||
y += lineHeight;
|
|
||||||
}
|
|
||||||
if (size != null) {
|
|
||||||
group.drawGroup(ug, size, skinParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isThereALink(int j, Network network) {
|
|
||||||
for (int i = 0; i < data.getNbLines(); i++) {
|
|
||||||
final LinkedElementNext element = data.get(i, j);
|
|
||||||
if (element != null && element.isLinkedTo(network)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void drawNetworkTube(final UGraphic ug) {
|
|
||||||
|
|
||||||
final StringBounder stringBounder = ug.getStringBounder();
|
|
||||||
double y = 0;
|
|
||||||
for (int i = 0; i < data.getNbLines(); i++) {
|
|
||||||
final Network network = getNetwork(i);
|
|
||||||
computeMixMax(data.getLine(i), stringBounder, network);
|
|
||||||
|
|
||||||
final URectangle rect = new URectangle(network.getXmax() - network.getXmin(), NETWORK_THIN);
|
|
||||||
rect.setDeltaShadow(1.0);
|
|
||||||
UGraphic ug2 = ug.apply(new UTranslate(network.getXmin(), y));
|
|
||||||
if (network != null && network.getColor() != null) {
|
|
||||||
ug2 = ug2.apply(network.getColor().bg());
|
|
||||||
}
|
|
||||||
if (network != null) {
|
|
||||||
network.setY(y);
|
|
||||||
}
|
|
||||||
if (network.isVisible()) {
|
|
||||||
ug2.draw(rect);
|
|
||||||
}
|
|
||||||
y += lineHeight(stringBounder, i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void computeMixMax(LinkedElementNext line[], StringBounder stringBounder, Network network) {
|
|
||||||
double x = 0;
|
|
||||||
double xmin = network.isFullWidth() ? 0 : -1;
|
|
||||||
double xmax = 0;
|
|
||||||
for (int j = 0; j < line.length; j++) {
|
|
||||||
final boolean hline = isThereALink(j, network);
|
|
||||||
if (hline && xmin < 0) {
|
|
||||||
xmin = x;
|
|
||||||
}
|
|
||||||
x += colWidth(stringBounder, j);
|
|
||||||
if (hline || network.isFullWidth()) {
|
|
||||||
xmax = x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
network.setMinMax(xmin, xmax);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private Network getNetwork(int i) {
|
|
||||||
return networks.get(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -32,7 +32,7 @@
|
|||||||
* Original Author: Arnaud Roques
|
* Original Author: Arnaud Roques
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.nwdiag.legacy;
|
package net.sourceforge.plantuml.nwdiag.next;
|
||||||
|
|
||||||
import java.awt.geom.Dimension2D;
|
import java.awt.geom.Dimension2D;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
@ -49,10 +49,10 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
|
|||||||
public class GridTextBlockSimple implements TextBlock {
|
public class GridTextBlockSimple implements TextBlock {
|
||||||
|
|
||||||
protected final NwArray data;
|
protected final NwArray data;
|
||||||
protected final ISkinParam skinparam;
|
private final ISkinParam skinParam;
|
||||||
|
|
||||||
public GridTextBlockSimple(int lines, int cols, ISkinParam skinparam) {
|
public GridTextBlockSimple(int lines, int cols, ISkinParam skinParam) {
|
||||||
this.skinparam = skinparam;
|
this.skinParam = skinParam;
|
||||||
this.data = new NwArray(lines, cols);
|
this.data = new NwArray(lines, cols);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,9 +123,11 @@ public class GridTextBlockSimple implements TextBlock {
|
|||||||
public void add(int i, int j, LinkedElement value) {
|
public void add(int i, int j, LinkedElement value) {
|
||||||
data.set(i, j, value);
|
data.set(i, j, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Footprint getFootprint(NwGroupLegacy group) {
|
protected final ISkinParam getSkinParam() {
|
||||||
return data.getFootprint(group);
|
return skinParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,127 +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.nwdiag.next;
|
|
||||||
|
|
||||||
import java.awt.geom.Dimension2D;
|
|
||||||
import java.awt.geom.Rectangle2D;
|
|
||||||
|
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
|
||||||
import net.sourceforge.plantuml.ISkinParam;
|
|
||||||
import net.sourceforge.plantuml.graphic.InnerStrategy;
|
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
|
||||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
|
||||||
|
|
||||||
public class GridTextBlockSimpleNext implements TextBlock {
|
|
||||||
|
|
||||||
protected final NwArrayNext data;
|
|
||||||
protected final ISkinParam skinparam;
|
|
||||||
|
|
||||||
public GridTextBlockSimpleNext(int lines, int cols, ISkinParam skinparam) {
|
|
||||||
this.skinparam = skinparam;
|
|
||||||
this.data = new NwArrayNext(lines, cols);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void drawGrid(UGraphic ug) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void drawU(UGraphic ug) {
|
|
||||||
drawGrid(ug);
|
|
||||||
final StringBounder stringBounder = ug.getStringBounder();
|
|
||||||
double y = 0;
|
|
||||||
for (int i = 0; i < data.getNbLines(); i++) {
|
|
||||||
final double lineHeight = lineHeight(stringBounder, i);
|
|
||||||
double x = 0;
|
|
||||||
for (int j = 0; j < data.getNbCols(); j++) {
|
|
||||||
final double colWidth = colWidth(stringBounder, j);
|
|
||||||
if (data.get(i, j) != null) {
|
|
||||||
data.get(i, j).drawMe(ug.apply(new UTranslate(x, y)), colWidth, lineHeight);
|
|
||||||
}
|
|
||||||
x += colWidth;
|
|
||||||
}
|
|
||||||
y += lineHeight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected double colWidth(StringBounder stringBounder, final int j) {
|
|
||||||
double width = 0;
|
|
||||||
for (int i = 0; i < data.getNbLines(); i++) {
|
|
||||||
if (data.get(i, j) != null) {
|
|
||||||
width = Math.max(width, data.get(i, j).naturalDimension(stringBounder).getWidth());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double lineHeight(StringBounder stringBounder, final int i) {
|
|
||||||
double height = 50;
|
|
||||||
for (int j = 0; j < data.getNbCols(); j++) {
|
|
||||||
if (data.get(i, j) != null) {
|
|
||||||
height = Math.max(height, data.get(i, j).naturalDimension(stringBounder).getHeight());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
|
||||||
if (data.getNbLines() == 0) {
|
|
||||||
return new Dimension2DDouble(0, 0);
|
|
||||||
}
|
|
||||||
double height = 0;
|
|
||||||
for (int i = 0; i < data.getNbLines(); i++) {
|
|
||||||
height += lineHeight(stringBounder, i);
|
|
||||||
}
|
|
||||||
double width = 0;
|
|
||||||
for (int j = 0; j < data.getNbCols(); j++) {
|
|
||||||
width += colWidth(stringBounder, j);
|
|
||||||
}
|
|
||||||
return new Dimension2DDouble(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) {
|
|
||||||
throw new UnsupportedOperationException("member=" + member + " " + getClass().toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public MinMax getMinMax(StringBounder stringBounder) {
|
|
||||||
throw new UnsupportedOperationException(getClass().toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(int i, int j, LinkedElementNext value) {
|
|
||||||
data.set(i, j, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -54,7 +54,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
|
|||||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||||
import net.sourceforge.plantuml.utils.MathUtils;
|
import net.sourceforge.plantuml.utils.MathUtils;
|
||||||
|
|
||||||
public class LinkedElementNext {
|
public class LinkedElement {
|
||||||
|
|
||||||
public static final int MAGIC = 15;
|
public static final int MAGIC = 15;
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ public class LinkedElementNext {
|
|||||||
private final List<Network> networks;
|
private final List<Network> networks;
|
||||||
private final double topMargin;
|
private final double topMargin;
|
||||||
|
|
||||||
public LinkedElementNext(double topMargin, NServer server, TextBlock box, Map<Network, TextBlock> conns,
|
public LinkedElement(double topMargin, NServer server, TextBlock box, Map<Network, TextBlock> conns,
|
||||||
List<Network> networks) {
|
List<Network> networks) {
|
||||||
this.topMargin = topMargin;
|
this.topMargin = topMargin;
|
||||||
this.networks = networks;
|
this.networks = networks;
|
||||||
@ -132,9 +132,9 @@ public class LinkedElementNext {
|
|||||||
skip.add(n.getY());
|
skip.add(n.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server.hasItsOwnColumn()) {
|
if (server.printFirstLink()) {
|
||||||
if (network.isVisible()) {
|
if (network.isVisible()) {
|
||||||
new VerticalLine(ynet1 + GridTextBlockDecoratedNext.NETWORK_THIN, ynet1 + alpha, skip)
|
new VerticalLine(ynet1 + GridTextBlockDecorated.NETWORK_THIN, ynet1 + alpha, skip)
|
||||||
.drawU(ug.apply(UTranslate.dx(xLinkPos + network.magicDelta())));
|
.drawU(ug.apply(UTranslate.dx(xLinkPos + network.magicDelta())));
|
||||||
} else {
|
} else {
|
||||||
new VerticalLine(ynet1, ynet1 + alpha, Collections.<Double>emptySet())
|
new VerticalLine(ynet1, ynet1 + alpha, Collections.<Double>emptySet())
|
||||||
@ -205,7 +205,7 @@ public class LinkedElementNext {
|
|||||||
return network;
|
return network;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final NServer getElement() {
|
public final NServer getServer() {
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +104,7 @@ public class NPlayField {
|
|||||||
public void fixGroups(List<NwGroup> groups, Collection<NServer> servers) {
|
public void fixGroups(List<NwGroup> groups, Collection<NServer> servers) {
|
||||||
for (NwGroup group : groups) {
|
for (NwGroup group : groups) {
|
||||||
for (NServer server : servers) {
|
for (NServer server : servers) {
|
||||||
if (group.containsNext(server)) {
|
if (group.contains(server)) {
|
||||||
fixServerInGroup(server, group);
|
fixServerInGroup(server, group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,12 +34,12 @@
|
|||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.nwdiag.next;
|
package net.sourceforge.plantuml.nwdiag.next;
|
||||||
|
|
||||||
public class NwArrayNext {
|
public class NwArray {
|
||||||
|
|
||||||
private final LinkedElementNext data[][];
|
private final LinkedElement data[][];
|
||||||
|
|
||||||
public NwArrayNext(int lines, int cols) {
|
public NwArray(int lines, int cols) {
|
||||||
this.data = new LinkedElementNext[lines][cols];
|
this.data = new LinkedElement[lines][cols];
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNbLines() {
|
public int getNbLines() {
|
||||||
@ -50,15 +50,15 @@ public class NwArrayNext {
|
|||||||
return data[0].length;
|
return data[0].length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinkedElementNext get(int i, int j) {
|
public LinkedElement get(int i, int j) {
|
||||||
return data[i][j];
|
return data[i][j];
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinkedElementNext[] getLine(int i) {
|
public LinkedElement[] getLine(int i) {
|
||||||
return data[i];
|
return data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(int i, int j, LinkedElementNext value) {
|
public void set(int i, int j, LinkedElement value) {
|
||||||
data[i][j] = value;
|
data[i][j] = value;
|
||||||
}
|
}
|
||||||
|
|
@ -48,7 +48,7 @@ import net.sourceforge.plantuml.project.time.Month;
|
|||||||
public class ComplementDate implements Something {
|
public class ComplementDate implements Something {
|
||||||
|
|
||||||
public IRegex toRegex(String suffix) {
|
public IRegex toRegex(String suffix) {
|
||||||
return new RegexOr(toRegexA(suffix), toRegexB(suffix), toRegexC(suffix), toRegexD(suffix));
|
return new RegexOr(toRegexA(suffix), toRegexB(suffix), toRegexC(suffix), toRegexD(suffix), toRegexE(suffix));
|
||||||
}
|
}
|
||||||
|
|
||||||
private IRegex toRegexA(String suffix) {
|
private IRegex toRegexA(String suffix) {
|
||||||
@ -90,6 +90,13 @@ public class ComplementDate implements Something {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IRegex toRegexE(String suffix) {
|
||||||
|
return new RegexConcat( //
|
||||||
|
new RegexLeaf("[dD]\\+"), //
|
||||||
|
new RegexLeaf("ECOUNT" + suffix, "([\\d]+)") //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public Failable<Day> getMe(GanttDiagram system, RegexResult arg, String suffix) {
|
public Failable<Day> getMe(GanttDiagram system, RegexResult arg, String suffix) {
|
||||||
if (arg.get("ADAY" + suffix, 0) != null) {
|
if (arg.get("ADAY" + suffix, 0) != null) {
|
||||||
return Failable.ok(resultA(arg, suffix));
|
return Failable.ok(resultA(arg, suffix));
|
||||||
@ -103,14 +110,12 @@ public class ComplementDate implements Something {
|
|||||||
if (arg.get("DCOUNT" + suffix, 0) != null) {
|
if (arg.get("DCOUNT" + suffix, 0) != null) {
|
||||||
return Failable.ok(resultD(system, arg, suffix));
|
return Failable.ok(resultD(system, arg, suffix));
|
||||||
}
|
}
|
||||||
|
if (arg.get("ECOUNT" + suffix, 0) != null) {
|
||||||
|
return Failable.ok(resultE(system, arg, suffix));
|
||||||
|
}
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Day resultD(GanttDiagram system, RegexResult arg, String suffix) {
|
|
||||||
final int day = Integer.parseInt(arg.get("DCOUNT" + suffix, 0));
|
|
||||||
return system.getStartingDate().addDays(day);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Day resultA(RegexResult arg, String suffix) {
|
private Day resultA(RegexResult arg, String suffix) {
|
||||||
final int day = Integer.parseInt(arg.get("ADAY" + suffix, 0));
|
final int day = Integer.parseInt(arg.get("ADAY" + suffix, 0));
|
||||||
final String month = arg.get("AMONTH" + suffix, 0);
|
final String month = arg.get("AMONTH" + suffix, 0);
|
||||||
@ -131,4 +136,15 @@ public class ComplementDate implements Something {
|
|||||||
final int year = Integer.parseInt(arg.get("CYEAR" + suffix, 0));
|
final int year = Integer.parseInt(arg.get("CYEAR" + suffix, 0));
|
||||||
return Day.create(year, month, day);
|
return Day.create(year, month, day);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Day resultD(GanttDiagram system, RegexResult arg, String suffix) {
|
||||||
|
final int day = Integer.parseInt(arg.get("DCOUNT" + suffix, 0));
|
||||||
|
return system.getStartingDate().addDays(day);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Day resultE(GanttDiagram system, RegexResult arg, String suffix) {
|
||||||
|
final int day = Integer.parseInt(arg.get("ECOUNT" + suffix, 0));
|
||||||
|
return system.getStartingDate().addDays(day);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ package net.sourceforge.plantuml.project.lang;
|
|||||||
import net.sourceforge.plantuml.command.regex.IRegex;
|
import net.sourceforge.plantuml.command.regex.IRegex;
|
||||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||||
|
import net.sourceforge.plantuml.command.regex.RegexOr;
|
||||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||||
import net.sourceforge.plantuml.project.DaysAsDates;
|
import net.sourceforge.plantuml.project.DaysAsDates;
|
||||||
import net.sourceforge.plantuml.project.Failable;
|
import net.sourceforge.plantuml.project.Failable;
|
||||||
@ -47,37 +48,72 @@ import net.sourceforge.plantuml.project.time.Day;
|
|||||||
public class ComplementDates implements Something {
|
public class ComplementDates implements Something {
|
||||||
|
|
||||||
public IRegex toRegex(String suffix) {
|
public IRegex toRegex(String suffix) {
|
||||||
|
return new RegexOr(toRegexB(suffix), toRegexE(suffix));
|
||||||
|
}
|
||||||
|
|
||||||
|
private IRegex toRegexB(String suffix) {
|
||||||
return new RegexConcat( //
|
return new RegexConcat( //
|
||||||
new RegexLeaf("YEAR1" + suffix, "([\\d]{4})"), //
|
new RegexLeaf("BYEAR1" + suffix, "([\\d]{4})"), //
|
||||||
new RegexLeaf("\\D"), //
|
new RegexLeaf("\\D"), //
|
||||||
new RegexLeaf("MONTH1" + suffix, "([\\d]{1,2})"), //
|
new RegexLeaf("BMONTH1" + suffix, "([\\d]{1,2})"), //
|
||||||
new RegexLeaf("\\D"), //
|
new RegexLeaf("\\D"), //
|
||||||
new RegexLeaf("DAY1" + suffix, "([\\d]{1,2})"), //
|
new RegexLeaf("BDAY1" + suffix, "([\\d]{1,2})"), //
|
||||||
RegexLeaf.spaceOneOrMore(), //
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
new RegexLeaf("to"), //
|
new RegexLeaf("to"), //
|
||||||
RegexLeaf.spaceOneOrMore(), //
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
new RegexLeaf("YEAR2" + suffix, "([\\d]{4})"), //
|
new RegexLeaf("BYEAR2" + suffix, "([\\d]{4})"), //
|
||||||
new RegexLeaf("\\D"), //
|
new RegexLeaf("\\D"), //
|
||||||
new RegexLeaf("MONTH2" + suffix, "([\\d]{1,2})"), //
|
new RegexLeaf("BMONTH2" + suffix, "([\\d]{1,2})"), //
|
||||||
new RegexLeaf("\\D"), //
|
new RegexLeaf("\\D"), //
|
||||||
new RegexLeaf("DAY2" + suffix, "([\\d]{1,2})") //
|
new RegexLeaf("BDAY2" + suffix, "([\\d]{1,2})") //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IRegex toRegexE(String suffix) {
|
||||||
|
return new RegexConcat( //
|
||||||
|
new RegexLeaf("[dD]\\+"), //
|
||||||
|
new RegexLeaf("ECOUNT1" + suffix, "([\\d]+)"), //
|
||||||
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
|
new RegexLeaf("to"), //
|
||||||
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
|
new RegexLeaf("[dD]\\+"), //
|
||||||
|
new RegexLeaf("ECOUNT2" + suffix, "([\\d]+)") //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Failable<DaysAsDates> getMe(GanttDiagram project, RegexResult arg, String suffix) {
|
public Failable<DaysAsDates> getMe(GanttDiagram project, RegexResult arg, String suffix) {
|
||||||
|
if (arg.get("BDAY1" + suffix, 0) != null) {
|
||||||
|
return Failable.ok(resultB(arg, suffix));
|
||||||
|
}
|
||||||
|
if (arg.get("ECOUNT1" + suffix, 0) != null) {
|
||||||
|
return Failable.ok(resultE(project, arg, suffix));
|
||||||
|
}
|
||||||
|
throw new IllegalStateException();
|
||||||
|
|
||||||
final int day1 = Integer.parseInt(arg.get("DAY1" + suffix, 0));
|
}
|
||||||
final int month1 = Integer.parseInt(arg.get("MONTH1" + suffix, 0));
|
|
||||||
final int year1 = Integer.parseInt(arg.get("YEAR1" + suffix, 0));
|
private DaysAsDates resultB(RegexResult arg, String suffix) {
|
||||||
|
final int day1 = Integer.parseInt(arg.get("BDAY1" + suffix, 0));
|
||||||
|
final int month1 = Integer.parseInt(arg.get("BMONTH1" + suffix, 0));
|
||||||
|
final int year1 = Integer.parseInt(arg.get("BYEAR1" + suffix, 0));
|
||||||
final Day date1 = Day.create(year1, month1, day1);
|
final Day date1 = Day.create(year1, month1, day1);
|
||||||
|
|
||||||
final int day2 = Integer.parseInt(arg.get("DAY2" + suffix, 0));
|
final int day2 = Integer.parseInt(arg.get("BDAY2" + suffix, 0));
|
||||||
final int month2 = Integer.parseInt(arg.get("MONTH2" + suffix, 0));
|
final int month2 = Integer.parseInt(arg.get("BMONTH2" + suffix, 0));
|
||||||
final int year2 = Integer.parseInt(arg.get("YEAR2" + suffix, 0));
|
final int year2 = Integer.parseInt(arg.get("BYEAR2" + suffix, 0));
|
||||||
final Day date2 = Day.create(year2, month2, day2);
|
final Day date2 = Day.create(year2, month2, day2);
|
||||||
|
|
||||||
return Failable.ok(new DaysAsDates(date1, date2));
|
return new DaysAsDates(date1, date2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DaysAsDates resultE(GanttDiagram project, RegexResult arg, String suffix) {
|
||||||
|
final int day1 = Integer.parseInt(arg.get("ECOUNT1" + suffix, 0));
|
||||||
|
final Day date1 = project.getStartingDate().addDays(day1);
|
||||||
|
|
||||||
|
final int day2 = Integer.parseInt(arg.get("ECOUNT2" + suffix, 0));
|
||||||
|
final Day date2 = project.getStartingDate().addDays(day2);
|
||||||
|
|
||||||
|
return new DaysAsDates(date1, date2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ import net.sourceforge.plantuml.command.CommandExecutionResult;
|
|||||||
import net.sourceforge.plantuml.command.regex.IRegex;
|
import net.sourceforge.plantuml.command.regex.IRegex;
|
||||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||||
|
import net.sourceforge.plantuml.command.regex.RegexOr;
|
||||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||||
import net.sourceforge.plantuml.project.Failable;
|
import net.sourceforge.plantuml.project.Failable;
|
||||||
import net.sourceforge.plantuml.project.GanttDiagram;
|
import net.sourceforge.plantuml.project.GanttDiagram;
|
||||||
@ -51,10 +52,26 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
|
|||||||
public class SubjectDayAsDate implements Subject {
|
public class SubjectDayAsDate implements Subject {
|
||||||
|
|
||||||
public Failable<Day> getMe(GanttDiagram project, RegexResult arg) {
|
public Failable<Day> getMe(GanttDiagram project, RegexResult arg) {
|
||||||
final int day = Integer.parseInt(arg.get("DAY", 0));
|
if (arg.get("BDAY", 0) != null) {
|
||||||
final int month = Integer.parseInt(arg.get("MONTH", 0));
|
return Failable.ok(resultB(arg));
|
||||||
final int year = Integer.parseInt(arg.get("YEAR", 0));
|
}
|
||||||
return Failable.ok(Day.create(year, month, day));
|
if (arg.get("ECOUNT", 0) != null) {
|
||||||
|
return Failable.ok(resultE(project, arg));
|
||||||
|
}
|
||||||
|
throw new IllegalStateException();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Day resultB(RegexResult arg) {
|
||||||
|
final int day = Integer.parseInt(arg.get("BDAY", 0));
|
||||||
|
final int month = Integer.parseInt(arg.get("BMONTH", 0));
|
||||||
|
final int year = Integer.parseInt(arg.get("BYEAR", 0));
|
||||||
|
return Day.create(year, month, day);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Day resultE(GanttDiagram system, RegexResult arg) {
|
||||||
|
final int day = Integer.parseInt(arg.get("ECOUNT", 0));
|
||||||
|
return system.getStartingDate().addDays(day);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<? extends SentenceSimple> getSentences() {
|
public Collection<? extends SentenceSimple> getSentences() {
|
||||||
@ -102,12 +119,23 @@ public class SubjectDayAsDate implements Subject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IRegex toRegex() {
|
public IRegex toRegex() {
|
||||||
|
return new RegexOr(toRegexB(), toRegexE());
|
||||||
|
}
|
||||||
|
|
||||||
|
private IRegex toRegexB() {
|
||||||
return new RegexConcat( //
|
return new RegexConcat( //
|
||||||
new RegexLeaf("YEAR", "([\\d]{4})"), //
|
new RegexLeaf("BYEAR", "([\\d]{4})"), //
|
||||||
new RegexLeaf("\\D"), //
|
new RegexLeaf("\\D"), //
|
||||||
new RegexLeaf("MONTH", "([\\d]{1,2})"), //
|
new RegexLeaf("BMONTH", "([\\d]{1,2})"), //
|
||||||
new RegexLeaf("\\D"), //
|
new RegexLeaf("\\D"), //
|
||||||
new RegexLeaf("DAY", "([\\d]{1,2})"));
|
new RegexLeaf("BDAY", "([\\d]{1,2})"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private IRegex toRegexE() {
|
||||||
|
return new RegexConcat( //
|
||||||
|
new RegexLeaf("[dD]\\+"), //
|
||||||
|
new RegexLeaf("ECOUNT", "([\\d]+)") //
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -53,35 +53,46 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
|
|||||||
public class SubjectDaysAsDates implements Subject {
|
public class SubjectDaysAsDates implements Subject {
|
||||||
|
|
||||||
public IRegex toRegex() {
|
public IRegex toRegex() {
|
||||||
return new RegexOr(regexTo(), regexAnd(), regexThen());
|
return new RegexOr(toRegexB(), toRegexE(), andRegex(), thenRegex());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IRegex regexTo() {
|
private IRegex toRegexB() {
|
||||||
return new RegexConcat( //
|
return new RegexConcat( //
|
||||||
new RegexLeaf("YEAR1", "([\\d]{4})"), //
|
new RegexLeaf("BYEAR1", "([\\d]{4})"), //
|
||||||
new RegexLeaf("\\D"), //
|
new RegexLeaf("\\D"), //
|
||||||
new RegexLeaf("MONTH1", "([\\d]{1,2})"), //
|
new RegexLeaf("BMONTH1", "([\\d]{1,2})"), //
|
||||||
new RegexLeaf("\\D"), //
|
new RegexLeaf("\\D"), //
|
||||||
new RegexLeaf("DAY1", "([\\d]{1,2})"), //
|
new RegexLeaf("BDAY1", "([\\d]{1,2})"), //
|
||||||
RegexLeaf.spaceOneOrMore(), //
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
new RegexLeaf("to"), //
|
new RegexLeaf("to"), //
|
||||||
RegexLeaf.spaceOneOrMore(), //
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
new RegexLeaf("YEAR2", "([\\d]{4})"), //
|
new RegexLeaf("BYEAR2", "([\\d]{4})"), //
|
||||||
new RegexLeaf("\\D"), //
|
new RegexLeaf("\\D"), //
|
||||||
new RegexLeaf("MONTH2", "([\\d]{1,2})"), //
|
new RegexLeaf("BMONTH2", "([\\d]{1,2})"), //
|
||||||
new RegexLeaf("\\D"), //
|
new RegexLeaf("\\D"), //
|
||||||
new RegexLeaf("DAY2", "([\\d]{1,2})") //
|
new RegexLeaf("BDAY2", "([\\d]{1,2})") //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IRegex regexAnd() {
|
private IRegex toRegexE() {
|
||||||
return new RegexConcat( //
|
return new RegexConcat( //
|
||||||
new RegexLeaf("YEAR3", "([\\d]{4})"), //
|
new RegexLeaf("[dD]\\+"), //
|
||||||
|
new RegexLeaf("ECOUNT1", "([\\d]+)"), //
|
||||||
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
|
new RegexLeaf("to"), //
|
||||||
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
|
new RegexLeaf("[dD]\\+"), //
|
||||||
|
new RegexLeaf("ECOUNT2", "([\\d]+)") //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IRegex andRegex() {
|
||||||
|
return new RegexConcat( //
|
||||||
|
new RegexLeaf("BYEAR3", "([\\d]{4})"), //
|
||||||
new RegexLeaf("\\D"), //
|
new RegexLeaf("\\D"), //
|
||||||
new RegexLeaf("MONTH3", "([\\d]{1,2})"), //
|
new RegexLeaf("BMONTH3", "([\\d]{1,2})"), //
|
||||||
new RegexLeaf("\\D"), //
|
new RegexLeaf("\\D"), //
|
||||||
new RegexLeaf("DAY3", "([\\d]{1,2})"), //
|
new RegexLeaf("BDAY3", "([\\d]{1,2})"), //
|
||||||
RegexLeaf.spaceOneOrMore(), //
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
new RegexLeaf("and"), //
|
new RegexLeaf("and"), //
|
||||||
RegexLeaf.spaceOneOrMore(), //
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
@ -92,7 +103,7 @@ public class SubjectDaysAsDates implements Subject {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IRegex regexThen() {
|
private IRegex thenRegex() {
|
||||||
return new RegexConcat( //
|
return new RegexConcat( //
|
||||||
new RegexLeaf("then"), //
|
new RegexLeaf("then"), //
|
||||||
RegexLeaf.spaceOneOrMore(), //
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
@ -106,7 +117,7 @@ public class SubjectDaysAsDates implements Subject {
|
|||||||
public Failable<DaysAsDates> getMe(GanttDiagram project, RegexResult arg) {
|
public Failable<DaysAsDates> getMe(GanttDiagram project, RegexResult arg) {
|
||||||
final String countAnd = arg.get("COUNT_AND", 0);
|
final String countAnd = arg.get("COUNT_AND", 0);
|
||||||
if (countAnd != null) {
|
if (countAnd != null) {
|
||||||
final Day date3 = getDate(arg, "3");
|
final Day date3 = getDate(project, arg, "3");
|
||||||
final int nb = Integer.parseInt(countAnd);
|
final int nb = Integer.parseInt(countAnd);
|
||||||
return Failable.ok(new DaysAsDates(project, date3, nb));
|
return Failable.ok(new DaysAsDates(project, date3, nb));
|
||||||
}
|
}
|
||||||
@ -116,16 +127,23 @@ public class SubjectDaysAsDates implements Subject {
|
|||||||
final int nb = Integer.parseInt(countThen);
|
final int nb = Integer.parseInt(countThen);
|
||||||
return Failable.ok(new DaysAsDates(project, date3, nb));
|
return Failable.ok(new DaysAsDates(project, date3, nb));
|
||||||
}
|
}
|
||||||
final Day date1 = getDate(arg, "1");
|
final Day date1 = getDate(project, arg, "1");
|
||||||
final Day date2 = getDate(arg, "2");
|
final Day date2 = getDate(project, arg, "2");
|
||||||
return Failable.ok(new DaysAsDates(date1, date2));
|
return Failable.ok(new DaysAsDates(date1, date2));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Day getDate(RegexResult arg, String suffix) {
|
private Day getDate(GanttDiagram project, RegexResult arg, String suffix) {
|
||||||
final int day = Integer.parseInt(arg.get("DAY" + suffix, 0));
|
if (arg.get("BDAY" + suffix, 0) != null) {
|
||||||
final int month = Integer.parseInt(arg.get("MONTH" + suffix, 0));
|
final int day = Integer.parseInt(arg.get("BDAY" + suffix, 0));
|
||||||
final int year = Integer.parseInt(arg.get("YEAR" + suffix, 0));
|
final int month = Integer.parseInt(arg.get("BMONTH" + suffix, 0));
|
||||||
return Day.create(year, month, day);
|
final int year = Integer.parseInt(arg.get("BYEAR" + suffix, 0));
|
||||||
|
return Day.create(year, month, day);
|
||||||
|
}
|
||||||
|
if (arg.get("ECOUNT" + suffix, 0) != null) {
|
||||||
|
final int day = Integer.parseInt(arg.get("ECOUNT" + suffix, 0));
|
||||||
|
return project.getStartingDate().addDays(day);
|
||||||
|
}
|
||||||
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<? extends SentenceSimple> getSentences() {
|
public Collection<? extends SentenceSimple> getSentences() {
|
||||||
|
@ -89,6 +89,7 @@ public enum SName {
|
|||||||
mindmapDiagram, //
|
mindmapDiagram, //
|
||||||
node, //
|
node, //
|
||||||
note, //
|
note, //
|
||||||
|
nwdiagDiagram, //
|
||||||
objectDiagram, //
|
objectDiagram, //
|
||||||
package_, //
|
package_, //
|
||||||
participant, //
|
participant, //
|
||||||
|
@ -80,7 +80,7 @@ public class Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int beta() {
|
public static int beta() {
|
||||||
final int beta = 1;
|
final int beta = 2;
|
||||||
return beta;
|
return beta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user