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

xml/soap/webservice

开发平台:

Java

  1. /**
  2.  * <p>Title:  </p>
  3.  * <p>Description: </p>
  4.  * <p>Copyright: Copyright (c) xio.name 2006</p>
  5.  * @author xio
  6.  */ function GetProcess(wrapper, tableViewer, toolbar) {     this.base = Ajax;     this.base();     this.wrapper = wrapper;     this.toolbar = toolbar;     this.tableViewer = tableViewer; } GetProcess.prototype = new Ajax(); GetProcess.prototype.setButtonEnable = function (b) {     if (this.toolbar) {         this.toolbar.setButtonEnable(b);     } }; // GetProcess.prototype.getProcess = function (name) {     if (!name) {         this.name = null;      //加载失败,工作流程图名字为空!         alert("u52a0u8f7du5931u8d25uff0cu5de5u4f5cu6d41u7a0bu56feu540du5b57u4e3au7a7auff01");         return false;     }     this.name = name;     //     this.setButtonEnable(false);     //     var url = XiorkFlowWorkSpace.URL_GET_PROCESS;     var method = "POST";     var params = "name=" + name;     //     this.loadXMLHttpRequest(url, method, params); }; GetProcess.prototype.onReadyStateChange = function (httpRequest) {     if (httpRequest.readyState == 4) {         if (httpRequest.status == 200) {             this.processXMLHttpRequest(httpRequest);         } else {          //处理过程出现错误!             alert("u5904u7406u8fc7u7a0bu51fau73b0u9519u8befuff01");             this.setButtonEnable(true);         }     } }; GetProcess.prototype.processXMLHttpRequest = function (httpRequest) {     var doc = httpRequest.responseXML;     if (!doc) {      //操作结束,未知服务器处理结果!         alert("u64cdu4f5cu7ed3u675fuff0cu672au77e5u670du52a1u5668u5904u7406u7ed3u679cuff01");         this.setButtonEnable(true);         return false;     }     //     var responseNodes = doc.getElementsByTagName("Response");     if ((responseNodes != null) && (responseNodes.length > 0)) {         var responseNode = responseNodes[0];         var statusValue = eval(responseNode.getAttribute("status"));         var alertStr = "";         switch (statusValue) {           case XiorkFlowWorkSpace.STATUS_FAIL:        //获取失败。             alertStr = "u83b7u53d6u5931u8d25u3002";             break;           case XiorkFlowWorkSpace.STATUS_XML_PARSER_ERROR:        //获取失败,xml解析出错。             alertStr = "u83b7u53d6u5931u8d25uff0cxmlu89e3u6790u51fau9519u3002";             break;           case XiorkFlowWorkSpace.STATUS_IO_ERROR:        //获取失败,IO错误。             alertStr = "u83b7u53d6u5931u8d25uff0cIOu9519u8befu3002";             break;           case XiorkFlowWorkSpace.STATUS_FILE_NOT_FOUND:        //获取失败,文件未找到。             alertStr = "u83b7u53d6u5931u8d25uff0cu6587u4ef6u672au627eu5230u3002";             break;           default:          //获取失败,未知错误。             alertStr = "u83b7u53d6u5931u8d25uff0cu672au77e5u9519u8befu3002";             break;         }         this.setButtonEnable(true);         alert(alertStr);     } else {         var editable = this.wrapper.getModel().isEditable();         var model = XiorkFlowModelConverter.convertXMLToModel(doc);         model.setName(this.name);         model.setEditable(editable);         this.wrapper.setModel(model);         this.wrapper.setChanged(false);         if (this.tableViewer) {             this.tableViewer.setModel(model);         }         this.setButtonEnable(true);     } };