[jboss-cvs] JBossAS SVN: r97812 - in projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main: webapp and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Dec 14 17:50:21 EST 2009
Author: lvlcek at redhat.com
Date: 2009-12-14 17:50:21 -0500 (Mon, 14 Dec 2009)
New Revision: 97812
Added:
projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationSearchOptions.java
projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/reservationCreate.xhtml
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/WEB-INF/faces-config.xml
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/includes/header.xhtml
projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/reservationSearch.xhtml
Log:
fixing AJAX and session stuff (still not perfect - 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 2009-12-14 22:20:27 UTC (rev 97811)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationSearch.java 2009-12-14 22:50:21 UTC (rev 97812)
@@ -20,11 +20,8 @@
{
private ReservationService reservationService;
- private EquipmentService equipmentService;
- private Date fromDate;
- private Date toDate;
- private List<EquipmentType> selectedEquipmentTypes;
+ private ReservationSearchOptions reservationSearchOptions;
private int currentPage;
private int currentRow;
@@ -39,18 +36,16 @@
super();
}
- public void init() {
- selectedEquipmentTypes = Arrays.asList(equipmentService.getEquipmentTypes());
- }
+// public String searchReservations()
+// {
+// rowCount = reservationService.countReservationsForRange(
+// reservationSearchOptions.getFromDate(),
+// reservationSearchOptions.getToDate(),
+// reservationSearchOptions.getSelectedEquipmentTypes());
+// currentPage = 1;
+// return "success";
+// }
- public String searchReservations()
- {
- rowCount = reservationService.countReservationsForRange(fromDate, toDate, selectedEquipmentTypes);
- currentPage = 1;
- return "success";
- }
-
-
public ReservationService getReservationService()
{
return reservationService;
@@ -61,26 +56,6 @@
this.reservationService = reservationService;
}
- public Date getFromDate()
- {
- return fromDate;
- }
-
- public void setFromDate(Date fromDate)
- {
- this.fromDate = fromDate;
- }
-
- public Date getToDate()
- {
- return toDate;
- }
-
- public void setToDate(Date toDate)
- {
- this.toDate = toDate;
- }
-
public int getCurrentPage()
{
return currentPage;
@@ -119,7 +94,10 @@
{
if (rowCount == null)
{
- rowCount = reservationService.countReservationsForRange(fromDate, toDate, selectedEquipmentTypes);
+ rowCount = reservationService.countReservationsForRange(
+ reservationSearchOptions.getFromDate(),
+ reservationSearchOptions.getToDate(),
+ reservationSearchOptions.getSelectedEquipmentTypes());
}
return rowCount;
}
@@ -135,7 +113,10 @@
{
int firstResult = ((SequenceRange) range).getFirstRow();
int maxResults = ((SequenceRange) range).getRows();
- List<Reservation> list = reservationService.getReservations(fromDate, toDate, firstResult, maxResults, selectedEquipmentTypes);
+ List<Reservation> list = reservationService.getReservations(
+ reservationSearchOptions.getFromDate(),
+ reservationSearchOptions.getToDate(), firstResult, maxResults,
+ reservationSearchOptions.getSelectedEquipmentTypes());
reservationsMap = new HashMap<Long, Reservation>();
for (Reservation row : list)
{
@@ -169,37 +150,27 @@
throw new UnsupportedOperationException("Not supported");
}
- public List<EquipmentType> getSelectedEquipmentTypes()
- {
- return selectedEquipmentTypes;
- }
-
- public void setSelectedEquipmentTypes(List<EquipmentType> selectedEquipmentTypes)
- {
- this.selectedEquipmentTypes = selectedEquipmentTypes;
- }
-
public String equipmentTypeCheckboxChanged() {
return null;
}
- public EquipmentService getEquipmentService()
+ public ReservationTableState getTableState()
{
- return equipmentService;
+ return tableState;
}
- public void setEquipmentService(EquipmentService equipmentService)
+ public void setTableState(ReservationTableState tableState)
{
- this.equipmentService = equipmentService;
+ this.tableState = tableState;
}
- public ReservationTableState getTableState()
+ public ReservationSearchOptions getReservationSearchOptions()
{
- return tableState;
+ return reservationSearchOptions;
}
- public void setTableState(ReservationTableState tableState)
+ public void setReservationSearchOptions(ReservationSearchOptions reservationSearchOptions)
{
- this.tableState = tableState;
+ this.reservationSearchOptions = reservationSearchOptions;
}
}
Added: projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationSearchOptions.java
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationSearchOptions.java (rev 0)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationSearchOptions.java 2009-12-14 22:50:21 UTC (rev 97812)
@@ -0,0 +1,67 @@
+package org.jboss.snowdrop.samples.sportsclub.jsf.beans;
+
+import org.jboss.snowdrop.samples.sportsclub.domain.entity.EquipmentType;
+import org.jboss.snowdrop.samples.sportsclub.service.EquipmentService;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Arrays;
+
+/**
+ * @author <a href="mailto:lvlcek at redhat.com">Lukas Vlcek</a>
+ */
+public class ReservationSearchOptions
+{
+ private EquipmentService equipmentService;
+
+ private Date fromDate;
+ private Date toDate;
+ private List<EquipmentType> selectedEquipmentTypes;
+
+ public void init()
+ {
+ selectedEquipmentTypes = Arrays.asList(getEquipmentService().getEquipmentTypes());
+ }
+
+ public Date getFromDate()
+ {
+ return fromDate;
+ }
+
+ public void setFromDate(Date fromDate)
+ {
+ System.out.println("setting fromDate - " + fromDate);
+ this.fromDate = fromDate;
+ }
+
+ public Date getToDate()
+ {
+ return toDate;
+ }
+
+ public void setToDate(Date toDate)
+ {
+ System.out.println("setting toDate - " + toDate);
+ this.toDate = toDate;
+ }
+
+ public List<EquipmentType> getSelectedEquipmentTypes()
+ {
+ return selectedEquipmentTypes;
+ }
+
+ public void setSelectedEquipmentTypes(List<EquipmentType> selectedEquipmentTypes)
+ {
+ this.selectedEquipmentTypes = selectedEquipmentTypes;
+ }
+
+ public EquipmentService getEquipmentService()
+ {
+ return equipmentService;
+ }
+
+ public void setEquipmentService(EquipmentService equipmentService)
+ {
+ this.equipmentService = equipmentService;
+ }
+}
Modified: projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/WEB-INF/faces-config.xml 2009-12-14 22:20:27 UTC (rev 97811)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/WEB-INF/faces-config.xml 2009-12-14 22:50:21 UTC (rev 97812)
@@ -14,4 +14,16 @@
<converter-class>org.jboss.snowdrop.samples.sportsclub.jsf.beans.EquipmentTypeConverter</converter-class>
</converter>
+ <navigation-rule>
+ <from-view-id>*</from-view-id>
+ <navigation-case>
+ <from-outcome>create</from-outcome>
+ <to-view-id>/reservationCreate.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>search</from-outcome>
+ <to-view-id>/reservationSearch.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+
</faces-config>
\ No newline at end of file
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 2009-12-14 22:20:27 UTC (rev 97811)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/WEB-INF/spring-beans.xml 2009-12-14 22:50:21 UTC (rev 97812)
@@ -11,15 +11,19 @@
<import resource="classpath*:infrastructure.xml"/>
- <bean id="reservationSearch" class="org.jboss.snowdrop.samples.sportsclub.jsf.beans.ReservationSearch" scope="request" init-method="init">
+ <bean id="reservationSearch" class="org.jboss.snowdrop.samples.sportsclub.jsf.beans.ReservationSearch" scope="request">
<property name="reservationService" ref="reservationService"/>
- <property name="equipmentService" ref="equipmentService"/>
<property name="tableState" ref="reservationSearchTableState"/>
+ <property name="reservationSearchOptions" ref="reservationSearchOptions"/>
</bean>
<!-- Keeps search table state in the session -->
<bean id="reservationSearchTableState" class="org.jboss.snowdrop.samples.sportsclub.jsf.beans.ReservationTableState" scope="session"/>
+ <bean id="reservationSearchOptions" class="org.jboss.snowdrop.samples.sportsclub.jsf.beans.ReservationSearchOptions" scope="session" init-method="init">
+ <property name="equipmentService" ref="equipmentService"/>
+ </bean>
+
<!-- Application scoped service -->
<bean id="referenceData" class="org.jboss.snowdrop.samples.sportsclub.jsf.beans.ReferenceData">
<property name="equipmentService" ref="equipmentService"/>
Modified: projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/includes/header.xhtml
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/includes/header.xhtml 2009-12-14 22:20:27 UTC (rev 97811)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/includes/header.xhtml 2009-12-14 22:50:21 UTC (rev 97812)
@@ -17,4 +17,10 @@
</h:outputLink>
</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
Added: projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/reservationCreate.xhtml
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/reservationCreate.xhtml (rev 0)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/reservationCreate.xhtml 2009-12-14 22:50:21 UTC (rev 97812)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title></title>
+</head>
+<body>
+
+</body>
+</html>
\ No newline at end of file
Modified: projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/reservationSearch.xhtml
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/reservationSearch.xhtml 2009-12-14 22:20:27 UTC (rev 97811)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/reservationSearch.xhtml 2009-12-14 22:50:21 UTC (rev 97812)
@@ -9,14 +9,16 @@
<ui:define name="content">
<rich:panel>
- <f:facet name="header">Display reservations</f:facet>
+ <f:facet name="header">Filter reservations</f:facet>
<h:form>
from:
- <rich:calendar value="#{reservationSearch.fromDate}"/>
+ <rich:calendar id="from" value="#{reservationSearch.reservationSearchOptions.fromDate}">
+ <a4j:support event="ondateselected" reRender="searchResults"/>
+ </rich:calendar>
to:
- <rich:calendar value="#{reservationSearch.toDate}"/>
- <h:commandButton id="submit" value="Display Reservations"
- action="#{reservationSearch.searchReservations}"/> <!-- reRender="searchResults"-->
+ <rich:calendar id="to" value="#{reservationSearch.reservationSearchOptions.toDate}">
+ <a4j:support event="ondateselected" reRender="searchResults"/>
+ </rich:calendar>
<br/>
<table>
<tr>
@@ -25,7 +27,7 @@
</td>
<td>
<h:selectManyCheckbox id="equipmentTypes"
- value="#{reservationSearch.selectedEquipmentTypes}"
+ value="#{reservationSearch.reservationSearchOptions.selectedEquipmentTypes}"
layout="lineDirection" converter="#{equipmentTypeConverter}">
<f:selectItems value="#{referenceData.equipmentTypes}"/>
<a4j:support event="onchange" action="#{reservationSearch.equipmentTypeCheckboxChanged}"
More information about the jboss-cvs-commits
mailing list