Skip to content
Snippets Groups Projects

Master

Merged Peter Zhai requested to merge master into release
3 files
+ 320
87
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 45
19
@@ -141,6 +141,10 @@ var cqhm = cqhm || {};
source: {x: 20, y:200},
target: {x: 170, y:200}
}),
new cqhm.modelTypes.CausalConnectionNegative({
source: {x: 20, y:230},
target: {x: 170, y:230}
}),
new cqhm.modelTypes.Parameter({
position: { x: 120, y: 35 },
size: { width: 20, height: 20 }
@@ -164,6 +168,10 @@ var cqhm = cqhm || {};
new cqhm.modelTypes.DynamicEvent({
position: { x: 25, y: 85 },
size: { width: 25, height: 25 }
}),
new cqhm.modelTypes.Agent({
position: { x: 25, y: 150 },
size: { width: 50, height: 90 }
})
]);
@@ -174,32 +182,36 @@ var cqhm = cqhm || {};
initializeByDivId(statechartPaletteId);
this._pallettes[statechartPaletteId].graph.addCells([
// new cqhm.modelTypes.StatechartEntryPoint({
// position: { x: 20, y: 15 },
// size: { width: 30, height: 30 }
// }),
new cqhm.modelTypes.StatechartEntryPoint({
position: { x: 20, y: 15 },
size: { width: 30, height: 30 }
source: { x: 120, y: 15 },
target: { x: 120, y: 90 }
}),
new cqhm.modelTypes.State({
position: { x: 10, y: 50 },
position: { x: 10, y: 70 },
size: { width: 80, height: 40 }
}),
new cqhm.modelTypes.StateTransition({
source: {x: 20, y:110},
target: {x: 170, y:110}
source: {x: 20, y:130},
target: {x: 170, y:130}
}),
new cqhm.modelTypes.Branch({
position: { x: 10, y: 140 },
position: { x: 10, y: 160 },
size: { width: 80, height: 40 }
}),
new cqhm.modelTypes.StateTransitionTrue({
source: {x: 20, y:170},
target: {x: 170, y:170}
}),
new cqhm.modelTypes.StateTransitionFalse({
source: {x: 20, y:190},
target: {x: 170, y:190}
}),
new cqhm.modelTypes.StateTransitionFalse({
source: {x: 20, y:210},
target: {x: 170, y:210}
}),
new cqhm.modelTypes.FinalState({
position: { x: 25, y: 220 },
position: { x: 25, y: 240 },
size: { width: 15, height: 15 }
}),
]);
@@ -246,6 +258,12 @@ var cqhm = cqhm || {};
var dx = parentPaperOffset.left - flyOffset.left;
var dy = parentPaperOffset.top - flyOffset.top;
flyShape.shift(dx, dy);
if ("cqhm.Agent" == flyShape.get("type")) {
var scaledSize = flyShape.get("size");
scaledSize.width *=8;
scaledSize.height *= 6;
flyShape.set("size", scaledSize);
}
flyGraph.addCell(flyShape);
cqhm.modelPallette._fly = {
@@ -606,7 +624,8 @@ var cqhm = cqhm || {};
var type = realtimeModelObj.get("type");
// Handle basic object shapes (not connections)
if (_.contains(["cqhm.Stock", "cqhm.Cloud", "cqhm.FinalState", "cqhm.Branch", "cqhm.StatechartEntryPoint", "cqhm.State", "cqhm.Parameter"], type)) {
if (_.contains(["cqhm.Stock", "cqhm.Cloud", "cqhm.FinalState", "cqhm.Branch", "cqhm.State", "cqhm.Parameter", "cqhm.Event",
"cqhm.DynamicEvent","cqhm.Agent"], type)) {
// Find all the changes
var changes = {};
_.each(eventDetails.events, function(event) {
@@ -664,7 +683,7 @@ var cqhm = cqhm || {};
}
// Handle connection shapes
} else if (_.contains(["cqhm.Flow", "cqhm.StateTransition", "cqhm.StateTransitionTrue", "cqhm.StateTransitionFalse", "cqhm.CausalConnectionPositive"], type)) {
} else if (_.contains(["cqhm.Flow", "cqhm.StatechartEntryPoint", "cqhm.StateTransition", "cqhm.StateTransitionTrue", "cqhm.StateTransitionFalse", "cqhm.CausalConnectionPositive"], type)) {
// Find all the changes
var changes = {};
@@ -792,7 +811,7 @@ var cqhm = cqhm || {};
cqhm.modelBridge._newRealtimeObjFromJointjsObj = function(jointjsCell) {
var newRtElem = dataHandler.realtime.getBaseElemStructure();
var type = jointjsCell.get("type");
if (_.contains(["cqhm.Stock", "cqhm.Cloud", "cqhm.FinalState", "cqhm.Branch", "cqhm.StatechartEntryPoint","cqhm.State", "cqhm.Parameter","cqhm.Event", "cqhm.DynamicEvent"], type)) {
if (_.contains(["cqhm.Stock", "cqhm.Cloud", "cqhm.FinalState", "cqhm.Branch", "cqhm.State", "cqhm.Parameter","cqhm.Event", "cqhm.DynamicEvent", "cqhm.Agent"], type)) {
var position = jointjsCell.get("position");
newRtElem.set("position.x", position.x);
newRtElem.set("position.y", position.y);
@@ -800,7 +819,8 @@ var cqhm = cqhm || {};
newRtElem.set("size.width", size.width);
newRtElem.set("size.height", size.height);
} else if (_.contains(["cqhm.Flow", "cqhm.StateTransition", "cqhm.StateTransitionTrue", "cqhm.StateTransitionFalse", "cqhm.CausalConnectionPositive"], type)) {
} else if (_.contains(["cqhm.Flow", "cqhm.StateTransition", "cqhm.StatechartEntryPoint", "cqhm.StateTransitionTrue", "cqhm.StateTransitionFalse", "cqhm.CausalConnectionPositive",
"cqhm.CausalConnectionNegative"], type)) {
var source = jointjsCell.get("source");
newRtElem.set("source.x", source.x);
newRtElem.set("source.y", source.y);
@@ -841,7 +861,7 @@ var cqhm = cqhm || {};
var params = {
id: realtimeModelObj.get("id")
};
if (_.contains(["cqhm.Stock", "cqhm.Cloud", "cqhm.FinalState", "cqhm.Branch", "cqhm.StatechartEntryPoint", "cqhm.State", "cqhm.Parameter", "cqhm.Event", "cqhm.DynamicEvent"], cellType)) {
if (_.contains(["cqhm.Stock", "cqhm.Cloud", "cqhm.FinalState", "cqhm.Branch", "cqhm.State", "cqhm.Parameter", "cqhm.Event", "cqhm.DynamicEvent", "cqhm.Agent"], cellType)) {
params.position = {
x: realtimeModelObj.get("position.x"),
y: realtimeModelObj.get("position.y")
@@ -850,7 +870,9 @@ var cqhm = cqhm || {};
width: realtimeModelObj.get("size.width"),
height: realtimeModelObj.get("size.height")
};
} else if (_.contains(["cqhm.Flow", "cqhm.StateTransition", "cqhm.StateTransitionTrue", "cqhm.StateTransitionFalse", "cqhm.CausalConnectionPositive"], cellType)) {
} else if (_.contains(["cqhm.Flow", "cqhm.StateTransition", "cqhm.StateTransitionTrue", "cqhm.StateTransitionFalse", "cqhm.StatechartEntryPoint", "cqhm.CausalConnectionPositive",
"cqhm.CausalConnectionNegative"], cellType)) {
params.source = {};
params.target = {};
_.each(["x", "y", "id"], function(paramName) {
@@ -888,7 +910,9 @@ var cqhm = cqhm || {};
newCell = new cqhm.modelTypes.StatechartEntryPoint(params);
} else if ("cqhm.CausalConnectionPositive" == cellType) {
newCell = new cqhm.modelTypes.CausalConnectionPositive(params);
} else if ("cqhm.State" == cellType) {
} else if ("cqhm.CausalConnectionNegative" == cellType) {
newCell = new cqhm.modelTypes.CausalConnectionNegative(params);
} else if ("cqhm.State" == cellType) {
newCell = new cqhm.modelTypes.State(params);
} else if ("cqhm.Parameter" == cellType) {
newCell = new cqhm.modelTypes.Parameter(params);
@@ -896,7 +920,9 @@ var cqhm = cqhm || {};
newCell = new cqhm.modelTypes.Event(params);
} else if ("cqhm.DynamicEvent" == cellType) {
newCell = new cqhm.modelTypes.DynamicEvent(params);
}else {
} else if ("cqhm.Agent" == cellType) {
newCell = new cqhm.modelTypes.Agent(params);
} else {
dev.error(3, "The type '" + cellType + "' is not handled in the modelBridge._newJointjsObjFromRealtimeObj function!");
}
Loading