summaryrefslogtreecommitdiff
path: root/webapps/swat/source/class/swat/module/documentation/Fsm.js
blob: 184b438520e060622244243cb10f5190103721cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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.main.AbstractModuleFsm,
function()
{
  swat.main.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.main.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;