r20367: don't re-load API documentation each time the module is selected
authorDerrell Lipman <derrell@samba.org>
Wed, 27 Dec 2006 22:33:10 +0000 (22:33 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:30:17 +0000 (14:30 -0500)
(This used to be commit 233fc754c44692034c15c82fbafbc47cc40edeb6)

swat/apps/swat/source/class/swat/main/Main.js
swat/apps/swat/source/class/swat/module/documentation/Documentation.js
swat/apps/swat/source/class/swat/module/documentation/Fsm.js [new file with mode: 0644]

index 16b2dd395cee629e6835dbe9b460947be7f0144c..2ae58a0c615cab3a51ff4c16c4b975bf847aa39a 100644 (file)
@@ -37,7 +37,7 @@ qx.Class.modules =
       "gui"    : null,
       "class"  : swat.module.statistics.Statistics
     },
-    "Documentation" :
+    "API Documentation" :
     {
       "canvas" : null,
       "fsm"    : null,
index 6e09733735741ecc1ee354ddc3adc6c3f4ccdc34..eba62904a75b75162764f5bfb296802372abfad9 100644 (file)
@@ -46,6 +46,9 @@ qx.Proto.initialAppear = function(module)
   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);
 };
 
 
diff --git a/swat/apps/swat/source/class/swat/module/documentation/Fsm.js b/swat/apps/swat/source/class/swat/module/documentation/Fsm.js
new file mode 100644 (file)
index 0000000..9df878b
--- /dev/null
@@ -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;