]>
git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/slc/web/util/RequestManager.js
1 qx
.Class
.define("org.argeo.slc.web.util.RequestManager",
4 extend
: qx
.core
.Object
,
6 construct : function(){
12 setStopCommand : function(stopCommand
){
13 this.command
= stopCommand
;
16 getRequest : function(url
, method
, responseType
){
17 var request
= new qx
.io
.remote
.Request(url
, method
, responseType
);
19 request.addListener("sending", function(event){
20 this.requestCreated(request);
22 request.addListener("aborted", function(event){
23 this.requestAborted(request);
25 request.addListener("failed", function(event){
26 this.requestFailed(request);
28 request.addListener("timeout", function(event){
29 this.requestTimeout(request);
31 request.addListener("completed", function(event){
32 this.requestCompleted(request);
35 this.enableCommand(request
);
39 requestCreated : function(req
){
40 this.enableCommand(req
);
43 requestAborted : function(req
){
44 this.disableCommand();
47 requestFailed : function(req
){
48 this.disableCommand();
51 requestTimeout : function(req
){
52 this.disableCommand();
55 requestCompleted : function(req
){
56 this.disableCommand();
59 disableCommand : function(){
60 this.command
.setEnabled(false);
61 var manager
= qx
.event
.Registration
.getManager(this.command
);
62 manager
.removeAllListeners(this.command
);
65 enableCommand : function(request
){
66 this.command
.setEnabled(true);
67 qx
.ui
.core
.queue
.Manager
.flush();
68 this.command
.addListener("execute", function(){