BPMN Designer: adding selection listener to task figures

This commit is contained in:
Erik Amaru Ortiz
2011-03-09 16:56:24 +00:00
parent 036a3e0f55
commit f515e79488
2 changed files with 29 additions and 2 deletions

View File

@@ -188,6 +188,9 @@ Ext.onReady(function(){
workflow = new MyWorkflow("paintarea");
workflow.setEnableSmoothFigureHandling(false);
//workflow.scrollArea.width = 2000;
var listener = new SelectionListener1(workflow);
workflow.addSelectionListener(listener);
if(typeof pro_uid !== 'undefined') {
Ext.Ajax.request({
@@ -899,3 +902,24 @@ Ext.onReady(function(){
}
});
//erik: selection Listener
SelectionListener1 = function(_43b1){
this.workflow = _43b1;
this.lastSelectedItem = null;
};
SelectionListener1.prototype.type = "SelectionListener1";
SelectionListener1.prototype.onSelectionChanged = function(_43b2) {
if (this.lastSelectedItem !== this.workflow.currentSelection.id ) {
if( this.workflow.currentSelection.type == 'bpmnTask' || this.workflow.currentSelection.type == 'bpmnSubProcess' ) {
this.lastSelectedItem = this.workflow.currentSelection.id;
console.log('selecting task: '+this.workflow.currentSelection.taskName);
//erik: to set selected the respective node on eastTreePanel
var currEatTreeNode = Ext.getCmp('eastPanelTree').getNodeById(this.workflow.currentSelection.id);
if( typeof currEatTreeNode != 'undefined' )
currEatTreeNode.select();
}
}
};

View File

@@ -497,7 +497,11 @@ propertiesGrid.on('afteredit', function afterEdit(r) {
} else if( type == 'task' && r.record.data.name == 'Title') {
Ext.getCmp('eastPanelTree').getNodeById(UID).setText(r.value);
//here we need to find and update the task title into task figure on designer
//if the current selection is the same node editing the title property
if( workflow.currentSelection.id == UID ) {
workflow.currentSelection.taskName = r.value;
}
}
},
failure: function(){
@@ -923,7 +927,6 @@ usersTaskStore = new Ext.data.GroupingStore( {
if( result.success ) {
PMExt.notify(_('ID_RESPONSABILITIES_ASSIGNMENT'), result.msg);
Ext.getCmp('eastPanel').show();
Ext.getCmp('usersPanelTabs').getTabEl('usersTaskGrid').style.display = '';
Ext.getCmp('usersPanelTabs').getTabEl('usersTaskAdHocGrid').style.display = '';