spring-projects / spring-webflow

Spring Web Flow
https://spring.io/projects/spring-webflow
Apache License 2.0
325 stars 231 forks source link

Abstract view-state [SWF-1063] #319

Open spring-operator opened 15 years ago

spring-operator commented 15 years ago

Peter Szanto opened SWF-1063 and commented

both flows and view states can inherit from parents, but only the flows can be abstract. I think it would be useful to have abstract view states as well. Please consider the below example

<!-- This is an abstact page of adult, teen and child page -->
<view-state id="registrationPage2" model="user">
    <transition on="store" to="store" />
    <transition on="back" to="registrationPage1" bind="false" />
</view-state>

<view-state id="adultPage" model="user" view="registrationPage2" parent="register#registrationPage2">
    <on-entry>
        <set name="flowScope.ageBand" value="'Adult flow'" />
        <set name="flashScope.ageBandPage" value="'adultPage'" />
    </on-entry>
</view-state>

<view-state id="teenPage" model="user" view="registrationPage2" parent="register#registrationPage2">
    <on-entry>
        <set name="flowScope.ageBand" value="'Teen flow'" />
        <set name="flashScope.ageBandPage" value="'teenChildPage'" />
    </on-entry>
</view-state>

<view-state id="childPage" model="user" view="registrationPage2" parent="register#registrationPage2">
    <on-entry>
        <set name="flowScope.ageBand" value="'Child flow'" />
        <set name="flashScope.ageBandPage" value="'teenChildPage'" />
    </on-entry>
</view-state>

1 votes, 1 watchers

spring-operator commented 14 years ago

Russ Miles commented

I'm guessing that the following was meant by the first view-state in the sample?

\ \ \ \ \ The essence of this view-state being that it cannot be transitioned to and is simple a template of elements that can then be reused by other view-states in order to keep the flow DRY.