svn commit: samba r20367 - in branches/SAMBA_4_0/swat/apps/swat/source/class/swat: main module/documentation

derrell at samba.org derrell at samba.org
Wed Dec 27 22:33:10 GMT 2006


Author: derrell
Date: 2006-12-27 22:33:10 +0000 (Wed, 27 Dec 2006)
New Revision: 20367

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20367

Log:
don't re-load API documentation each time the module is selected
Added:
   branches/SAMBA_4_0/swat/apps/swat/source/class/swat/module/documentation/Fsm.js
Modified:
   branches/SAMBA_4_0/swat/apps/swat/source/class/swat/main/Main.js
   branches/SAMBA_4_0/swat/apps/swat/source/class/swat/module/documentation/Documentation.js


Changeset:
Modified: branches/SAMBA_4_0/swat/apps/swat/source/class/swat/main/Main.js
===================================================================
--- branches/SAMBA_4_0/swat/apps/swat/source/class/swat/main/Main.js	2006-12-27 21:25:18 UTC (rev 20366)
+++ branches/SAMBA_4_0/swat/apps/swat/source/class/swat/main/Main.js	2006-12-27 22:33:10 UTC (rev 20367)
@@ -37,7 +37,7 @@
       "gui"    : null,
       "class"  : swat.module.statistics.Statistics
     },
-    "Documentation" :
+    "API Documentation" :
     {
       "canvas" : null,
       "fsm"    : null,

Modified: branches/SAMBA_4_0/swat/apps/swat/source/class/swat/module/documentation/Documentation.js
===================================================================
--- branches/SAMBA_4_0/swat/apps/swat/source/class/swat/module/documentation/Documentation.js	2006-12-27 21:25:18 UTC (rev 20366)
+++ branches/SAMBA_4_0/swat/apps/swat/source/class/swat/module/documentation/Documentation.js	2006-12-27 22:33:10 UTC (rev 20367)
@@ -46,6 +46,9 @@
   var viewer = new api.Viewer();
   module.canvas.add(viewer);
   viewer.load("script/data.js");
+
+  // Replace the existing (temporary) finite state machine with a null one
+  swat.module.documentation.Fsm.getInstance().buildFsm(module);
 };
 
 

Added: branches/SAMBA_4_0/swat/apps/swat/source/class/swat/module/documentation/Fsm.js
===================================================================
--- branches/SAMBA_4_0/swat/apps/swat/source/class/swat/module/documentation/Fsm.js	2006-12-27 21:25:18 UTC (rev 20366)
+++ branches/SAMBA_4_0/swat/apps/swat/source/class/swat/module/documentation/Fsm.js	2006-12-27 22:33:10 UTC (rev 20367)
@@ -0,0 +1,70 @@
+/*
+ * Copyright:
+ *   (C) 2006 by Derrell Lipman
+ *       All rights reserved
+ *
+ * License:
+ *   LGPL 2.1: http://creativecommons.org/licenses/LGPL/2.1/
+ */
+
+/**
+ * Swat statistics class finite state machine
+ */
+qx.OO.defineClass("swat.module.documentation.Fsm",
+                  swat.module.AbstractModuleFsm,
+function()
+{
+  swat.module.AbstractModuleFsm.call(this);
+});
+
+
+qx.Proto.buildFsm = function(module)
+{
+  var fsm = module.fsm;
+
+  /*
+   * State: Idle
+   *
+   *   This is a null state to replace the one that loads the API viewer.  The
+   *   API viewer does not use the finite state machine.
+   */
+  var state = new qx.util.fsm.State(
+    "State_Idle",
+    {
+      "events" :
+        {
+          // We need at least one event listed due to FSM requirements
+          "appear" :
+          {
+            "swat.module.canvas" :
+              "Transition_Idle_to_Idle_via_appear"
+          }
+        }
+    });
+
+  // Replace the initial Idle state with this one
+  fsm.replaceState(state, true);
+
+  /*
+   * Transition: Idle to Idle
+   *
+   * Cause: "appear" on canvas
+   *
+   * Action:
+   *  None.
+   */
+  var trans = new qx.util.fsm.Transition(
+    "Transition_Idle_to_Idle_via_appear",
+    {
+      "nextState" :
+        "State_Idle"
+    });
+  state.addTransition(trans);
+
+};
+
+
+/**
+ * Singleton Instance Getter
+ */
+qx.Class.getInstance = qx.util.Return.returnInstance;



More information about the samba-cvs mailing list