[jboss-cvs] JBossAS SVN: r101669 - in projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main: webapp and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Mar 1 11:24:06 EST 2010
Author: lvlcek at redhat.com
Date: 2010-03-01 11:24:06 -0500 (Mon, 01 Mar 2010)
New Revision: 101669
Modified:
projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationSearch.java
projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/searchReservation.xhtml
Log:
JBQA-3032 WIP
Modified: projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationSearch.java
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationSearch.java 2010-03-01 16:23:24 UTC (rev 101668)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationSearch.java 2010-03-01 16:24:06 UTC (rev 101669)
@@ -4,6 +4,8 @@
import org.ajax4jsf.model.Range;
import org.ajax4jsf.model.SequenceRange;
import org.jboss.snowdrop.samples.sportsclub.domain.entity.Reservation;
+import org.jboss.snowdrop.samples.sportsclub.domain.entity.Account;
+import org.jboss.snowdrop.samples.sportsclub.domain.entity.Equipment;
import org.jboss.snowdrop.samples.sportsclub.service.ReservationService;
import org.richfaces.model.selection.Selection;
import org.richfaces.model.selection.SimpleSelection;
@@ -13,19 +15,24 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Locale;
/**
* @author <a href="mailto:lvlcek at redhat.com">Lukas Vlcek</a>
*/
public class ReservationSearch extends AbstractExtendedDataModelHelper
{
-
private ReservationService reservationService;
private ReservationSearchOptions reservationSearchOptions;
private Map<Long, Reservation> reservationsMap = new HashMap<Long, Reservation>();
private ReservationTableState tableState;
+
+ private AccountFilter accountFilter;
+ private EquipmentFilter equipmentFilter;
+ private Locale locale = Locale.getDefault();
+
private boolean editing;
public ReservationSearch()
@@ -132,6 +139,18 @@
editing = false;
}
+ public void updateSelectedAccount()
+ {
+ Account account = accountFilter.getSelectedAccount();
+ //reservation.setAccount(account);
+ }
+
+ public void updateSelectedEquipment()
+ {
+ Equipment equipment = equipmentFilter.getSelectedEquipment();
+ //reservation.setEquipment(equipment);
+ }
+
public void setEditing(boolean editing)
{
this.editing = editing;
@@ -141,4 +160,34 @@
{
return editing;
}
+
+ public AccountFilter getAccountFilter()
+ {
+ return accountFilter;
+ }
+
+ public void setAccountFilter(AccountFilter accountFilter)
+ {
+ this.accountFilter = accountFilter;
+ }
+
+ public EquipmentFilter getEquipmentFilter()
+ {
+ return equipmentFilter;
+ }
+
+ public void setEquipmentFilter(EquipmentFilter equipmentFilter)
+ {
+ this.equipmentFilter = equipmentFilter;
+ }
+
+ public Locale getLocale()
+ {
+ return locale;
+ }
+
+ public void setLocale(Locale locale)
+ {
+ this.locale = locale;
+ }
}
Modified: projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/searchReservation.xhtml
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/searchReservation.xhtml 2010-03-01 16:23:24 UTC (rev 101668)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/searchReservation.xhtml 2010-03-01 16:24:06 UTC (rev 101669)
@@ -58,7 +58,7 @@
height="250px"
rows="5"
tableState="#{reservationSearch.tableState.tableState}">
- <a4j:support event="onselectionchange" reRender="reservationData"/>
+ <a4j:support event="onselectionchange" reRender="reservationData,reservationFilters"/>
<rich:column label="Reservation #">
<f:facet name="header">
<h:outputText value="Reservation #"/>
@@ -109,46 +109,206 @@
</h:form>
</a4j:outputPanel>
+ <!--*********************************** -->
+
+ <a4j:outputPanel id="reservationFilters">
+ <rich:panel rendered="#{reservationSearch.editing and reservationSearch.currentReservation != null}">
+ <f:facet name="header">Edit Reservation</f:facet>
+ <table>
+ <tr>
+ <td style="width:500px">
+
+ <rich:panel>
+ <f:facet name="header">Filter accounts</f:facet>
+ <h:form>
+ Type subscriber name:
+ <h:inputText id="searchField" value="#{accountFilter.subscriberNameFragment}"
+ label="Search name"/>
+ <rich:hotKey selector="##{rich:clientId('searchField')}" key="return"
+ handler="#{rich:element('searchButton')}.onclick();return false;"/>
+ <a4j:commandButton id="searchButton" value="Search" action="#{accountFilter.searchAccounts}"
+ reRender="accountsTable"/>
+ </h:form>
+ </rich:panel>
+ <rich:panel>
+ <f:facet name="header">Select Account</f:facet>
+ <h:form id="AccountSelectForm">
+ <rich:extendedDataTable id="accountsTable" value="#{accountFilter}" var="account"
+ selectionMode="single"
+ selection="#{accountFilter.selection}"
+ enableContextMenu="true"
+ height="250px"
+ rows="5">
+ <a4j:support event="onselectionchange"
+ action="#{reservationCreate.updateSelectedAccount}"
+ reRender="reservationDetails"/>
+
+ <rich:column label="Id" width="7%">
+ <f:facet name="header">
+ <h:outputText value="Id"/>
+ </f:facet>
+ <h:outputText value="#{account.id}"/>
+ </rich:column>
+
+ <rich:column label="First Name">
+ <f:facet name="header">
+ <h:outputText value="First Name"/>
+ </f:facet>
+ <h:outputText value="#{account.subscriber.name.firstName}"/>
+ </rich:column>
+
+ <rich:column label="Last Name">
+ <f:facet name="header">
+ <h:outputText value="Last Name"/>
+ </f:facet>
+ <h:outputText value="#{account.subscriber.name.lastName}"/>
+ </rich:column>
+
+ <rich:column label="City">
+ <f:facet name="header">
+ <h:outputText value="City"/>
+ </f:facet>
+ <h:outputText value="#{account.subscriber.address.city}"/>
+ </rich:column>
+
+ <rich:column label="Country">
+ <f:facet name="header">
+ <h:outputText value="Country"/>
+ </f:facet>
+ <h:outputText value="#{account.subscriber.address.country}"/>
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:datascroller id="scrollerAccount" for="accountsTable" maxPages="5"
+ page="#{accountFilter.currentPage}"/>
+ </f:facet>
+ </rich:extendedDataTable>
+ </h:form>
+ </rich:panel>
+
+ </td>
+ <td style="width:500px;vertical-align:bottom;">
+ <rich:panel>
+ <f:facet name="header">Select Equipment</f:facet>
+ <h:form id="EquipmentSelectForm">
+ <rich:extendedDataTable id="equipmentsTable" value="#{equipmentFilter}" var="equipment"
+ selectionMode="single"
+ selection="#{equipmentFilter.selection}"
+ enableContextMenu="true"
+ height="250px"
+ rows="5">
+ <a4j:support event="onselectionchange"
+ action="#{reservationCreate.updateSelectedEquipment}"
+ reRender="reservationDetails"/>
+
+ <rich:column label="Id" width="10%">
+ <f:facet name="header">
+ <h:outputText value="Id"/>
+ </f:facet>
+ <h:outputText value="#{equipment.id}"/>
+ </rich:column>
+
+ <rich:column label="Name" width="35%">
+ <f:facet name="header">
+ <h:outputText value="Name"/>
+ </f:facet>
+ <h:outputText value="#{equipment.name}"/>
+ </rich:column>
+
+ <rich:column label="Description" width="55%">
+ <f:facet name="header">
+ <h:outputText value="Description"/>
+ </f:facet>
+ <h:outputText value="#{equipment.description}"/>
+ </rich:column>
+
+ <f:facet name="footer">
+ <rich:datascroller id="scrollerEquipment" for="equipmentsTable" maxPages="5"
+ page="#{equipmentFilter.currentPage}"/>
+ </f:facet>
+
+ </rich:extendedDataTable>
+ </h:form>
+ </rich:panel>
+ </td>
+ </tr>
+ </table>
+ </rich:panel>
+ </a4j:outputPanel>
+
+
+ <!-- ******************************************** -->
+
<a4j:outputPanel id="reservationData">
<rich:panel rendered="#{reservationSearch.currentReservation != null}" >
<h:form>
- <h:panelGrid columns="2">
+ <a4j:region id="controlRegion">
+ <h:panelGrid columns="2">
+ <h:outputLabel value="Equipment"/>
+ <h:panelGroup>
+ <h:outputText rendered="#{reservationSearch.currentReservation.equipment != null}"
+ value="#{reservationSearch.currentReservation.equipment.name} (#{reservationSearch.currentReservation.equipment.description})"/>
+ <h:outputText rendered="#{reservationSearch.currentReservation.equipment == null}"
+ value="Not selected"/>
+ </h:panelGroup>
- <h:outputLabel value="Equipment"/>
- <h:panelGroup>
- <h:outputText rendered="#{reservationSearch.currentReservation.equipment != null}"
- value="#{reservationSearch.currentReservation.equipment.name} (#{reservationSearch.currentReservation.equipment.description})"/>
- <h:outputText rendered="#{reservationSearch.currentReservation.equipment == null}"
- value="Not selected"/>
- </h:panelGroup>
+ <h:outputLabel value="Account"/>
+ <h:panelGroup>
+ <h:outputText rendered="#{reservationSearch.currentReservation.account != null}"
+ value="#{reservationSearch.currentReservation.account.subscriber.name.firstName} #{reservationSearch.currentReservation.account.subscriber.name.lastName} (#{reservationSearch.currentReservation.account.subscriber.address.city}, #{reservationSearch.currentReservation.account.subscriber.address.country})"/>
+ <h:outputText rendered="#{reservationSearch.currentReservation.account == null}" value="Not selected"/>
+ </h:panelGroup>
+
+ <h:outputLabel value="From"/>
+ <h:panelGroup>
+ <h:outputText value="#{reservationSearch.currentReservation.from}" rendered="#{!reservationSearch.editing}"/>
+ <rich:calendar id="from"
+ value="#{reservationSearch.currentReservation.from}"
+ datePattern="d/M/yy HH:mm"
+ showApplyButton="true"
+ locale="#{reservationSearch.locale}"
+ rendered="#{reservationSearch.editing}"/>
+ </h:panelGroup>
- <h:outputLabel value="Account"/>
- <h:panelGroup>
- <h:outputText rendered="#{reservationSearch.currentReservation.account != null}"
- value="#{reservationSearch.currentReservation.account.subscriber.name.firstName} #{reservationSearch.currentReservation.account.subscriber.name.lastName} (#{reservationSearch.currentReservation.account.subscriber.address.city}, #{reservationSearch.currentReservation.account.subscriber.address.country})"/>
- <h:outputText rendered="#{reservationSearch.currentReservation.account == null}" value="Not selected"/>
- </h:panelGroup>
+ <h:outputLabel value="To"/>
+ <h:panelGroup>
+ <h:outputText value="#{reservationSearch.currentReservation.to}" rendered="#{!reservationSearch.editing}"/>
+ <rich:calendar id="to"
+ value="#{reservationSearch.currentReservation.to}"
+ datePattern="d/M/yy HH:mm"
+ showApplyButton="true"
+ locale="#{reservationSearch.locale}"
+ rendered="#{reservationSearch.editing}"/>
+ </h:panelGroup>
- <h:outputLabel value="From"/>
- <h:outputText value="#{reservationSearch.currentReservation.from}"/>
+ <a4j:commandButton id="deleteRsrvBtn" value="Delete" action="#{reservationSearch.deleteReservation}" reRender="searchResults,reservationData" rendered="#{!reservationSearch.editing}"/>
+ <a4j:commandButton id="editRsrvBtn" value="Edit" reRender="reservationData,reservationFilters" rendered="#{!reservationSearch.editing}">
+ <f:setPropertyActionListener value="#{true}" target="#{reservationSearch.editing}"/>
+ </a4j:commandButton>
- <h:outputLabel value="To"/>
- <h:outputText value="#{reservationSearch.currentReservation.to}"/>
+ <a4j:commandButton id="cancelRsrvBtn" value="Cancel" rendered="#{reservationSearch.editing}" reRender="reservationData,reservationFilters">
+ <f:setPropertyActionListener value="#{false}" target="#{reservationSearch.editing}"/>
+ </a4j:commandButton>
+ <a4j:commandButton id="saveRsrvBtn" value="Save" action="#{reservationSearch.saveCurrent}" reRender="reservationData" rendered="#{reservationSearch.editing}"/>
- <a4j:commandButton id="deleteRsrvBtn" value="Delete" action="#{reservationSearch.deleteReservation}" reRender="searchResults,reservationData" rendered="#{!reservationSearch.editing}"/>
- <a4j:commandButton id="editRsrvBtn" value="Edit" reRender="reservationData" rendered="#{!reservationSearch.editing}">
- <f:setPropertyActionListener value="#{true}" target="#{reservationSearch.editing}"/>
- </a4j:commandButton>
-
- <a4j:commandButton id="cancelRsrvBtn" value="Cancel" rendered="#{reservationSearch.editing}" reRender="reservationData">
- <f:setPropertyActionListener value="#{false}" target="#{reservationSearch.editing}"/>
- </a4j:commandButton>
- <a4j:commandButton id="saveRsrvBtn" value="Save" action="#{reservationSearch.saveCurrent}" reRender="reservationData" rendered="#{reservationSearch.editing}"/>
-
- </h:panelGrid>
+ </h:panelGrid>
+ </a4j:region>
</h:form>
</rich:panel>
</a4j:outputPanel>
+
+ <rich:modalPanel id="ajaxLoadingModalBox" minHeight="200" minWidth="450"
+ height="100" width="250" zindex="2000">
+ <f:facet name="header">
+ <h:outputText value="Request being processed"></h:outputText>
+ </f:facet>
+ <h:outputText value="Your request is being processed, please wait."></h:outputText>
+ </rich:modalPanel>
+
+ <a4j:status for="controlRegion"
+ onstart="Richfaces.showModalPanel('ajaxLoadingModalBox',{width:450, top:200})"
+ onstop="Richfaces.hideModalPanel('ajaxLoadingModalBox')"></a4j:status>
+
</ui:define>
</ui:composition>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list