| ASF |
#477933 |
Tue Nov 21 22:27:01 UTC 2006 |
rahul |
Allow use of redirects with Shale dialogs when using Commons SCXML implementation.
This is done by defining a custom Commons SCXML action (local name "redirect") which communicates with the SCXMLDialogContext via a DialogProperties instance cached in the state machine's root context under a well-known key.
Example SCXML snippet:
<scxml xmlns="http://www.w3.org/2005/07/scxml"
xmlns:shale="http://shale.apache.org/dialog-scxml"
...>
<!-- "view" state which needs to use a redirect -->
<state id="page1">
<onentry>
<shale:redirect/>
</onentry>
...
</state>
SHALE-337
This is also a general recipe for Shale dialog domain specific tweaks using custom SCXML actions. The dialog configuration file is a compound document with multiple namespaces:
* The SCXML namespace provides the state machine abstraction and a set of "standard" actions (var, assign, if etc.)
* The Shale dialogs custom SCXML actions namespace, which contains actions defined out-of-the-box by the shale-dialog-scxml library (currently, just <redirect>)
* Potentially other namespaces by developers (might be application specific or merely repeatable actions that are not in the shale-dialog-scxml library) -- it will be similarly possible (via state machine's root context) to make the current FacesContext available to custom actions, greatly improving their capabilities in the context of Shale dialogs
Furthermore, the example above can be further tweaked, such as:
<scxml:if cond="...">
<shale:redirect/>
</scxml:if>
where the custom action is conditionally invoked (thats probably of limited use for the redirection scenario, but potentially that could be a <shale:foo/> where it makes sense to do "foo" conditionally).
Finally, its possible to use custom actions as one exits a state (descendent of <onexit>) or as one transitions across states (descendent of <transition>) for further control over their invocation.
|