diff --git a/workflow/engine/templates/bpmn/MyWorkflow.js b/workflow/engine/templates/bpmn/MyWorkflow.js index 848e4d624..947976907 100755 --- a/workflow/engine/templates/bpmn/MyWorkflow.js +++ b/workflow/engine/templates/bpmn/MyWorkflow.js @@ -1606,6 +1606,7 @@ MyWorkflow.prototype.saveShape= function(oNewShape) oNewShape.id = this.workflow.newTaskInfo.uid; if(oNewShape.type == 'bpmnTask'){ oNewShape.taskName = this.workflow.newTaskInfo.label; + workflow.redrawTaskText(oNewShape,''); //After Figure is added, Update Start Event connected to Task if(typeof this.workflow.preSelectedObj != 'undefined' ) { @@ -2079,8 +2080,11 @@ MyWorkflow.prototype.saveRoute = function(preObj,newObj) newObj.conn.id = resp[1]; //replacing old gateway UID with response UID - preObj.html.id = resp[0]; - preObj.id = resp[0]; + if(! preObj.type.match(/Task/)) + { + preObj.html.id = resp[0]; + preObj.id = resp[0]; + } } } }, @@ -2167,8 +2171,6 @@ MyWorkflow.prototype.getDeleteCriteria = function() switch (shape) { case 'bpmnTask': workflow.currentSelection.actiontype = 'deleteTask'; - if(workflow.taskNo > 0) - workflow.taskNo--; break; case 'bpmnSubProcess': workflow.currentSelection.actiontype = 'deleteSubProcess'; @@ -2239,22 +2241,8 @@ MyWorkflow.prototype.zoom = function(sType) if(typeof workflow.limitFlag == 'undefined') workflow.limitFlag = 0; - var zoomFactor = 0.2; - - /*if( sType == 'in' ) - { - ++workflow.limitFlag; - } - else if(sType == 'out') - { - --workflow.limitFlag; - }*/ - -// for(var i=0;i= 6) { - // len = 1.5; - var padleft = 0.12 * fig.width; - var padtop = 0.32 * fig.height - 3; - fig.rectWidth = fig.width - 2 * padleft; - } - else { - padleft = 0.1 * fig.width; - padtop = 0.09 * fig.height - 3; - fig.rectWidth = fig.width - 2 * padleft; - } - var rectheight = fig.height - 2*padtop; - if(typeof fig.size == 'undefined') - fig.size = fig.bpmnText.ftSz.substr(0,fig.bpmnText.ftSz.length-2); - else - fig.size = fig.size; - - if(sType == 'in') - fig.size = parseInt(fig.size) + 4; - else - fig.size = parseInt(fig.size) - 4; - - //Setting font minimum limit - if(fig.size < 11) - fig.size = 11; - //workflow.zoomTaskTextSize = fig.size; - eval("fig.bpmnText.setFont('verdana','"+fig.size+"px', Font.PLAIN)"); - fig.bpmnText.drawStringRect(fig.taskName, padleft, padtop, fig.rectWidth, rectheight, 'center'); - fig.bpmnText.paint(); - } - else if(fig.type == 'bpmnAnnotation') - { - fig.bpmnText.clear(); - var text = fig.annotationName; - len = Math.ceil(text.length/16); - if(text.length < 19) - { - len = 1.5; - if(text.length > 9) - fig.rectWidth = text.length*8; - else - fig.rectWidth = 48; - } - else - fig.rectWidth = 150; - if(typeof fig.size == 'undefined') - fig.size = fig.bpmnText.ftSz.substr(0,fig.bpmnText.ftSz.length-2); - else - fig.size = fig.size; - - if(sType == 'in') - fig.size = parseInt(fig.size) + 4; - else - fig.size = parseInt(fig.size) - 4; - - //Setting font minimum limit i.e. 11px - if(fig.size < 11) - fig.size = 11; - - //workflow.zoomAnnotationTextSize = fig.size; - eval("fig.bpmnText.setFont('verdana','"+fig.size+"px', Font.PLAIN)"); - fig.bpmnText.drawStringRect(text,20,20,fig.rectWidth,'left'); - fig.bpmnText.paint(); - } + workflow.redrawTaskText(fig,sType); + } + else if(fig.type == 'bpmnAnnotation') + { + workflow.redrawAnnotationText(fig,sType); + } } } + + +MyWorkflow.prototype.redrawTaskText = function(fig,sType) +{ + fig.bpmnText.clear(); + //len = Math.ceil(this.input.value.length/16); + var len = fig.getWidth() / 18; + if (len >= 6) { + //len = 1.5; + var padleft = 0.12 * fig.getWidth(); + var padtop = 0.40 * fig.getHeight() -3; + fig.rectWidth = fig.getWidth() - 2 * padleft; + } + else { + padleft = 0.1 * fig.getWidth(); + padtop = 0.09 * fig.getHeight() -3; + fig.rectWidth = fig.getWidth() - 2 * padleft; + } + var rectheight = fig.getHeight() - padtop -7; + + if(typeof fig.size == 'undefined') + fig.size = fig.bpmnText.ftSz.substr(0,fig.bpmnText.ftSz.length-2); + else + fig.size = fig.size; + + if(sType == 'in' && sType != '') + fig.size = parseInt(fig.size) + 4; + else if(sType == 'out' && sType != '') + fig.size = parseInt(fig.size) - 4; + + //Setting font minimum limit + if(fig.size < 11) + fig.size = 11; + eval("fig.bpmnText.setFont('verdana','"+fig.size+"px', Font.PLAIN)"); + fig.bpmnText.drawStringRect(fig.taskName, padleft, padtop, fig.rectWidth, rectheight, 'center'); + fig.bpmnText.paint(); +} + +MyWorkflow.prototype.redrawAnnotationText = function(fig,sType) +{ + fig.bpmnText.clear(); + var text = fig.annotationName; + len = Math.ceil(text.length/16); + if(text.length < 19) + { + len = 1.5; + if(text.length > 9) + fig.rectWidth = text.length*8; + else + fig.rectWidth = 48; + } + else + fig.rectWidth = 150; + if(typeof fig.size == 'undefined') + fig.size = fig.bpmnText.ftSz.substr(0,fig.bpmnText.ftSz.length-2); + else + fig.size = fig.size; + + if(sType == 'in') + fig.size = parseInt(fig.size) + 4; + else + fig.size = parseInt(fig.size) - 4; + + //Setting font minimum limit i.e. 11px + if(fig.size < 11) + fig.size = 11; + + //workflow.zoomAnnotationTextSize = fig.size; + eval("fig.bpmnText.setFont('verdana','"+fig.size+"px', Font.PLAIN)"); + fig.bpmnText.drawStringRect(text,20,20,fig.rectWidth,'left'); + fig.bpmnText.paint(); +} diff --git a/workflow/engine/templates/bpmn/bpmnShapes.js b/workflow/engine/templates/bpmn/bpmnShapes.js index 9f2e45f4e..2408508ad 100755 --- a/workflow/engine/templates/bpmn/bpmnShapes.js +++ b/workflow/engine/templates/bpmn/bpmnShapes.js @@ -14,7 +14,7 @@ bpmnTask = function (_30ab) { //Setting width and height values as per the zoom ratio if(typeof workflow.zoomTaskWidth != 'undefined' || typeof workflow.zoomTaskHeight != 'undefined') this.setDimension(workflow.zoomTaskWidth, workflow.zoomTaskHeight); - this.taskName = _30ab.taskName; //It will set the Default Task Name with appropriate count While dragging a task on the canvas + this.taskName = ''; //It will set the Default Task Name with appropriate count While dragging a task on the canvas }; bpmnTask.prototype = new VectorFigure; @@ -69,9 +69,9 @@ bpmnTask.prototype.paint = function () { this.graphics.paint(); this.x_text = this.workflow.getAbsoluteX(); //Get x co-ordinate from figure this.y_text = this.workflow.getAbsoluteY(); //Get x co-ordinate from figure -/* Created New Object of jsGraphics to draw String. - * New object is created to implement changing of Text functionality - */ + /* Created New Object of jsGraphics to draw String. + * New object is created to implement changing of Text functionality + */ this.bpmnText = new jsGraphics(this.id); var len = this.getWidth() / 18; @@ -89,14 +89,13 @@ bpmnTask.prototype.paint = function () { var rectheight = this.getHeight() - padtop -7; - //Setting text size to zoom font size if Zoomed -// if(typeof workflow.zoomTaskTextSize != 'undefined') -// var fontSize = workflow.zoomTaskTextSize; -// else - var fontSize = 11; + var fontSize = 11; this.bpmnText.setFont('verdana', +fontSize+'px', Font.PLAIN); - this.bpmnText.drawStringRect(workflow.taskName, padleft, padtop, this.rectWidth, rectheight, 'center'); + if(typeof this.taskName == 'undefined') + this.taskName = ''; + + this.bpmnText.drawStringRect(this.taskName, padleft, padtop, this.rectWidth, rectheight, 'center'); // tempcoord = this.coord_converter(this.getWidth(), this.getHeight(), this.taskName.length); // bpmnText.drawTextString(this.taskName, this.getWidth(), this.getHeight(), tempcoord.temp_x, tempcoord.temp_y); @@ -772,15 +771,7 @@ bpmnTask.prototype.addShapes = function (_3896) { xOffset = _3896.workflow.currentSelection.getX() + 62; //Setting new offset value when newShape is not Task i.e aligning gateways } - /* Incrementing Task No and assigning it to a local variable - * taskNo Globally Declared in processmap.js - * taskNo will have Last Task count - * */ - if (_3896.newShapeName == 'bpmnTask') { - count = ++workflow.taskNo; - workflow.taskName = 'Task ' + count; - } - + workflow.subProcessName = 'Sub Process'; var newShape = eval("new " + _3896.newShapeName + "(_3896.workflow)"); diff --git a/workflow/engine/templates/bpmn/processmap.js b/workflow/engine/templates/bpmn/processmap.js index ae92a4683..61319faff 100755 --- a/workflow/engine/templates/bpmn/processmap.js +++ b/workflow/engine/templates/bpmn/processmap.js @@ -443,9 +443,7 @@ Ext.onReady ( function() { var yOffset = workflow.getAbsoluteY(); if(data.name == 'bpmnTask') { - count = ++workflow.taskNo; //Incrementing Task No and assigning it to a local variable workflow.boundaryEvent = false; - workflow.taskName = 'Task '+count; } @@ -463,7 +461,7 @@ Ext.onReady ( function() { { NewShape.actiontype = 'addTask'; workflow.saveShape(NewShape); //Saving Annotations when user drags and drops it - NewShape.taskName = workflow.taskName; + // NewShape.taskName = workflow.taskName; } @@ -684,7 +682,7 @@ Ext.onReady ( function() { break; } } - if(typeof(workflow.taskNo) != 'undefined') + if(typeof(workflow.taskNo) != 'undefined' && workflow.taskNo != 0) workflow.taskNo++; return shapes; }