mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
wip
This commit is contained in:
parent
f4221e340a
commit
690fa349ba
@ -86,7 +86,6 @@ public class NwDiagram extends UmlDiagram {
|
|||||||
private final List<Network> networks = new ArrayList<>();
|
private final List<Network> networks = new ArrayList<>();
|
||||||
private final List<NwGroup> groups = new ArrayList<>();
|
private final List<NwGroup> groups = new ArrayList<>();
|
||||||
private final List<NStackable> stack = new ArrayList<NStackable>();
|
private final List<NStackable> stack = new ArrayList<NStackable>();
|
||||||
// private NwGroup currentGroup = null;
|
|
||||||
|
|
||||||
private final NPlayField playField = new NPlayField();
|
private final NPlayField playField = new NPlayField();
|
||||||
|
|
||||||
@ -116,6 +115,15 @@ public class NwDiagram extends UmlDiagram {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void makeDiagramReady() {
|
||||||
|
super.makeDiagramReady();
|
||||||
|
for (NServer server : servers.values()) {
|
||||||
|
server.connectMeIfAlone(networks.get(0));
|
||||||
|
playField.addInPlayfield(server.getBar());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public CommandExecutionResult openGroup(String name) {
|
public CommandExecutionResult openGroup(String name) {
|
||||||
if (initDone == false)
|
if (initDone == false)
|
||||||
return errorNoInit();
|
return errorNoInit();
|
||||||
@ -169,19 +177,24 @@ public class NwDiagram extends UmlDiagram {
|
|||||||
if (server1 == null) {
|
if (server1 == null) {
|
||||||
if (networks.size() == 0)
|
if (networks.size() == 0)
|
||||||
return veryFirstLink(name1, name2);
|
return veryFirstLink(name1, name2);
|
||||||
return CommandExecutionResult.error("what " + name1);
|
return CommandExecutionResult.error("what about " + name1);
|
||||||
}
|
}
|
||||||
NServer server2 = servers.get(name2);
|
NServer server2 = servers.get(name2);
|
||||||
|
final Network network = createNetwork("");
|
||||||
|
network.goInvisible();
|
||||||
if (server2 == null) {
|
if (server2 == null) {
|
||||||
// server2 = NServer.create(name2, getSkinParam());
|
// server2 = NServer.create(name2, getSkinParam());
|
||||||
server2 = new NServer(name2, server1.getBar(), getSkinParam());
|
server2 = new NServer(name2, server1.getBar(), getSkinParam());
|
||||||
servers.put(name2, server2);
|
servers.put(name2, server2);
|
||||||
Network network = createNetwork("");
|
|
||||||
network.goInvisible();
|
|
||||||
server2.connectTo(network, "");
|
|
||||||
server1.connectTo(network, "");
|
server1.connectTo(network, "");
|
||||||
playField.addInPlayfield(server2.getBar());
|
server2.connectTo(network, "");
|
||||||
|
} else {
|
||||||
|
server1.blankSomeAddress();
|
||||||
|
server1.connectTo(network, server1.someAddress());
|
||||||
|
server2.connectTo(network, server2.someAddress());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
playField.addInPlayfield(server2.getBar());
|
||||||
|
|
||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
@ -195,7 +208,7 @@ public class NwDiagram extends UmlDiagram {
|
|||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandExecutionResult linkOld(String name1, String name2) {
|
private CommandExecutionResult linkOld(String name1, String name2) {
|
||||||
if (initDone == false)
|
if (initDone == false)
|
||||||
return errorNoInit();
|
return errorNoInit();
|
||||||
|
|
||||||
@ -238,39 +251,47 @@ public class NwDiagram extends UmlDiagram {
|
|||||||
if (initDone == false)
|
if (initDone == false)
|
||||||
return errorNoInit();
|
return errorNoInit();
|
||||||
|
|
||||||
if (currentGroup() != null) {
|
final Map<String, String> props = toSet(definition);
|
||||||
if (alreadyInSomeGroup(name))
|
|
||||||
return CommandExecutionResult.error("Element already in another group.");
|
|
||||||
|
|
||||||
currentGroup().addName(name);
|
|
||||||
if (currentNetwork() == null)
|
|
||||||
return CommandExecutionResult.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
NServer server = servers.get(name);
|
NServer server = servers.get(name);
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
server = NServer.create(name, getSkinParam());
|
server = NServer.create(name, getSkinParam());
|
||||||
servers.put(name, server);
|
servers.put(name, server);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Map<String, String> props = toSet(definition);
|
if (currentGroup() != null) {
|
||||||
|
if (alreadyInSomeGroup(name))
|
||||||
|
return CommandExecutionResult.error("Element already in another group.");
|
||||||
|
|
||||||
|
currentGroup().addName(name);
|
||||||
|
if (currentNetwork() == null) {
|
||||||
|
server.updateProperties(props);
|
||||||
|
return CommandExecutionResult.ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (networks.size() == 0) {
|
if (networks.size() == 0) {
|
||||||
Network network = createNetwork("");
|
final Network network = createNetwork("");
|
||||||
network.goInvisible();
|
network.goInvisible();
|
||||||
server.connectTo(network, props.get("address"));
|
server.connectTo(network, props.get("address"));
|
||||||
|
playField.addInPlayfield(server.getBar());
|
||||||
server.doNotPrintFirstLink();
|
server.doNotPrintFirstLink();
|
||||||
} else {
|
} else {
|
||||||
if (networks.size() == 1)
|
/*
|
||||||
server.connectTo(networks.get(0), props.get("address"));
|
* if (networks.size() == 1) server.connectTo(networks.get(0),
|
||||||
else if (currentNetwork() != null)
|
* props.get("address")); else
|
||||||
|
*/
|
||||||
|
if (currentNetwork() != null) {
|
||||||
server.connectTo(currentNetwork(), props.get("address"));
|
server.connectTo(currentNetwork(), props.get("address"));
|
||||||
|
playField.addInPlayfield(server.getBar());
|
||||||
|
} else {
|
||||||
|
server.learnThisAddress(props.get("address"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
server.updateProperties(props);
|
server.updateProperties(props);
|
||||||
playField.addInPlayfield(server.getBar());
|
|
||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandExecutionResult addElementOld(String name, String definition) {
|
private CommandExecutionResult addElementOld(String name, String definition) {
|
||||||
if (initDone == false)
|
if (initDone == false)
|
||||||
return errorNoInit();
|
return errorNoInit();
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ package net.sourceforge.plantuml.nwdiag.core;
|
|||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.decoration.symbol.USymbol;
|
import net.sourceforge.plantuml.decoration.symbol.USymbol;
|
||||||
import net.sourceforge.plantuml.decoration.symbol.USymbols;
|
import net.sourceforge.plantuml.decoration.symbol.USymbols;
|
||||||
@ -69,6 +70,7 @@ public class NServer {
|
|||||||
private String backcolor;
|
private String backcolor;
|
||||||
private final NBar bar;
|
private final NBar bar;
|
||||||
private final ISkinParam skinParam;
|
private final ISkinParam skinParam;
|
||||||
|
private String declaredAddress;
|
||||||
|
|
||||||
private boolean printFirstLink = true;
|
private boolean printFirstLink = true;
|
||||||
|
|
||||||
@ -76,9 +78,19 @@ public class NServer {
|
|||||||
this.printFirstLink = false;
|
this.printFirstLink = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void connectMeIfAlone(Network network) {
|
||||||
|
if (connections.size() == 0) {
|
||||||
|
connectTo(network, "");
|
||||||
|
if (network.isVisible() == false)
|
||||||
|
this.doNotPrintFirstLink();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String someAddress() {
|
public String someAddress() {
|
||||||
if (connections.size() > 0)
|
if (connections.size() > 0 && connections.values().iterator().next().length() > 0)
|
||||||
return connections.values().iterator().next();
|
return connections.values().iterator().next();
|
||||||
|
if (declaredAddress != null)
|
||||||
|
return declaredAddress;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,6 +107,16 @@ public class NServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void learnThisAddress(String address) {
|
||||||
|
for (Entry<Network, String> ent : connections.entrySet()) {
|
||||||
|
if (ent.getValue().length() == 0) {
|
||||||
|
connections.put(ent.getKey(), address);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public final boolean printFirstLink() {
|
public final boolean printFirstLink() {
|
||||||
return printFirstLink;
|
return printFirstLink;
|
||||||
}
|
}
|
||||||
@ -164,7 +186,12 @@ public class NServer {
|
|||||||
public void updateProperties(Map<String, String> props) {
|
public void updateProperties(Map<String, String> props) {
|
||||||
if (props.get("description") != null)
|
if (props.get("description") != null)
|
||||||
this.description = props.get("description");
|
this.description = props.get("description");
|
||||||
this.backcolor = props.get("color");
|
|
||||||
|
if (props.get("color") != null)
|
||||||
|
this.backcolor = props.get("color");
|
||||||
|
|
||||||
|
if (props.get("address") != null)
|
||||||
|
this.declaredAddress = props.get("address");
|
||||||
|
|
||||||
final String shape = props.get("shape");
|
final String shape = props.get("shape");
|
||||||
if (shape != null) {
|
if (shape != null) {
|
||||||
|
@ -82,7 +82,7 @@ public class Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int beta() {
|
public static int beta() {
|
||||||
final int beta = 2;
|
final int beta = 4;
|
||||||
return beta;
|
return beta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user