0
instance.initialState = arguments.initialState;
0
- setInitialState(instance.initialState);
0
+ if(getState() eq '') {
0
+ setInitialState(instance.initialState);
0
<cfreturn invokeMethod("get#instance.stateMethod#") />
0
- <cffunction name="set
State" access="public" output="false">
0
+ <cffunction name="set
InternalState" access="public" output="false">
0
<cfargument name="state" type="string" required="true" />
0
<cfset var local = structNew() />
0
<cfset local.state = arguments.state />
0
<cfset invokeMethod("set#instance.stateMethod#", local) />
0
<cffunction name="getInitialState" access="public" returntype="string" output="false">
0
var state = instance.states[arguments.stateName];
0
- set
State(arguments.stateName);
0
+ set
InternalState(arguments.stateName);
0
1. To defined the state query handlers, i.e. isClosed()
0
2. To define the event firing shortcuts, i.e. close()
0
- 3. To pass any unknown method on to the decorated object to handle
0
+ 3. To pass any unknown method on to the decorated object to handle
0
<cffunction name="onMissingMethod" output="false" access="public">
0
<cfargument name="missingMethodName" type="string" />
0
<cfargument name="missingMethodArguments" type="struct" />
0
- Shortcut to wire up event methods, so basically if you have a
0
- 'trash' event, you can call obj.trash() rather than the longer obj.fireEvent('trash') --->
0
+ <!--- This is to highly discourage the manual setting of state.
0
+ It can still be done by getting the original object and
0
+ setting it directly. BAD. --->
0
+ <cfif arguments.missingMethodName is "set#getStateMethod()#" >
0
+ <cfthrow type="shade.InvalidStateChange" message="You cannot set the state directly. Please call an event instead to change the state." />
0
+ <!--- Shortcut to wire up event methods, so basically if you have a
0
+ 'trash' event, you can call obj.trash() rather than the longer
0
+ obj.fireEvent('trash') --->
0
<cfif structKeyExists(instance.eventTable, arguments.missingMethodName)>
0
<cfreturn fireEvent(arguments.missingMethodName) />