svn commit: samba r20601 - in
branches/SAMBA_4_0/webapps/swat/source/class/swat: main
module/ldbbrowse module/statistics
derrell at samba.org
derrell at samba.org
Mon Jan 8 04:58:04 GMT 2007
Author: derrell
Date: 2007-01-08 04:58:04 +0000 (Mon, 08 Jan 2007)
New Revision: 20601
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20601
Log:
Web Application Framework
More testing revealed that this isn't yet bug-free... Sigh. One of these
days I'll start writing bug-free software...
- Status and Statistics timer wasn't always stopped properly when switching
away from that module's display. It seems silly to continue to update
status and statistics when the page isn't being viewed.
- Single instance of the Login window was not accessible if one switched
between modules.
- Upon return from a Session Timeout, we can retry the original RPC request,
but it may fail due to information that was stored in the old session. This
was the case in the LDB Browser module, where the open database handle
became gone with the session. We now detect a Resource Not Found and
re-open the database.
Modified:
branches/SAMBA_4_0/webapps/swat/source/class/swat/main/AbstractModuleFsm.js
branches/SAMBA_4_0/webapps/swat/source/class/swat/main/Authenticate.js
branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js
branches/SAMBA_4_0/webapps/swat/source/class/swat/module/statistics/Fsm.js
Changeset:
Modified: branches/SAMBA_4_0/webapps/swat/source/class/swat/main/AbstractModuleFsm.js
===================================================================
--- branches/SAMBA_4_0/webapps/swat/source/class/swat/main/AbstractModuleFsm.js 2007-01-07 23:06:50 UTC (rev 20600)
+++ branches/SAMBA_4_0/webapps/swat/source/class/swat/main/AbstractModuleFsm.js 2007-01-08 04:58:04 UTC (rev 20601)
@@ -119,7 +119,6 @@
{
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 @@
fsm.getPreviousState() != "State_AwaitRpcResult")
{
// ... then push the previous state onto the state stack
-_this.warn("PUSHING STATE");
fsm.pushState(false);
}
},
@@ -203,8 +201,10 @@
}
// 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 @@
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("");
Modified: branches/SAMBA_4_0/webapps/swat/source/class/swat/main/Authenticate.js
===================================================================
--- branches/SAMBA_4_0/webapps/swat/source/class/swat/main/Authenticate.js 2007-01-07 23:06:50 UTC (rev 20600)
+++ branches/SAMBA_4_0/webapps/swat/source/class/swat/main/Authenticate.js 2007-01-08 04:58:04 UTC (rev 20601)
@@ -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,27 +100,37 @@
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();
+});
- // Save this window object
+
+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 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)
{
this.debug(info);
@@ -141,12 +150,4 @@
/**
* 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;
Modified: branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js
===================================================================
--- branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js 2007-01-07 23:06:50 UTC (rev 20600)
+++ branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js 2007-01-08 04:58:04 UTC (rev 20601)
@@ -47,8 +47,29 @@
// 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();
rpcRequest.request = null;
Modified: branches/SAMBA_4_0/webapps/swat/source/class/swat/module/statistics/Fsm.js
===================================================================
--- branches/SAMBA_4_0/webapps/swat/source/class/swat/module/statistics/Fsm.js 2007-01-07 23:06:50 UTC (rev 20600)
+++ branches/SAMBA_4_0/webapps/swat/source/class/swat/module/statistics/Fsm.js 2007-01-08 04:58:04 UTC (rev 20601)
@@ -19,6 +19,9 @@
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 @@
{
var fsm = module.fsm;
var _this = this;
+ var _module = module;
/*
* State: Idle
@@ -78,7 +82,10 @@
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 @@
"ontransition" :
function(fsm, event)
{
+ _module.visible = true;
swat.module.statistics.Fsm._startTimer(fsm);
}
});
@@ -186,6 +194,7 @@
"ontransition" :
function(fsm, event)
{
+ _module.visible = false;
swat.module.statistics.Fsm._stopTimer(fsm);
}
});
More information about the samba-cvs
mailing list