6 * Common facilities for modules' finite state machines. Each module's FSM
7 * should extend this class.
9 qx.OO.defineClass("swat.module.AbstractModuleFsm", qx.core.Object, function()
11 qx.core.Object.call(this);
15 qx.Proto.buildFsm = function(module)
17 throw new Error("Module must overload buildFsm() " +
18 "to build its custom finite state machine.");
21 qx.Proto.addAwaitRpcResultState = function(module)
26 * State: AwaitRpcResult
29 * - enable any objects in group "swat.module.fsmUtils.enable_during_rpc"
30 * - disable any objects in group "swat.module.fsmUtils.disable_during_rpc"
33 * - disable any objects in group "group_enable_during_rpc"
34 * - enable any objects in group "group_disable_during_rpc"
37 * "completed" (on RPC)
39 * "execute" on swat.module.fsmUtils.abort_rpc
41 var state = new qx.util.fsm.State(
42 "State_AwaitRpcResult",
44 "autoActionsBeforeOnentry" :
46 // The name of a function.
50 // We want to enable objects in the group
51 // swat.module.fsmUtils.enable_during_rpc
52 "parameters" : [ true ],
54 // Call this.getObject(<object>).setEnabled(true) on
55 // state entry, for each <object> in the group called
56 // "swat.module.fsmUtils.enable_during_rpc".
57 "groups" : [ "swat.module.fsmUtils.enable_during_rpc" ]
61 // We want to disable objects in the group
62 // swat.module.fsmUtils.disable_during_rpc
63 "parameters" : [ false ],
65 // Call this.getObject(<object>).setEnabled(false) on
66 // state entry, for each <object> in the group called
67 // "swat.module.fsmUtils.disable_during_rpc".
68 "groups" : [ "swat.module.fsmUtils.disable_during_rpc" ]
73 "autoActionsBeforeOnexit" :
75 // The name of a function.
79 // We want to re-disable objects we had enabled, in the group
80 // swat.module.fsmUtils.enable_during_rpc
81 "parameters" : [ false ],
83 // Call this.getObject(<object>).setEnabled(false) on
84 // state entry, for each <object> in the group called
85 // "swat.module.fsmUtils.enable_during_rpc".
86 "groups" : [ "swat.module.fsmUtils.enable_during_rpc" ]
90 // We want to re-enable objects we had disabled, in the group
91 // swat.module.fsmUtils.disable_during_rpc
92 "parameters" : [ true ],
94 // Call this.getObject(<object>).setEnabled(true) on
95 // state entry, for each <object> in the group called
96 // "swat.module.fsmUtils.disable_during_rpc".
97 "groups" : [ "swat.module.fsmUtils.disable_during_rpc" ]
106 "swat.module.fsmUtils.abort_rpc" :
107 "Transition_AwaitRpcResult_to_AwaitRpcResult_via_button_abort"
111 "Transition_AwaitRpcResult_to_Idle_via_complete",
114 "Transition_AwaitRpcResult_to_Idle_via_failed"
120 * Transition: AwaitRpcResult to AwaitRpcResult
122 * Cause: "execute" on swat.module.fsmUtils.abort_rpc
124 var trans = new qx.util.fsm.Transition(
125 "Transition_AwaitRpcResult_to_AwaitRpcResult_via_button_abort",
128 "State_AwaitRpcResult",
133 // Get the request object
134 var request = fsm.getObject("swat.module.fsmUtils.request");
136 // Issue an abort for the pending request
140 state.addTransition(trans);
143 * Transition: AwaitRpcResult to Idle
145 * Cause: "complete" (on RPC)
147 var trans = new qx.util.fsm.Transition(
148 "Transition_AwaitRpcResult_to_Idle_via_complete",
156 // Get the request object
157 var request = fsm.getObject("swat.module.fsmUtils.request");
159 // Generate the result for a completed request
163 data : event.getData()
167 state.addTransition(trans);
170 * Transition: AwaitRpcResult to Idle
172 * Cause: "failed" (on RPC)
174 var trans = new qx.util.fsm.Transition(
175 "Transition_AwaitRpcResult_to_Idle_via_failed",
183 // Get the request object
184 var request = fsm.getObject("swat.module.fsmUtils.request");
186 // Generate the result for a completed request
190 data : event.getData()
194 state.addTransition(trans);
199 * Singleton Instance Getter
201 qx.Class.getInstance = qx.util.Return.returnInstance;