[jboss-cvs] JBossAS SVN: r97563 - in projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main: webapp and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Dec 8 15:33:06 EST 2009


Author: marius.bogoevici
Date: 2009-12-08 15:33:06 -0500 (Tue, 08 Dec 2009)
New Revision: 97563

Modified:
   projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/AccountSearch.java
   projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/webapp/WEB-INF/faces-config.xml
   projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/webapp/createForm.xhtml
   projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/webapp/includes/header.xhtml
   projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/webapp/searchForm.xhtml
Log:
Application structure changes.

Modified: projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/AccountSearch.java
===================================================================
--- projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/AccountSearch.java	2009-12-08 20:32:31 UTC (rev 97562)
+++ projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/AccountSearch.java	2009-12-08 20:33:06 UTC (rev 97563)
@@ -31,6 +31,7 @@
 
    private Map<Long, Account> accountsMap = new HashMap<Long, Account>();
    private Integer rowCount;
+   private Long selected;
 
    public String getName()
    {
@@ -116,6 +117,10 @@
          accountsMap.put(id, row);
          visitor.process(context, id, argument);
       }
+      if (selected != null && !accountsMap.containsKey(selected))
+      {
+         selected = null;
+      }
    }
 
    @Override
@@ -141,4 +146,27 @@
    {
       throw new UnsupportedOperationException("Not supported");
    }
+
+   public Account getCurrentAccount()
+   {
+      if (selected != null)
+         return accountsMap.get(selected);
+      else
+         return null;
+   }
+
+   public void saveCurrent()
+   {
+      
+   }
+
+   public void setSelected(Long selected)
+   {
+      this.selected = selected;
+   }
+
+   public Long getSelected()
+   {
+      return selected;
+   }
 }

Modified: projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/webapp/WEB-INF/faces-config.xml	2009-12-08 20:32:31 UTC (rev 97562)
+++ projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/webapp/WEB-INF/faces-config.xml	2009-12-08 20:33:06 UTC (rev 97563)
@@ -35,13 +35,18 @@
         <converter-id>enumConverter</converter-id>
         <converter-class>org.jboss.snowdrop.samples.sportsclub.jsf.beans.BillingTypeConverter</converter-class>
     </converter>
-    <!--<navigation-rule>-->
-        <!--<from-view-id>/searchForm.xhtml</from-view-id>-->
-        <!--<navigation-case>-->
-            <!--<to-view-id>/searchResult.xhtml</to-view-id>-->
-        <!--</navigation-case>-->
-    <!--</navigation-rule>-->
     <navigation-rule>
+        <from-view-id>*</from-view-id>
+        <navigation-case>
+             <from-outcome>create</from-outcome>   
+            <to-view-id>/createForm.xhtml</to-view-id>
+        </navigation-case>
+        <navigation-case>
+             <from-outcome>search</from-outcome>
+            <to-view-id>/searchForm.xhtml</to-view-id>
+        </navigation-case>
+    </navigation-rule>
+    <navigation-rule>
         <from-view-id>/createForm.xhtml</from-view-id>
         <navigation-case>
             <to-view-id>/createResult.xhtml</to-view-id>

Modified: projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/webapp/createForm.xhtml
===================================================================
--- projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/webapp/createForm.xhtml	2009-12-08 20:32:31 UTC (rev 97562)
+++ projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/webapp/createForm.xhtml	2009-12-08 20:33:06 UTC (rev 97563)
@@ -8,7 +8,7 @@
     <ui:define name="content">
         <rich:panel>
             <h:form>
-                <h:panelGrid columns="2">
+                <h:panelGrid columns="2" >
                     <h:outputLabel value="First name"/>
                     <rich:inplaceInput defaultLabel="Click to enter" value="#{accountCreate.person.name.firstName}"/>
                     <h:outputLabel value="Middle name"/>
@@ -31,8 +31,8 @@
                     <rich:inplaceSelect defaultLabel="Click to select" value="#{accountCreate.membershipType}">
                         <f:selectItems value="#{accountCreate.selectableMembershipCodes}"/>
                     </rich:inplaceSelect>
-                    <h:commandButton value="Save" action="#{accountCreate.create}"/>
                 </h:panelGrid>
+                <h:commandButton value="Save" action="#{accountCreate.create}"/>
             </h:form>
         </rich:panel>
 

