Announcement Announcement Module
Collapse
No announcement yet.
Global transitions Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Global transitions

    For 1.0 RC1 we've also added support for "global" transitions; that is, the ability to configure one or more transitions at the flow level that are eligible for matching if a transition cannot be matched on the occurence of an event in the current state.

    This effectively means these transitions are shared by all states of the flow, useful mainly for supporting global navigation-menu like functions.

    Sellitem has been updated to illustrate this capability, with a "Preview Sale" button added to every form that, when pressed, signals an event matched by a global "preview" transition.

    Here's the complete flow definition from the sellitem sample demonstrating this:

    HTML Code:
    <flow start-state="enterPriceAndItemCount">
        ...
        <global-transitions>
            <transition on="preview" to="showCostOverview"/>
        </global-transitions>
        ...
    </flow>
    Comments/feedback are welcome. Do you like the name "global" to describe this? We considered just "transitions" but decided a qualifier made the fact these transitions are logically shared by all states more explicit.

    Thanks,

    Keith
    Last edited by Keith Donald; Feb 3rd, 2006, 12:29 AM.

  • #2
    ...the ability to configure one or more transitions at the flow level that are eligible for matching if a transition cannot be matched on the occurence of an event in the current state.
    It appears that you are differentiating between 'flow level' transitions and 'state level' transitions (events that occurrs in the current state). So, I am thinking flow-transitions seems logical.

    _Curtney

    Comment


    • #3
      Yeah, I considered that. I decided not to go with it as it's redundant with the "flow" root element.

      At the API level it's just flow.addTransition(Transition), which I quite like. Perhaps <transitions> is good enough in the XML.

      eith

      Comment


      • #4
        After additional discussion, we're sticking with "global-transitions" :-)

        Keith

        Comment


        • #5
          Perhaps adding helper methods for global transitions in AbstractFlowBuilder?


          Code:
           
           
           
           
          
          protected void addGlobalTransition (Transition transition) {
          addGlobalTransitions (new Transition[] {transition});
          } protected void addGlobalTransitions (Transition[] transitions) {
          getFlow().getGlobalTransitionSet().addAll(transition);
          }
          _Curtney

          Comment


          • #6
            Originally posted by Keith Donald
            Comments/feedback are welcome. Do you like the name "global" to describe this? We considered just "transitions" but decided a qualifier made the fact these transitions are logically shared by all states more explicit.
            My 2 cents (not sure this comment is worth 2 cents actually ): I prefer the name "common" or "shared" transitions.

            BTW; can you override these on the state-level, i.e. :

            Code:
            <flow start-state="enterPriceAndItemCount">
              <global-transitions>
                <transition on="preview" to="showCostOverview"/>
              </global-transitions>
            
              <some-state id="xyz">
                <transition on="preview" to="anotherPlace"/>
              </some-state>
            </flow>

            If this is true (they can be overridden) then I would suggest "default" transitions would be more appropriate.

            Comment


            • #7
              Mmmm... default might be a good name. Yes they are effectively inherited by all states and overridable... which also makes global a good name, too IMO.

              Keith
              Last edited by Keith Donald; Feb 4th, 2006, 05:17 PM.

              Comment


              • #8
                Then I would suggest "default" as it implies both the coverage and ability to override.

                Global does not imply that they can be overridden.

                Just my thoughts.

                Comment


                • #9
                  A late comment
                  To me global implies they would be accessible by any flow.
                  Why not flow-transitions, in opposite to (state-)transitions.

                  Regardless of the naming this is a good feature!!

                  Comment


                  • #10
                    &lt;global-transitions&gt; for multiple subflow XMLs

                    Well, if there are many subflow XMLs, then is it able to compose an XML file for the <global-transitions>, and then include the file to each subflow XMLs?

                    Comment


                    • #11
                      Hi,

                      yes you can use an EntityReolver which reolves the particular XML entitys. Have a look here

                      http://opensource.atlassian.com/proj...browse/SWF-102

                      In Spring Webflow 1.1 you will have the ability to use flow inheritance (IMHO one of the most interesting features in 1.1), have a look at this JIRA

                      http://opensource.atlassian.com/proj.../browse/SWF-94

                      Best regards
                      agim

                      Comment


                      • #12
                        The fix seems not work with Spring Webflow 1.0.4 and Spring Framework 2.0

                        Hi agim, Thank for your reply.

                        I've test the fix (all 2 XmlWithInheritanceFlowBuilder.zip) but it gives compilation errors when I build the project (the class method dose not match with the interface).

                        I'm currently using Spring Webflow 1.0.4 and Spring Framework 2.0, not sure is it related to the errors.

                        As I'm so new to the Spring, so it seems that I better to wait for the release of Webflow 1.1.

                        By the way, is it able to tell the view-state to ignore the global transitions in coming release of Webflow (Since I've encounter some view-state in my project which dose not apply the global-transition) ? Thanks

                        Comment


                        • #13
                          Hello,

                          By the way, is it able to tell the view-state to ignore the global transitions in coming release of Webflow (Since I've encounter some view-state in my project which dose not apply the global-transition) ?
                          i am not aware of this feature in the upcoming release. AFAIK one way to ignore gloabl transitions is to use one asterisk (*) transition as the last one in the view state, which will be called before any global transition.

                          Best regards
                          agim

                          Comment


                          • #14
                            I am a newbie at using Spring Webflow (2.3). I am trying to use Global transitions. In my jsp I am trying to display all the transitions using

                            <c:forEach var="transition" items="${flowRequestContext.currentState.transitio ns}">
                            <c:out value="${transition.id}"/>
                            </c:forEach>

                            I can see all the transitions for the currentState but I cannot see the global transitions.

                            My understanding was the global transitions would be available in all the view-states. To get the global transitions do I need to access it in a different way?

                            Here is a simplified version of my flow xml

                            <flow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                            xmlns="http://www.springframework.org/schema/webflow"
                            xsi:schemaLocation="http://www.springframework.org/schema/webflow
                            http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">

                            <view-state id="state1" view="view1.jsp" model="person">
                            <transition on="submit" to="state2"/>
                            <transition on="cancel" to="canceled"/>
                            </view-state>

                            <view-state id="state2" view="view1.jsp" model="person">
                            <transition on="complete" to="complete"/>
                            </view-state>

                            <view-state id="canceled" view="view1.jsp" model="person">
                            <transition on="resubmit" to="resubmit"/>
                            </view-state>

                            <action-state id="reassign">
                            <evaluate expression="CustomAction.reassign(flowRequestConte xt)"/>
                            </action-state>

                            <end-state id="complete"/>

                            <global-transitions>
                            <transition on="cancel" to="canceled"/>
                            <transition on="reassign" to="reassign"/>
                            </global-transitions>

                            </flow>

                            So when in state1 in the jsp how canI display all the tranistions including global?

                            Thanks for any help in advance

                            Comment

                            Working...
                            X