|
@@ -1,10 +1,12 @@
|
|
|
package com.persagy.adm.diagram.core.model.template;
|
|
|
|
|
|
+import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
|
import com.google.gson.annotations.Expose;
|
|
|
import com.persagy.adm.diagram.core.model.base.Container;
|
|
|
import com.persagy.adm.diagram.core.model.base.IComponent;
|
|
|
import com.persagy.adm.diagram.core.model.base.Layout;
|
|
|
import com.persagy.adm.diagram.core.model.base.XY;
|
|
|
+import com.persagy.adm.diagram.core.model.logic.DynGroup;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Iterator;
|
|
@@ -66,6 +68,12 @@ public class DiagramTemplate {
|
|
|
@Expose
|
|
|
private List<MainPipe> mainPipes;
|
|
|
|
|
|
+ /**
|
|
|
+ * 初始化状态
|
|
|
+ */
|
|
|
+ @JsonIgnore
|
|
|
+ private boolean initialized;
|
|
|
+
|
|
|
public String getDiagramType() {
|
|
|
return diagramType;
|
|
|
}
|
|
@@ -131,6 +139,9 @@ public class DiagramTemplate {
|
|
|
}
|
|
|
|
|
|
public void init() {
|
|
|
+ if(initialized)
|
|
|
+ return;
|
|
|
+
|
|
|
frame.initParent();
|
|
|
initScattered(frame);
|
|
|
|
|
@@ -139,6 +150,35 @@ public class DiagramTemplate {
|
|
|
mainPipe.init(this);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ setDynTarget();
|
|
|
+
|
|
|
+ initialized = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setDynTarget(){
|
|
|
+ List<Container> containers = getContainers();
|
|
|
+ containers.forEach(container -> container.setDynTarget(null));
|
|
|
+ if(mainPipes != null){
|
|
|
+ mainPipes.forEach(mainPipe -> mainPipe.setDynTarget(null));
|
|
|
+ }
|
|
|
+
|
|
|
+ for(Container con : containers) {
|
|
|
+ DynGroup dynGroup = con.getDynGroup();
|
|
|
+ if(dynGroup != null) {
|
|
|
+ if(Container.TYPE.equals(dynGroup.getDynSourceType())) {
|
|
|
+ Container conSrc = getContainerById(dynGroup.getDynSource());
|
|
|
+ if(conSrc != null){
|
|
|
+ conSrc.setDynTarget(con.getId());
|
|
|
+ }
|
|
|
+ } else if(MainPipe.TYPE.equals(dynGroup.getDynSourceType())) {
|
|
|
+ MainPipe mpSrc = getMainPipeById(dynGroup.getDynSource());
|
|
|
+ if(mpSrc != null){
|
|
|
+ mpSrc.setDynTarget(con.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void initScattered(Container con){
|