PipeControlPoint pcp = getControlPoint();
// Second check is needed, when remove process is initiated from control point.
if (pcp != null && pcp.getPipelineComponent() != null) {
+ if (pcp.isSizeChange()) {
+ mergeWithAlternative();
+ }
+
pcp.remove();
}
+
setPipeRun(null);
super.remove();
}
+
+ private void mergeWithAlternative() {
+ PipeRun run = getPipeRun();
+ PipeRun alternative = getAlternativePipeRun();
+ if (alternative != null) {
+ // Move components from alternative pipe run to main run
+ PipelineComponent p = getNext();
+ while (p != null && p.getPipeRun() == alternative) {
+ if (p.getParent() == alternative) {
+ p.deattach(); // For components
+ run.addChild(p);
+ }
+ else {
+ p.setPipeRun(run); // For nozzles
+ }
+
+ p.updateParameters();
+ PipingRules.requestUpdate(p.getControlPoint());
+
+ p = p.getNext();
+ }
+
+ setAlternativePipeRun(run);
+
+ if (alternative.getChild().isEmpty())
+ alternative.remove();
+ }
+ }
public void removeAndSplit() {
PipeControlPoint pcp = getControlPoint();
throw new IllegalStateException("No centroid defined");
}
}
+
+
+ private String error;
+
+ /**
+ * Returns possible pipe modelling error, or null;
+ * @return
+ */
+ @GetPropertyValue(name="Error", value="error", tabId = "Default")
+ public String getError() {
+ return error;
+ }
+
+ /**
+ * Sets pipe modelling error.
+ *
+ * Error is usually set by PipingRules.
+ * @param error
+ */
+ public void setError(String error) {
+ if (this.error == null) {
+ if (error == null)
+ return;
+ } else if (this.error.equals(error))
+ return;
+ this.error = error;
+ firePropertyChanged("error");
+ }
}