Skip to content
Snippets Groups Projects

Develop

Merged Peter Zhai requested to merge develop into develop_peter
2 files
+ 44
1
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 42
0
@@ -600,6 +600,16 @@ var cqhm = cqhm || {};
realtimeModelObj.set("size.height", size.height);
dataHandler.realtime.endCompoundOperation();
});
jointjsCell.on("change:parent", function() {
if (!jointjsCell._triggerEvents) {
// Instructed not to trigger events by the caller
return;
}
dataHandler.realtime.beginCompoundOperation();
var parent = jointjsCell.get("parent") || "FLAG_N/A";
realtimeModelObj.set("parent", parent);
dataHandler.realtime.endCompoundOperation();
});
var OBJECT_CHANGED_EVENT = dataHandler.realtime.EventTypes.OBJECT_CHANGED;
realtimeModelObj.addEventListener(OBJECT_CHANGED_EVENT, function(eventDetails) {
// Whether a local event or a remote event, stop the event from bubbling to
@@ -668,6 +678,9 @@ var cqhm = cqhm || {};
changes.size.height = event.newValue;
} else if ("z" == event.property) {
changes.z = event.newValue;
} else if ("parent" == event.property) {
changes.parent = event.newValue;
changes.parentPrev = event.oldValue;
} else {
dev.error(3, "The change of '" + event.property + "' is not handled in the realtime object changed function!");
}
@@ -707,6 +720,19 @@ var cqhm = cqhm || {};
cqhm.modelSelection.updateSelectionHighlighters();
}
// If there was a change to the embeded parent, handle it
if (undefined !== changes.parent) {
if (changes.parent == "FLAG_N/A" && changes.parentPrev != "FLAG_N/A") {
// Unembed it
var parentCell = cqhm.modelDisplay._graph.getCell(changes.parentPrev);
parentCell.unembed(jointjsCell);
} else if (changes.parent != "FLAG_N/A" && changes.parentPrev == "FLAG_N/A") {
// Embed it
var parentCell = cqhm.modelDisplay._graph.getCell(changes.parent);
parentCell.embed(jointjsCell);
}
}
// Handle connection shapes
} else if (_.contains(["cqhm.Flow", "cqhm.StatechartEntryPoint", "cqhm.StateTransition", "cqhm.StateTransitionTrue", "cqhm.StateTransitionFalse",
"cqhm.CausalConnectionPositive", "cqhm.CausalConnectionNegative"], type)) {
@@ -741,6 +767,9 @@ var cqhm = cqhm || {};
changes.vertices = event.newValue;
} else if ("z" == event.property) {
changes.z = event.newValue;
} else if ("parent" == event.property) {
changes.parent = event.newValue;
changes.parentPrev = event.oldValue;
} else {
dev.error(3, "The type '" + type + "' is not handled in the change function!");
}
@@ -826,6 +855,19 @@ var cqhm = cqhm || {};
// Note: 4th parameter is custom to cqhm --> false means don't trigger jointjs events
jointjsCell.set("z", changes.z, undefined, false)
}
// If there was a change to the embeded parent, handle it
if (undefined !== changes.parent) {
if (changes.parent == "FLAG_N/A" && changes.parentPrev != "FLAG_N/A") {
// Unembed it
var parentCell = cqhm.modelDisplay._graph.getCell(changes.parentPrev);
parentCell.unembed(jointjsCell);
} else if (changes.parent != "FLAG_N/A" && changes.parentPrev == "FLAG_N/A") {
// Embed it
var parentCell = cqhm.modelDisplay._graph.getCell(changes.parent);
parentCell.embed(jointjsCell);
}
}
} else {
dev.error(3, "The type '" + type + "' is not handled in the realtimeModelObj.addEventListener function!");
}
Loading