From bb6c6945e41aef051993ea9b4e1d3a3cce14a3c8 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Wed, 27 Dec 2006 22:33:10 +0000 Subject: r20367: don't re-load API documentation each time the module is selected (This used to be commit 233fc754c44692034c15c82fbafbc47cc40edeb6) --- swat/apps/swat/source/class/swat/main/Main.js | 2 +- .../swat/module/documentation/Documentation.js | 3 + .../source/class/swat/module/documentation/Fsm.js | 70 ++++++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 swat/apps/swat/source/class/swat/module/documentation/Fsm.js (limited to 'swat') diff --git a/swat/apps/swat/source/class/swat/main/Main.js b/swat/apps/swat/source/class/swat/main/Main.js index 16b2dd395c..2ae58a0c61 100644 --- a/swat/apps/swat/source/class/swat/main/Main.js +++ b/swat/apps/swat/source/class/swat/main/Main.js @@ -37,7 +37,7 @@ qx.Class.modules = "gui" : null, "class" : swat.module.statistics.Statistics }, - "Documentation" : + "API Documentation" : { "canvas" : null, "fsm" : null, diff --git a/swat/apps/swat/source/class/swat/module/documentation/Documentation.js b/swat/apps/swat/source/class/swat/module/documentation/Documentation.js index 6e09733735..eba62904a7 100644 --- a/swat/apps/swat/source/class/swat/module/documentation/Documentation.js +++ b/swat/apps/swat/source/class/swat/module/documentation/Documentation.js @@ -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 index 0000000000..9df878b4f1 --- /dev/null +++ b/swat/apps/swat/source/class/swat/module/documentation/Fsm.js @@ -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; -- cgit