SWF-991, SWF-1413 - Add ajax-driven flow attribute and redirect-in-same-view-state flow execution attribute

This commit is contained in:
Rossen Stoyanchev
2011-01-31 00:32:00 +00:00
parent b0e64468ae
commit 5cb3ef0067
28 changed files with 2009 additions and 122 deletions

View File

@@ -1,12 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<beansProjectDescription>
<version>1</version>
<pluginVersion><![CDATA[2.0.5.v200805032123]]></pluginVersion>
<pluginVersion><![CDATA[2.5.2.201101081000-RELEASE]]></pluginVersion>
<configSuffixes>
<configSuffix><![CDATA[xml]]></configSuffix>
</configSuffixes>
<enableImports><![CDATA[true]]></enableImports>
<configs>
<config>src/main/webapp/WEB-INF/config/data-access-config.xml</config>
<config>src/main/webapp/WEB-INF/config/security-config.xml</config>
<config>src/main/webapp/WEB-INF/config/webflow-config.xml</config>
<config>src/main/webapp/WEB-INF/config/webmvc-config.xml</config>
</configs>
<configSets>
</configSets>

View File

@@ -17,7 +17,7 @@
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
@@ -37,11 +37,6 @@
<artifactId>spring-orm</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-webflow</artifactId>

View File

@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
<secured attributes="ROLE_USER" />
xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow.xsd">
<secured attributes="ROLE_USER" />
<ajax-driven />
<input name="hotelId" required="true" />
<on-start>
<evaluate expression="bookingService.createBooking(hotelId, currentUser.name)" result="flowScope.booking" />
</on-start>
@@ -23,11 +25,17 @@
<binding property="creditCardExpiryYear" />
<binding property="amenities" />
</binder>
<on-render>
<render fragments="body" />
</on-render>
<transition on="proceed" to="reviewBooking" />
<transition on="cancel" to="cancel" bind="false" />
</view-state>
<view-state id="reviewBooking" model="booking">
<view-state id="reviewBooking" model="booking">
<on-render>
<render fragments="body" />
</on-render>
<transition on="confirm" to="bookingConfirmed">
<evaluate expression="bookingService.persistBooking(booking)" />
</transition>
@@ -36,7 +44,7 @@
</view-state>
<end-state id="bookingConfirmed"/>
<end-state id="cancel" />
</flow>

View File

@@ -27,7 +27,7 @@
</spring:bind>
</div>
</spring:hasBindErrors>
<form:form modelAttribute="booking">
<form:form modelAttribute="booking" action="${flowExecutionUrl}">
<fieldset>
<legend>Book Hotel</legend>
<div>
@@ -187,7 +187,7 @@
</p>
<script type="text/javascript">
Spring.addDecoration(new Spring.ValidateAllDecoration({elementId:'proceed', event:'onclick'}));
Spring.addDecoration(new Spring.AjaxEventDecoration({elementId:'proceed',event:'onclick',formId:'booking',params:{fragments:'body'}}));
Spring.addDecoration(new Spring.AjaxEventDecoration({elementId:'proceed',event:'onclick',formId:'booking'}));
</script>
</div>
</fieldset>

View File

@@ -15,7 +15,7 @@
</address>
</div>
<div class="span-12 last">
<form:form id="confirm" modelAttribute="booking">
<form:form id="confirm" modelAttribute="booking" action="${flowExecutionUrl}">
<fieldset>
<legend>Confirm Booking Details</legend>
<div>
@@ -49,9 +49,14 @@
</div>
</div>
<div>
<button type="submit" name="_eventId_confirm">Confirm</button>
<button type="submit" name="_eventId_revise">Revise</button>
<button type="submit" name="_eventId_cancel">Cancel</button>
<p>
<button type="submit" name="_eventId_confirm">Confirm</button>
<button type="submit" name="_eventId_revise" id="revise">Revise</button>
<button type="submit" name="_eventId_cancel">Cancel</button>
</p>
<script type="text/javascript">
Spring.addDecoration(new Spring.AjaxEventDecoration({elementId:'revise',event:'onclick',formId:'confirm'}));
</script>
</div>
</fieldset>
</form:form>