Modified: projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/webapp/includes/header.xhtml
===================================================================
--- projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/webapp/includes/header.xhtml	2009-12-08 20:32:31 UTC (rev 97562)
+++ projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/webapp/includes/header.xhtml	2009-12-08 20:33:06 UTC (rev 97563)
@@ -7,4 +7,11 @@
     <rich:panel>
        <h:outputText value="Sports Club Subscriptions"/>
     </rich:panel>
+    <h:form>
+        <rich:toolBar>
+            <rich:menuItem value="Create" action="create"/>
+            <rich:menuItem value="Search" action="search"/>
+        </rich:toolBar>
+    </h:form>
+
 </ui:composition>
\ No newline at end of file

Modified: projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/webapp/searchForm.xhtml
===================================================================
--- projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/webapp/searchForm.xhtml	2009-12-08 20:32:31 UTC (rev 97562)
+++ projects/snowdrop/trunk/documentation/samples/sportsclub/sportsclub-subscriptions-web/src/main/webapp/searchForm.xhtml	2009-12-08 20:33:06 UTC (rev 97563)
@@ -21,8 +21,11 @@
         <a4j:outputPanel id="searchResults">
             <h:form>
                 <rich:panel header="Search results" rendered="#{accountSearch.searchInfoAvailable}">
-
                     <rich:dataTable id="searchResultsTable" value="#{accountSearch}" var="account" rows="5">
+                        <a4j:support event="onRowClick" reRender="accountData">
+                            <f:setPropertyActionListener value="#{account.id}"
+                                                         target="#{accountSearch.selected}"/>
+                        </a4j:support>
                         <rich:column>
                             <f:facet name="header">
                                 <h:outputText value="Account #"/>
@@ -59,12 +62,6 @@
                             </f:facet>
                             <h:outputText value="#{account.billingType}"/>
                         </rich:column>
-                        <rich:column>
-                            <f:facet name="header">
-                                <h:outputText value="Edit"/>
-                            </f:facet>
-                            <a4j:commandLink value="Edit" onclick="Richfaces.showModalPanel('')"/>
-                        </rich:column>
                         <f:facet name="footer">
                             <rich:datascroller id="sc2" for="searchResultsTable" maxPages="5"
                                                page="#{accountSearch.currentPage}"/>
@@ -72,22 +69,38 @@
                     </rich:dataTable>
                 </rich:panel>
             </h:form>
+
         </a4j:outputPanel>
 
-        <rich:modalPanel id="edit">
 
-            <f:facet name="header">
 
-                <h:outputText value="I'm panel header"/>
+            <a4j:outputPanel id="accountData">
+                <rich:panel rendered="#{accountSearch.currentAccount != null}" >
+                    <h:form>
+                        <h:panelGrid columns="2">
+                            <h:outputLabel value="First name"/>
+                            <h:outputText
+                                               value="#{accountSearch.currentAccount.subscriber.name.firstName}"/>
+                            <h:outputLabel value="Middle name"/>
+                            <rich:inplaceInput defaultLabel="Click to enter"
+                                               value="#{accountSearch.currentAccount.subscriber.name.middleName}"/>
+                            <h:outputLabel value="Last name"/>
+                            <h:outputText
+                                               value="#{accountSearch.currentAccount.subscriber.name.lastName}"/>
+                            <h:outputLabel value="Address"/>
+                            <h:outputText
+                                               value="#{accountSearch.currentAccount.subscriber.address.streetAddress}"/>
+                            <h:outputLabel value="City"/>
+                            <h:outputText
+                                               value="#{accountSearch.currentAccount.subscriber.address.city}"/>
+                            <h:outputLabel value="Province"/>
+                            <h:outputText 
+                                               value="#{accountSearch.currentAccount.subscriber.address.provinceOrState}"/>
 
-            </f:facet>
+                        </h:panelGrid>
+                    </h:form>
+                </rich:panel>
+            </a4j:outputPanel>
 
-            <p> My panel
-            </p>
-
-            <a onclick="Richfaces.hideModalPanel('pnl');" href="#">Hide ModalPanel</a>
-
-        </rich:modalPanel>
-
     </ui:define>
 </ui:composition>
\ No newline at end of file




More information about the jboss-cvs-commits mailing list