trying to add a third port for gateways

This commit is contained in:
Fernando Ontiveros
2011-02-22 07:24:53 +00:00
parent f8eb5ca177
commit 9d1997b4c0
3 changed files with 141 additions and 138 deletions

View File

@@ -54,7 +54,7 @@ bpmnGatewayExclusiveData.prototype.paint=function(){
this.graphics.fillPolygon( x_cross, y_cross);
this.graphics.paint();
if (this.input1 != null) {
this.input1.setPosition(0, this.height / 2);
this.input1.setPosition(10, this.height / 2);
}
if (this.input2 != null) {
this.input2.setPosition(this.width / 2, 0);
@@ -65,6 +65,9 @@ bpmnGatewayExclusiveData.prototype.paint=function(){
if (this.output2 != null) {
this.output2.setPosition(this.width, this.height / 2);
}
if (this.output3 != null) {
this.output3.setPosition(0, this.height / 2 );
}
};
@@ -75,10 +78,10 @@ bpmnGatewayExclusiveData.prototype.setWorkflow=function(_40c5){
var h2 = this.height/2;
var w2 = this.width/2;
var gatewayPortName = ['input1', 'input2', 'output1', 'output2', 'output3' ];
var gatewayPortType = ['InputPort','InputPort','OutputPort','OutputPort','OutputPort'];
var gatewayPositionX= [0, w2, h2, this.width, 0 ];
var gatewayPositionY= [h2, 0, this.width, h2, h2+10 ];
var gatewayPortName = ['output1', 'output3', 'output2', 'input1', 'input2' ];
var gatewayPortType = ['OutputPort','OutputPort','OutputPort','InputPort','InputPort'];
var gatewayPositionX= [w2, this.width, 0 , 0, w2 ];
var gatewayPositionY= [this.width, h2, h2, h2, 0 ];
for(var i=0; i< gatewayPortName.length ; i++){
eval('this.'+gatewayPortName[i]+' = new '+gatewayPortType[i]+'()');

View File

@@ -1,8 +1,9 @@
MyWorkflow=function(id){
Workflow.call(this,id);
this.html.style.backgroundImage="url(/skins/ext/images/gray/shapes/grid_10.png)";
this.setGridWidth(4,4);
this.setSnapToGrid(true);
Workflow.call(this,id);
this.html.style.backgroundImage="url(/skins/ext/images/gray/shapes/grid_10.png)";
//enable the snapToGrid
this.setGridWidth(2,2);
this.setSnapToGrid(true);
};
MyWorkflow.prototype=new Workflow;
MyWorkflow.prototype.type="MyWorkflow";
@@ -12,7 +13,7 @@ MyWorkflow.prototype.type="MyWorkflow";
* @Author Girish Joshi
*/
commandListener=function(){
CommandStackEventListener.call(this);
CommandStackEventListener.call(this);
};
commandListener.prototype=new CommandStackEventListener;
commandListener.prototype.type="commandListener";
@@ -23,10 +24,10 @@ commandListener.prototype.type="commandListener";
*/
MyWorkflow.prototype.subProcess= function(_6767)
{
_6767.subProcessName = 'Sub Process' ;
var subProcess = eval("new bpmnSubProcess(_6767) ");
var xPos = this.workflow.contextX;
var yPos = this.workflow.contextY;
_6767.subProcessName = 'Sub Process' ;
var subProcess = eval("new bpmnSubProcess(_6767) ");
var xPos = this.workflow.contextX;
var yPos = this.workflow.contextY;
_6767.scope.workflow.addFigure(subProcess, xPos, yPos);
subProcess.actiontype = 'addSubProcess';
this.workflow.saveShape(subProcess);
@@ -40,7 +41,7 @@ MyWorkflow.prototype.subProcess= function(_6767)
MyWorkflow.prototype.setBoundary = function (oShape) {
//Left Border
if (oShape.x < 5) {
oShape.x = 10;
oShape.x = 10;
}
//Right Border
if (oShape.x > 1300 - oShape.width) {
@@ -52,8 +53,8 @@ MyWorkflow.prototype.setBoundary = function (oShape) {
}
//Bottom Border
if (oShape.y > 1000 - oShape.height) {
workflow.main.setHeight(oShape.y+75);
}
workflow.main.setHeight(oShape.y+75);
}
}
/**
@@ -65,66 +66,66 @@ MyWorkflow.prototype.AddTaskContextMenu= function(oShape)
{
var taskExtObj = new TaskContext();
if (oShape.id != null) {
this.canvasTask = Ext.get(oShape.id);
this.contextTaskmenu = new Ext.menu.Menu({
items: [{
text: 'Steps',
iconCls: 'button_menu_ext ss_sprite ss_shape_move_forwards',
handler: taskExtObj.editTaskSteps,
scope: oShape
this.canvasTask = Ext.get(oShape.id);
this.contextTaskmenu = new Ext.menu.Menu({
items: [{
text: 'Steps',
iconCls: 'button_menu_ext ss_sprite ss_shape_move_forwards',
handler: taskExtObj.editTaskSteps,
scope: oShape
},
{
text: 'Users & Users Group',
iconCls: 'button_menu_ext ss_sprite ss_group',
handler: taskExtObj.editUsers,
scope: oShape
},
{
text: 'Users & Users Groups (ad-hoc)',
iconCls: 'button_menu_ext ss_sprite ss_group',
handler: taskExtObj.editUsersAdHoc,
scope: oShape
},
{
text: 'Transform To',
iconCls: 'button_menu_ext ss_sprite ss_page_refresh',
menu: { // <-- submenu by nested config object
items: [
// stick any markup in a menu
{
text: 'Sub Process',
iconCls: 'button_menu_ext ss_sprite ss_layout_link',
type:'bpmnSubProcess',
scope:oShape,
handler: MyWorkflow.prototype.toggleShapes
}
]
},
{
text: 'Users & Users Group',
iconCls: 'button_menu_ext ss_sprite ss_group',
handler: taskExtObj.editUsers,
scope: oShape
scope: this
},
{
text: 'Attach Event',
iconCls: 'button_menu_ext ss_sprite ss_link',
menu: { // <-- submenu by nested config object
items: [
// stick any markup in a menu
{
text: 'Timer Boundary Event',
iconCls: 'button_menu_ext ss_sprite ss_clock',
type:'bpmnEventBoundaryTimerInter',
scope:oShape,
handler: MyWorkflow.prototype.toggleShapes
}
]
},
{
text: 'Users & Users Groups (ad-hoc)',
iconCls: 'button_menu_ext ss_sprite ss_group',
handler: taskExtObj.editUsersAdHoc,
scope: oShape
},
{
text: 'Transform To',
iconCls: 'button_menu_ext ss_sprite ss_page_refresh',
menu: { // <-- submenu by nested config object
items: [
// stick any markup in a menu
{
text: 'Sub Process',
iconCls: 'button_menu_ext ss_sprite ss_layout_link',
type:'bpmnSubProcess',
scope:oShape,
handler: MyWorkflow.prototype.toggleShapes
}
]
},
scope: this
},
{
text: 'Attach Event',
iconCls: 'button_menu_ext ss_sprite ss_link',
menu: { // <-- submenu by nested config object
items: [
// stick any markup in a menu
{
text: 'Timer Boundary Event',
iconCls: 'button_menu_ext ss_sprite ss_clock',
type:'bpmnEventBoundaryTimerInter',
scope:oShape,
handler: MyWorkflow.prototype.toggleShapes
}
]
},
scope: this
},
{
text: 'Properties',
handler: taskExtObj.editTaskProperties,
scope: oShape
}]
});
scope: this
},
{
text: 'Properties',
handler: taskExtObj.editTaskProperties,
scope: oShape
}]
});
}
this.canvasTask.on('contextmenu', function (e) {
@@ -169,10 +170,10 @@ MyWorkflow.prototype.connectionContextMenu=function(oShape)
}]
});
this.canvasEvent.on('contextmenu', function(e) {
this.canvasEvent.on('contextmenu', function(e) {
e.stopEvent();
this.contextEventmenu.showAt(e.getXY());
}, this);
}, this);
}
/**
@@ -182,25 +183,25 @@ this.canvasEvent.on('contextmenu', function(e) {
*/
MyWorkflow.prototype.toggleConnection=function(oShape)
{
this.currentSelection.workflow.contextClicked = false;
switch (oShape.text) {
case 'NULL Router':
this.currentSelection.setRouter(null);
break;
case 'Manhatten Router':
this.currentSelection.setRouter(new ManhattanConnectionRouter());
break;
case 'Bezier Router':
this.currentSelection.setRouter(new BezierConnectionRouter());
break;
case 'Fan Router':
this.currentSelection.setRouter(new FanConnectionRouter());
break;
case 'Delete Router':
this.currentSelection.workflow.getCommandStack().execute(new CommandDelete(this.currentSelection.workflow.getCurrentSelection()));
ToolGeneric.prototype.execute.call(this);
break;
}
this.currentSelection.workflow.contextClicked = false;
switch (oShape.text) {
case 'NULL Router':
this.currentSelection.setRouter(null);
break;
case 'Manhatten Router':
this.currentSelection.setRouter(new ManhattanConnectionRouter());
break;
case 'Bezier Router':
this.currentSelection.setRouter(new BezierConnectionRouter());
break;
case 'Fan Router':
this.currentSelection.setRouter(new FanConnectionRouter());
break;
case 'Delete Router':
this.currentSelection.workflow.getCommandStack().execute(new CommandDelete(this.currentSelection.workflow.getCurrentSelection()));
ToolGeneric.prototype.execute.call(this);
break;
}
}
/**
@@ -210,22 +211,22 @@ MyWorkflow.prototype.toggleConnection=function(oShape)
*/
MyWorkflow.prototype.AddGatewayPorts = function(_40c5)
{
var TaskPortName = ['inputPort1','inputPort2','outputPort1','outputPort2'];
var TaskPortType = ['InputPort','InputPort','OutputPort','OutputPort'];
var TaskPositionX= [0,_40c5.width/2,_40c5.width,_40c5.width/2];
var TaskPositionY= [_40c5.height/2,0,_40c5.height/2,_40c5.height];
var TaskPortName = ['inputPort1','inputPort2','outputPort1','outputPort2','outputPort3'];
var TaskPortType = ['InputPort','InputPort','OutputPort','OutputPort','OutputPort'];
var TaskPositionX= [0,_40c5.width/2,_40c5.width,_40c5.width/2, 0];
var TaskPositionY= [_40c5.height/2,0,_40c5.height/2,_40c5.Height, _40c5.height/2 + 10];
for(var i=0; i< TaskPortName.length ; i++){
eval('_40c5.'+TaskPortName[i]+' = new '+TaskPortType[i]+'()'); //Create New Port
eval('_40c5.'+TaskPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow
eval('_40c5.'+TaskPortName[i]+'.setName("'+TaskPortName[i]+'")'); //Set PortName
eval('_40c5.'+TaskPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure
eval('_40c5.'+TaskPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white
eval('_40c5.'+TaskPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white
this.workflow = _40c5.workflow;
this.workflow.currentSelection =_40c5;
eval('_40c5.addPort(_40c5.'+TaskPortName[i]+','+TaskPositionX[i]+', '+TaskPositionY[i]+')'); //Setting Position of the port
}
for(var i=0; i< TaskPortName.length ; i++){
eval('_40c5.'+TaskPortName[i]+' = new '+TaskPortType[i]+'()'); //Create New Port
eval('_40c5.'+TaskPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow
eval('_40c5.'+TaskPortName[i]+'.setName("'+TaskPortName[i]+'")'); //Set PortName
eval('_40c5.'+TaskPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure
eval('_40c5.'+TaskPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white
eval('_40c5.'+TaskPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white
this.workflow = _40c5.workflow;
this.workflow.currentSelection =_40c5;
eval('_40c5.addPort(_40c5.'+TaskPortName[i]+','+TaskPositionX[i]+', '+TaskPositionY[i]+')'); //Setting Position of the port
}
}
/**
* ExtJs Form on right Click of Gateways
@@ -767,7 +768,10 @@ MyWorkflow.prototype.disablePorts=function(oShape)
if(oShape.type != ''){
var ports ='';
if(oShape.type.match(/Task/) || oShape.type.match(/Gateway/) || oShape.type.match(/Inter/) || oShape.type.match(/SubProcess/)) {
ports = ['output1','input1','output2','input2'];
ports = ['output1','input1','output2','input2' ];
}
else if(oShape.type.match(/bpmnGatewayExclusiveData/)) {
ports = ['output1','input1','output2','input2', 'input3' ];
}
else if(oShape.type.match(/End/)) {
ports = ['input1','input2'];

View File

@@ -16,8 +16,6 @@ new Ext.KeyMap(document, {
});
Ext.onReady ( function() {
//var _BROWSER = getBrowserInf();
workflow = new MyWorkflow("paintarea");
workflow.setEnableSmoothFigureHandling(false);
workflow.scrollArea.width = 2000;
@@ -25,7 +23,6 @@ Ext.onReady ( function() {
// workflow.getCommandStack().addCommandStackEventListener(new commandListener());
//Getting process id from the URL using getUrlvars function
if(typeof pro_uid !== 'undefined') {
Ext.Ajax.request({
url: 'openProcess.php?PRO_UID=' + pro_uid,
@@ -40,7 +37,6 @@ Ext.onReady ( function() {
}
/**********************************************************************************
*
* Do the Ext (Yahoo UI) Stuff
@@ -60,18 +56,18 @@ Ext.onReady ( function() {
items:{
html:'<div id="x-shapes">\n\
<p id="x-shapes-task" title="Task" ><img src= "/skins/ext/images/gray/shapes/pallete/task.png"/></p>\n\
<p id="x-shapes-startEvent" title="Start"><img src= "/skins/ext/images/gray/shapes/pallete/startevent.png"/></p>\n\
<p id="x-shapes-interEvent" title="Intermediate Event"><img src= "/skins/ext/images/gray/shapes/pallete/interevent.png"/></p>\n\
<p id="x-shapes-endEvent" title="End Event"><img src= "/skins/ext/images/gray/shapes/pallete/endevent.png"/></p>\n\
<p id="x-shapes-gateways" title="Gateway"><img src= "/skins/ext/images/gray/shapes/pallete/gateway.png"/></p>\n\
<p id="x-shapes-annotation" title="Annotation"><img src= "/skins/ext/images/gray/shapes/pallete/annotation.png"/></p>\n\
<!--<p id="x-shapes-group" title="Group"><img src= "/skins/ext/images/gray/shapes/pallete/group.png"/></p>\n\
<p id="x-shapes-dataobject" title="Data Object"><img src= "/skins/ext/images/gray/shapes/pallete/dataobject.png"/></p>\n\
<p id="x-shapes-pool" title="Pool"><img src= "/skins/ext/images/gray/shapes/pallete/pool.png"/></p>\n\
<p id="x-shapes-lane" title="Lane"><img src= "/skins/ext/images/gray/shapes/pallete/lane.png"/></p>\n\
<p id="x-shapes-milestone" title="Milestone"><img src= "/skins/ext/images/gray/shapes/pallete/milestone.png"/></p>-->\n\
</div>'
<p id="x-shapes-task" title="Task" ><img src= "/skins/ext/images/gray/shapes/pallete/task.png"/></p>\n\
<p id="x-shapes-startEvent" title="Start"><img src= "/skins/ext/images/gray/shapes/pallete/startevent.png"/></p>\n\
<p id="x-shapes-interEvent" title="Intermediate Event"><img src= "/skins/ext/images/gray/shapes/pallete/interevent.png"/></p>\n\
<p id="x-shapes-endEvent" title="End Event"><img src= "/skins/ext/images/gray/shapes/pallete/endevent.png"/></p>\n\
<p id="x-shapes-gateways" title="Gateway"><img src= "/skins/ext/images/gray/shapes/pallete/gateway.png"/></p>\n\
<p id="x-shapes-annotation" title="Annotation"><img src= "/skins/ext/images/gray/shapes/pallete/annotation.png"/></p>\n\
<!--<p id="x-shapes-group" title="Group"><img src= "/skins/ext/images/gray/shapes/pallete/group.png"/></p>\n\
<p id="x-shapes-dataobject" title="Data Object"><img src= "/skins/ext/images/gray/shapes/pallete/dataobject.png"/></p>\n\
<p id="x-shapes-pool" title="Pool"><img src= "/skins/ext/images/gray/shapes/pallete/pool.png"/></p>\n\
<p id="x-shapes-lane" title="Lane"><img src= "/skins/ext/images/gray/shapes/pallete/lane.png"/></p>\n\
<p id="x-shapes-milestone" title="Milestone"><img src= "/skins/ext/images/gray/shapes/pallete/milestone.png"/></p>-->\n\
</div>'
}
};
@@ -113,16 +109,16 @@ Ext.onReady ( function() {
animate: true,
region : "south",
items: {
region: 'center',
xtype: 'tabpanel',
items: [{
title: 'Properties',
html: 'Properties'
},
{
title: 'Debug Console',
html: 'Debug Console'
}]
region: 'center',
xtype: 'tabpanel',
items: [{
title: 'Properties',
html: 'Properties'
},
{
title: 'Debug Console',
html: 'Debug Console'
}]
}
};