[jboss-cvs] JBossAS SVN: r101021 - in projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main: webapp and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 16 09:44:03 EST 2010


Author: lvlcek at redhat.com
Date: 2010-02-16 09:44:02 -0500 (Tue, 16 Feb 2010)
New Revision: 101021

Modified:
   projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/AbstractExtendedDataModelHelper.java
   projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationCreate.java
   projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/WEB-INF/spring-beans.xml
   projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/createReservation.xhtml
   projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/createResult.xhtml
Log:


Modified: projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/AbstractExtendedDataModelHelper.java
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/AbstractExtendedDataModelHelper.java	2010-02-16 13:38:45 UTC (rev 101020)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/AbstractExtendedDataModelHelper.java	2010-02-16 14:44:02 UTC (rev 101021)
@@ -119,7 +119,6 @@
 
    public void setSelection(Selection selection)
    {
-      System.out.println("Setting selection " + selection);
       this.selection = selection;
    }
 }

Modified: projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationCreate.java
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationCreate.java	2010-02-16 13:38:45 UTC (rev 101020)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationCreate.java	2010-02-16 14:44:02 UTC (rev 101021)
@@ -24,6 +24,7 @@
    private AccountService accountService;
 
    private Reservation reservation;
+   private long createdReservationId;
 
    public void init()
    {
@@ -44,25 +45,11 @@
       reservation.setTo(to);
    }
 
-   public SelectItem[] getAllAccounts()
-   {
-      Collection<Account> accounts = accountService.getAllAccounts();
-      SelectItem[] items = new SelectItem[accounts.size()];
-      int i = 0;
-      for (Account a : accounts)
-      {
-         String label = a.getSubscriber().getName().getFirstName() + " " +
-            a.getSubscriber().getName().getLastName() + " (" +
-            a.getSubscriber().getAddress().getCity() + ", " +
-            a.getSubscriber().getAddress().getCountry() + ")";
-         items[i++] = new SelectItem(a, label);
-      }
-      return items;
-   }
-
    public String create()
    {
       reservationService.create(reservation);
+      createdReservationId = reservation.getId();
+      init();
       return "success";
    }
 
@@ -127,4 +114,14 @@
    {
       this.equipmentFilter = equipmentFilter;
    }
+
+   public long getCreatedReservationId()
+   {
+      return createdReservationId;
+   }
+
+   public void setCreatedReservationId(long createdReservationId)
+   {
+      this.createdReservationId = createdReservationId;
+   }
 }

Modified: projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/WEB-INF/spring-beans.xml
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/WEB-INF/spring-beans.xml	2010-02-16 13:38:45 UTC (rev 101020)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/WEB-INF/spring-beans.xml	2010-02-16 14:44:02 UTC (rev 101021)
@@ -44,6 +44,7 @@
 
     
     <!-- Application scoped service -->
+    <!-- TODO remove if not needed -->
     <bean id="referenceData" class="org.jboss.snowdrop.samples.sportsclub.jsf.beans.ReferenceData" init-method="init">
         <property name="equipmentService" ref="equipmentService"/>
     </bean>

Modified: projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/createReservation.xhtml
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/createReservation.xhtml	2010-02-16 13:38:45 UTC (rev 101020)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/createReservation.xhtml	2010-02-16 14:44:02 UTC (rev 101021)
@@ -1,4 +1,5 @@
 <ui:composition xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:c="http://java.sun.com/jstl/core"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:h="http://java.sun.com/jsf/html"
@@ -130,28 +131,14 @@
                 <h:panelGrid columns="2">
 
                     <h:outputLabel value="Equipment"/>
-                    <!--h:panelGroup>
-                        <rich:inplaceSelect id="equipment" defaultLabel="Click to enter"
-                                            value="#{reservationCreate.reservation.equipment}"
-                                            required="true"
-                                            converter="#{equipmentConverter}">
-                            <f:selectItems value="#{referenceData.allEquipments}"/>
-                        </rich:inplaceSelect>
-                        <h:message for="equipment" style="color:RED"/>
-                    </h:panelGroup-->
-                    <h:outputText value="#{reservationCreate.reservation.equipment}" converter="#{equipmentConverter}"/>
+                    <h:outputText rendered="#{reservationCreate.reservation.equipment != null}"
+                            value="#{reservationCreate.reservation.equipment.name} (#{reservationCreate.reservation.equipment.description})"/>
+                    <h:outputText rendered="#{reservationCreate.reservation.equipment == null}" value="Not selected"/>
 
                     <h:outputLabel value="Account"/>
-                    <!--h:panelGroup>
-                        <rich:inplaceSelect id="account" defaultLabel="Click to enter"
-                                            value="#{reservationCreate.reservation.account}"
-                                            required="true"
-                                            converter="#{accountConverter}">
-                            <f:selectItems value="#{reservationCreate.allAccounts}"/>
-                        </rich:inplaceSelect>
-                        <h:message for="account" style="color:RED"/>
-                    </h:panelGroup-->
-                    <h:outputText value="#{reservationCreate.reservation.account}" converter="#{accountConverter}"/>
+                    <h:outputText rendered="#{reservationCreate.reservation.account != null}"
+                            value="#{reservationCreate.reservation.account.subscriber.name.firstName} #{reservationCreate.reservation.account.subscriber.name.lastName} (#{reservationCreate.reservation.account.subscriber.address.city}, #{reservationCreate.reservation.account.subscriber.address.country})"/>
+                    <h:outputText rendered="#{reservationCreate.reservation.account == null}" value="Not selected"/>
 
                     <h:outputLabel value="From"/>
                     <h:panelGroup>

Modified: projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/createResult.xhtml
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/createResult.xhtml	2010-02-16 13:38:45 UTC (rev 101020)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/createResult.xhtml	2010-02-16 14:44:02 UTC (rev 101021)
@@ -7,7 +7,7 @@
 	template="layout/template.xhtml">
 	<ui:define name="content">
         <rich:panel>
-            Reservation #<h:outputText value="#{reservationCreate.reservation.id}"/> created.
+            Reservation #<h:outputText value="#{reservationCreate.createdReservationId}"/> created.
         </rich:panel>
 	</ui:define>
 </ui:composition>
\ No newline at end of file




More information about the jboss-cvs-commits mailing list