summaryrefslogtreecommitdiff
path: root/webapps
diff options
context:
space:
mode:
Diffstat (limited to 'webapps')
-rw-r--r--webapps/swat/source/class/swat/main/AbstractModuleFsm.js8
-rw-r--r--webapps/swat/source/class/swat/main/Authenticate.js43
-rw-r--r--webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js23
-rw-r--r--webapps/swat/source/class/swat/module/statistics/Fsm.js11
4 files changed, 58 insertions, 27 deletions
diff --git a/webapps/swat/source/class/swat/main/AbstractModuleFsm.js b/webapps/swat/source/class/swat/main/AbstractModuleFsm.js
index fed11eb0d3..8c11c7fadf 100644
--- a/webapps/swat/source/class/swat/main/AbstractModuleFsm.js
+++ b/webapps/swat/source/class/swat/main/AbstractModuleFsm.js
@@ -119,7 +119,6 @@ qx.Proto.addAwaitRpcResultState = function(module)
{
bAuthCompleted = true;
}
-_this.debug("bAuthCompleted=" + bAuthCompleted);
// If we didn't just complete an authentication and we're coming
// from some other state...
@@ -127,7 +126,6 @@ _this.debug("bAuthCompleted=" + bAuthCompleted);
fsm.getPreviousState() != "State_AwaitRpcResult")
{
// ... then push the previous state onto the state stack
-_this.warn("PUSHING STATE");
fsm.pushState(false);
}
},
@@ -203,8 +201,10 @@ _this.warn("PUSHING STATE");
}
// Retrieve the modal authentication window.
+ var loginWin = swat.main.Authenticate.getInstance();
- var loginWin = swat.main.Authenticate.getInstance(module);
+ // Ensure that it's saved in the current finite state machine
+ loginWin.addToFsm(fsm);
// Set the caption
loginWin.setCaption(caption);
@@ -310,7 +310,7 @@ _this.warn("PUSHING STATE");
function(fsm, event)
{
// Retrieve the login window object
- var win = module.fsm.getObject("login_window");
+ var win = fsm.getObject("login_window");
// Clear the password field
win.password.setValue("");
diff --git a/webapps/swat/source/class/swat/main/Authenticate.js b/webapps/swat/source/class/swat/main/Authenticate.js
index 449a17d9ad..d586ea1f4a 100644
--- a/webapps/swat/source/class/swat/main/Authenticate.js
+++ b/webapps/swat/source/class/swat/main/Authenticate.js
@@ -11,10 +11,9 @@
* Swat authentication window class
*/
qx.OO.defineClass("swat.main.Authenticate", qx.ui.window.Window,
-function(module)
+function()
{
var o;
- var fsm = module.fsm;
qx.ui.window.Window.call(this);
@@ -101,25 +100,35 @@ function(module)
return new qx.ui.form.Button("Login");
});
- // Save this login button since we receive events on it
- fsm.addObject("login_button", this.login);
-
- // We want to receive "execute" events on this button
- this.login.addEventListener("execute", fsm.eventListener, fsm);
-
// Add the grid to the window
this.add(grid);
// Add this window to the document
this.addToDocument();
+});
+
+
+qx.Proto.addToFsm = function(fsm)
+{
+ // Have we already been here for this fsm?
+ if (fsm.getObject("login_window"))
+ {
+ // Yup. Everything's already done. See ya!
+ return;
+ }
+
+ // Save the login button since we receive events on it
+ fsm.addObject("login_button", this.login);
+
+ // We want to receive "execute" events on this button
+ this.login.addEventListener("execute", fsm.eventListener, fsm);
- // Save this window object
+ // Save the window object
fsm.addObject("login_window", this);
- // We want to receive "complete" events on this button (which we generate)
+ // We want to receive "complete" events on this window (which we generate)
this.addEventListener("complete", fsm.eventListener, fsm);
-});
-
+};
qx.Proto.setInfo = function(info)
@@ -141,12 +150,4 @@ qx.Proto.setInfo = function(info)
/**
* Singleton Instance Getter
*/
-qx.Class.getInstance = function(module)
-{
- if (! this._instance)
- {
- this._instance = new this(module);
- }
-
- return this._instance;
-};
+qx.Class.getInstance = qx.util.Return.returnInstance;
diff --git a/webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js b/webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js
index 4ddc018595..d24f156e4f 100644
--- a/webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js
+++ b/webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js
@@ -47,7 +47,28 @@ qx.Proto.buildFsm = function(module)
// Display the result
var gui = swat.module.ldbbrowse.Gui.getInstance();
- gui.displayData(module, rpcRequest);
+
+ // Did we get a Resource Not Found error? We'll get this after a
+ // session timeout, because the request is retried but can't
+ // succeed because the database has been closed by the session
+ // timing out.
+ var result = rpcRequest.getUserData("result");
+ var origins = swat.main.AbstractModuleFsm.JsonRpc_Origin;
+ var serverErrors = swat.main.AbstractModuleFsm.JsonRpc_ServerError;
+ if (result.type == "failed" &&
+ result.data.origin == origins.Server &&
+ result.data.code == serverErrors.ResourceError)
+ {
+ // Yup. Re-open the database
+ var dbName = fsm.getObject("dbName");
+ dbName.dispatchEvent(new qx.event.type.Event("changeSelection"),
+ true);
+ }
+ else
+ {
+ // Otherwise, display the result
+ gui.displayData(module, rpcRequest);
+ }
// Dispose of the request
rpcRequest.request.dispose();
diff --git a/webapps/swat/source/class/swat/module/statistics/Fsm.js b/webapps/swat/source/class/swat/module/statistics/Fsm.js
index b60501512a..3ecb42a49d 100644
--- a/webapps/swat/source/class/swat/module/statistics/Fsm.js
+++ b/webapps/swat/source/class/swat/module/statistics/Fsm.js
@@ -19,6 +19,9 @@ function()
qx.Class._startTimer = function(fsm)
{
+ // First, for good house keeping, ensure no timer exists
+ swat.module.statistics.Fsm._stopTimer(fsm);
+
// Create a timer instance to expire in a few seconds
var timer = new qx.client.Timer(5000);
timer.addEventListener("interval", fsm.eventListener, fsm);
@@ -46,6 +49,7 @@ qx.Proto.buildFsm = function(module)
{
var fsm = module.fsm;
var _this = this;
+ var _module = module;
/*
* State: Idle
@@ -78,7 +82,10 @@ qx.Proto.buildFsm = function(module)
rpcRequest.request = null;
// Restart the timer.
- swat.module.statistics.Fsm._startTimer(fsm);
+ if (_module.visible)
+ {
+ swat.module.statistics.Fsm._startTimer(fsm);
+ }
}
},
@@ -164,6 +171,7 @@ qx.Proto.buildFsm = function(module)
"ontransition" :
function(fsm, event)
{
+ _module.visible = true;
swat.module.statistics.Fsm._startTimer(fsm);
}
});
@@ -186,6 +194,7 @@ qx.Proto.buildFsm = function(module)
"ontransition" :
function(fsm, event)
{
+ _module.visible = false;
swat.module.statistics.Fsm._stopTimer(fsm);
}
});