TransitionMouseListener.js
上传用户:ahit0551
上传日期:2009-04-15
资源大小:2345k
文件大小:3k
源码类别:

xml/soap/webservice

开发平台:

Java

  1. /**
  2.  * <p>Description: </p>
  3.  * <p>Copyright: Copyright (c) xio.name 2006</p>
  4.  * @author xio
  5.  */ function TransitionMouseListener(transitionModel, wrapper) {     this.transitionModel = transitionModel;     this.wrapper = wrapper; } TransitionMouseListener.prototype = new MouseListener();
  6. // TransitionMouseListener.prototype.onMouseDown = function (e) {     this.moved = false;     if (e.button != MouseEvent.BUTTON_LEFT) {         return;     }     this.down = true;     //     var state = this.wrapper.getStateMonitor().getState();     switch (state) {       case StateMonitor.SELECT:         var selectedMetaNodeModels = this.wrapper.getModel().getSelectedMetaNodeModels();         var selectedTransitionModels = this.wrapper.getModel().getSelectedTransitionModels();         if ((selectedTransitionModels.size() <= 1) && (selectedMetaNodeModels.size() <= 1) && (!e.ctrlKey)) {             this.wrapper.getModel().clearSelectedMetaNodeModels();             this.wrapper.getModel().clearSelectedTransitionModels();             this.wrapper.getModel().addSelectedTransitionModel(this.transitionModel);             //双击连接线,可以编辑连接名称             this.wrapper.setStatusInfo("u53ccu51fbu8fdeu63a5u7ebfuff0cu53efu4ee5u7f16u8f91u8fdeu63a5u540du79f0");         }         break;       case StateMonitor.TRANSITION:         break;     } }; TransitionMouseListener.prototype.onMouseMove = function (e) {     if (e.button != MouseEvent.BUTTON_LEFT) {         return;     }     if (this.down) {         this.moved = true;     } }; TransitionMouseListener.prototype.onMouseUp = function (e) {     this.down = false;     if (e.button != MouseEvent.BUTTON_LEFT) {         return;     }     //     var state = this.wrapper.getStateMonitor().getState();     switch (state) {       case StateMonitor.SELECT:         if (this.moved) {             return;         }         if (e.ctrlKey) {             if (this.transitionModel.isSelected()) {                 this.wrapper.getModel().removeSelectedTransitionModel(this.transitionModel);             } else {                 this.wrapper.getModel().addSelectedTransitionModel(this.transitionModel);             }         } else {             this.wrapper.getModel().clearSelectedMetaNodeModels();             this.wrapper.getModel().clearSelectedTransitionModels();             this.wrapper.getModel().addSelectedTransitionModel(this.transitionModel);             //双击连接线,可以编辑连接名称             this.wrapper.setStatusInfo("u53ccu51fbu8fdeu63a5u7ebfuff0cu53efu4ee5u7f16u8f91u8fdeu63a5u540du79f0");         }         break;     } };