Added a new demo showing off flow diagram usage:

- PortModel can now decide whether or not a link should be allowed (E.g. only allowing outputs to connect to inputs)
- PortModel now has an optional maximum number of links - When set to 1 an existing link is returned by createLinkModel and when set to another finite number null will be returned when the maximum is reached
- LinkModel has been updated to support the resetting of existing links (I.e. removing ports and removing mid-points)
- DiagramWidget has been updated to handle null being returned by createLinkModel as well as an existing link (this also supports an existing link where the link's target port should now be the source port)
- DiagramWidget has been updated to respect the PortModel's new canLinkToPort method
- DiagramWidget has been updated to disallow duplicate links
This commit is contained in:
Andrew Young
2018-01-24 17:02:58 +00:00
parent 266eb85436
commit b7698ca53a
7 changed files with 154 additions and 15 deletions

View File

@ -99,12 +99,16 @@ export default () => {
model.addNode(node4);
var link1 = node1.getOutPorts()[0].createLinkModel();
link1.setTargetPort(port3);
model.addLink(link1);
if (link1) {
link1.setTargetPort(port3);
model.addLink(link1);
}
var link2 = node1.getOutPorts()[1].createLinkModel();
link2.setTargetPort(port4);
model.addLink(link2);
if (link2) {
link2.setTargetPort(port4);
model.addLink(link2);
}
// load model into engine
engine.setDiagramModel(model);