ajax handling fixes

This commit is contained in:
Keith Donald
2008-03-07 19:19:47 +00:00
parent 78c1d46235
commit 02f5cd103b
8 changed files with 121 additions and 148 deletions

View File

@@ -48,21 +48,19 @@ public class SearchCriteria implements Serializable {
this.page = page;
}
/**
* Increase the current page
*/
public void nextPage() {
page++;
}
/**
* Decrease the current page
*/
public void previousPage() {
page--;
}
public void resetPage() {
page = 0;
}
public String toString() {
return "searchString = '" + searchString + "'";
return "[Search Criteria searchString = '" + searchString + "'";
}
}

View File

@@ -120,7 +120,7 @@
</div>
<div class="buttonGroup">
<sf:validateAllOnClick>
<h:commandButton id="proceed" action="proceed" value="Proceed"/>
<h:commandButton id="proceed" action="proceed" value="Proceed"/>&#160;
</sf:validateAllOnClick>
<h:commandButton id="cancel" immediate="true" value="Cancel" action="cancel"/>
</div>

View File

@@ -38,7 +38,7 @@
</ui:fragment>
<ui:fragment id="bookingsFragment">
<div class="section">
<div id="bookingsSection" class="section">
<h:form id="bookingsForm">
<h2>Current Hotel Bookings</h2>
<h:outputText value="No Bookings Found" rendered="#{bookings.rowCount == 0}"/>
@@ -69,7 +69,7 @@
</h:column>
<h:column>
<f:facet name="header">Action</f:facet>
<sf:commandLink id="cancel" value="Cancel" ajaxEnabled="false" processIds="bookingsFragment" action="cancelBooking"/>
<sf:commandLink id="cancel" value="Cancel" processIds="bookingsFragment" action="cancelBooking"/>
</h:column>
</h:dataTable>
</h:form>

View File

@@ -12,6 +12,7 @@
<transition on="search" to="reviewHotels" />
<transition on="cancelBooking">
<evaluate expression="bookingService.cancelBooking(bookings.selectedRow)" />
<render fragments="bookingsFragment"/>
</transition>
</view-state>
@@ -21,11 +22,11 @@
</on-render>
<transition on="previous">
<evaluate expression="searchCriteria.previousPage()" />
<render fragments="searchResultsFragment" />
<render fragments="hotels:searchResultsFragment" />
</transition>
<transition on="next">
<evaluate expression="searchCriteria.nextPage()" />
<render fragments="searchResultsFragment" />
<render fragments="hotels:searchResultsFragment" />
</transition>
<transition on="select" to="reviewHotel" />
<transition on="changeSearch" to="changeSearchCriteria" />
@@ -49,7 +50,9 @@
<on-entry>
<render fragments="hotelSearchFragment" />
</on-entry>
<transition on="search" to="reviewHotels" />
<transition on="search" to="reviewHotels">
<evaluate expression="searchCriteria.resetPage()"/>
</transition>
</view-state>
<end-state id="finish" />

View File

@@ -44,19 +44,19 @@
</div>
</div>
<!--This is here only to get state saving to run -->
<h:form id="stateWriter"> </h:form>
<div class="section">
<!--This is a temporary workaround as spring-security 2.0-M2 is not forwarding to the correct URL when using a POST -->
<form id="hotel" method="GET">
<!-- Use of a plain form element instead of the h:form component is a temporary workaround as spring-security 2.0-M2 is not forwarding to the correct URL when using a post -->
<form id="hotel" method="get">
<input name="execution" type="hidden" value="${requestContext.flowExecutionContext.key}"/>
<fieldset class="buttonGroup">
<sf:commandButton id="book" ajaxEnabled="false" action="book" value="Book Hotel"/>
<sf:commandButton id="book" ajaxEnabled="false" action="book" value="Book Hotel"/>&#160;
<sf:commandButton id="cancel" ajaxEnabled="false" action="cancel" value="Back to Search"/>
</fieldset>
</form>
</div>
<!--Only used to enable view state saving with Facelets due to spring-security workaround above -->
<h:form id="hotel_stateSaving"></h:form>
</ui:define>
</ui:composition>

View File

@@ -8,7 +8,7 @@
<ui:define name="content">
<h:form id="displayHotelsForm">
<h:form id="hotels">
<div class="section">
<h2>Hotel Results</h2>
<p>
@@ -42,8 +42,8 @@
<div class="next">
<sf:commandLink id="nextPageLink" value="More Results" action="next" rendered="#{not empty hotels and hotels.rowCount == searchCriteria.pageSize}"/>
</div>
<div class="prev">
<sf:commandLink id="prevPageLink" value="Previous results" action="previous" rendered="#{searchCriteria.page > 0}"/>
<div class="previous">
<sf:commandLink id="previousPageLink" value="Previous results" action="previous" rendered="#{searchCriteria.page > 0}"/>
</div>
</div>
</ui:fragment>

View File

@@ -143,7 +143,7 @@
margin-right: 5px;
}
#content .prev {
#content .previous {
float: right;
}