[seam-commits] Seam SVN: r10226 - in trunk/examples: metawidget and 33 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Sat Mar 28 15:54:58 EDT 2009


Author: dan.j.allen
Date: 2009-03-28 15:54:58 -0400 (Sat, 28 Mar 2009)
New Revision: 10226

Added:
   trunk/examples/metawidget/
   trunk/examples/metawidget/booking/
   trunk/examples/metawidget/booking/build.properties
   trunk/examples/metawidget/booking/build.xml
   trunk/examples/metawidget/booking/readme.txt
   trunk/examples/metawidget/booking/resources/
   trunk/examples/metawidget/booking/resources/META-INF/
   trunk/examples/metawidget/booking/resources/META-INF/application.xml
   trunk/examples/metawidget/booking/resources/WEB-INF/
   trunk/examples/metawidget/booking/resources/WEB-INF/inspector-config.xml
   trunk/examples/metawidget/booking/src/
   trunk/examples/metawidget/booking/src/org/
   trunk/examples/metawidget/booking/src/org/jboss/
   trunk/examples/metawidget/booking/src/org/jboss/seam/
   trunk/examples/metawidget/booking/src/org/jboss/seam/example/
   trunk/examples/metawidget/booking/src/org/jboss/seam/example/booking/
   trunk/examples/metawidget/booking/src/org/jboss/seam/example/booking/Booking.java
   trunk/examples/metawidget/booking/src/org/jboss/seam/example/booking/Hotel.java
   trunk/examples/metawidget/booking/view/
   trunk/examples/metawidget/booking/view/book.xhtml
   trunk/examples/metawidget/booking/view/confirm.xhtml
   trunk/examples/metawidget/booking/view/hotelview.xhtml
   trunk/examples/metawidget/booking/view/main.xhtml
   trunk/examples/metawidget/dvdstore/
   trunk/examples/metawidget/dvdstore/build.properties
   trunk/examples/metawidget/dvdstore/build.xml
   trunk/examples/metawidget/dvdstore/readme.txt
   trunk/examples/metawidget/dvdstore/resources/
   trunk/examples/metawidget/dvdstore/resources/META-INF/
   trunk/examples/metawidget/dvdstore/resources/META-INF/application.xml
   trunk/examples/metawidget/dvdstore/resources/WEB-INF/
   trunk/examples/metawidget/dvdstore/resources/WEB-INF/inspector-config.xml
   trunk/examples/metawidget/dvdstore/src/
   trunk/examples/metawidget/dvdstore/src/com/
   trunk/examples/metawidget/dvdstore/src/com/jboss/
   trunk/examples/metawidget/dvdstore/src/com/jboss/dvd/
   trunk/examples/metawidget/dvdstore/src/com/jboss/dvd/seam/
   trunk/examples/metawidget/dvdstore/src/com/jboss/dvd/seam/Customer.java
   trunk/examples/metawidget/dvdstore/src/com/jboss/dvd/seam/EditCustomer.java
   trunk/examples/metawidget/dvdstore/src/com/jboss/dvd/seam/User.java
   trunk/examples/metawidget/dvdstore/view/
   trunk/examples/metawidget/dvdstore/view/confirm.xhtml
   trunk/examples/metawidget/dvdstore/view/newuser/
   trunk/examples/metawidget/dvdstore/view/newuser/account.xhtml
   trunk/examples/metawidget/dvdstore/view/newuser/card.xhtml
   trunk/examples/metawidget/dvdstore/view/newuser/contact.xhtml
   trunk/examples/metawidget/groovybooking/
   trunk/examples/metawidget/groovybooking/build.properties
   trunk/examples/metawidget/groovybooking/build.xml
   trunk/examples/metawidget/groovybooking/readme.txt
   trunk/examples/metawidget/groovybooking/resources/
   trunk/examples/metawidget/groovybooking/resources/WEB-INF/
   trunk/examples/metawidget/groovybooking/resources/WEB-INF/inspector-config.xml
   trunk/examples/metawidget/groovybooking/src/
   trunk/examples/metawidget/groovybooking/src/model/
   trunk/examples/metawidget/groovybooking/src/model/org/
   trunk/examples/metawidget/groovybooking/src/model/org/jboss/
   trunk/examples/metawidget/groovybooking/src/model/org/jboss/seam/
   trunk/examples/metawidget/groovybooking/src/model/org/jboss/seam/example/
   trunk/examples/metawidget/groovybooking/src/model/org/jboss/seam/example/groovy/
   trunk/examples/metawidget/groovybooking/src/model/org/jboss/seam/example/groovy/Booking.groovy
   trunk/examples/metawidget/groovybooking/src/model/org/jboss/seam/example/groovy/Hotel.groovy
   trunk/examples/metawidget/groovybooking/view/
   trunk/examples/metawidget/groovybooking/view/book.xhtml
   trunk/examples/metawidget/groovybooking/view/confirm.xhtml
   trunk/examples/metawidget/groovybooking/view/hotel.xhtml
   trunk/examples/metawidget/groovybooking/view/main.xhtml
   trunk/examples/metawidget/metawidget-backend.jar
   trunk/examples/metawidget/metawidget-frontend.jar
   trunk/examples/metawidget/metawidget.jar
   trunk/examples/metawidget/readme.txt
Log:
JBSEAM-4051



Property changes on: trunk/examples/metawidget/booking
___________________________________________________________________
Name: svn:ignore
   + dist
exploded-archives
staging


Added: trunk/examples/metawidget/booking/build.properties
===================================================================
--- trunk/examples/metawidget/booking/build.properties	                        (rev 0)
+++ trunk/examples/metawidget/booking/build.properties	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1 @@
+# Define overrides here

Added: trunk/examples/metawidget/booking/build.xml
===================================================================
--- trunk/examples/metawidget/booking/build.xml	                        (rev 0)
+++ trunk/examples/metawidget/booking/build.xml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<project name="Seam Metawidget Booking" default="deploy" basedir=".">
+
+    <!-- Naming -->
+    <property name="Name"                   value="Seam Metawidget Booking Example"/>
+    <property name="example.name"           value="jboss-seam-metawidget-booking"/>
+
+    <property file="${basedir}/build.properties" />
+
+    <!-- Define location of merged source -->
+    <property name="staging.dir" value="${basedir}/staging"/>
+    <property name="src.java.dir" value="${staging.dir}/src"/>
+    <property name="src.test.dir" value="${src.java.dir}"/>
+    <property name="view.dir" value="${staging.dir}/view"/>
+    <property name="resources.dir" value="${staging.dir}/resources"/>
+    <property name="clean.extra" value="${staging.dir}"/>
+    
+    <!-- Libraries to include -->
+    <property name="seam.ui.lib" value="yes"/>
+    <property name="seam.debug.lib" value="yes"/>
+    <property name="facelets.lib" value="yes"/>
+    <property name="richfaces.lib" value="yes"/>
+    <!--<property name="metawidget-ear.lib"   value="yes"/>-->
+    
+    <!-- Datasource -->
+    <property name="example.ds" value="jboss-seam-metawidget-booking-ds.xml"/>
+
+    <target name="build">
+
+        <!-- Copy the original Seam booking example -->
+        <copy todir="${staging.dir}">
+            <fileset dir="${seam.dir}/examples/booking">
+                <include name="src/**"/>
+                <include name="view/**"/>
+                <include name="resources/**"/>
+            </fileset>
+        </copy>
+        
+        <!-- Copy metawidget example overrides -->
+        <copy todir="${staging.dir}" overwrite="true">
+            <fileset dir=".">
+                <include name="src/**"/>
+                <include name="view/**"/>
+                <include name="resources/**"/>
+            </fileset>
+        </copy>
+        
+        <move file="${resources.dir}/jboss-seam-booking-ds.xml" tofile="${resources.dir}/${example.ds}"/>
+    </target>
+    
+    <import file="${basedir}/../../build.xml"/>
+
+    <path id="build.classpath.extras">
+        <fileset dir="${basedir}/..">
+            <include name="metawidget.jar"/>
+        </fileset>
+    </path>
+
+    <fileset id="ear.lib.extras" dir="${basedir}/..">
+        <include name="metawidget-backend.jar"/>
+    </fileset>
+
+    <fileset id="war.lib.extras" dir="${basedir}/..">
+        <include name="metawidget-frontend.jar"/>
+    </fileset>
+
+</project>

Added: trunk/examples/metawidget/booking/readme.txt
===================================================================
--- trunk/examples/metawidget/booking/readme.txt	                        (rev 0)
+++ trunk/examples/metawidget/booking/readme.txt	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,34 @@
+Seam Metawidget Booking Example
+===============================
+
+This example demonstrates the use of Seam in a Java EE 5 environment.
+Transaction and persistence context management is handled by the EJB container.
+Forms are layed out using Metawidget.
+
+The source files in this example are just the overrides needed to utilize
+metawidget. Before you can deploy the example, you have to merge these
+overrides with the original groovybooking source code in a staging directory.
+That is done using the following command:
+
+  ant build
+
+This example runs on JBoss AS as an EAR or Tomcat with JBoss Embedded as a WAR.
+
+ example.name=booking
+
+To deploy this application to a cluster, first follow the steps 1-9 clustering-howto.txt in the root folder of the Seam distribution. Then execute the following command:
+
+ ant farm
+
+This command will deploy the archive to the farm directory of the "all" JBoss AS domain. To undeploy, run the following command:
+
+ ant unfarm
+
+HTTP session replication is enabled by default. You can disable it with the following commandline switch:
+
+ -Dsession.replication=false
+
+You can also toggle Seam's ManagedEntityInterceptor for any deployment with the following commandline switch:
+
+ -Ddistributable=false
+

Added: trunk/examples/metawidget/booking/resources/META-INF/application.xml
===================================================================
--- trunk/examples/metawidget/booking/resources/META-INF/application.xml	                        (rev 0)
+++ trunk/examples/metawidget/booking/resources/META-INF/application.xml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application xmlns="http://java.sun.com/xml/ns/javaee" 
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
+             version="5">
+             
+    <display-name>Seam Metawidget Booking</display-name>
+
+    <module>
+        <web>
+            <web-uri>jboss-seam-metawidget-booking.war</web-uri>
+            <context-root>/seam-metawidget-booking</context-root>
+        </web>
+    </module>
+    
+    <module>
+        <ejb>jboss-seam-metawidget-booking.jar</ejb>
+    </module>
+    
+    <module>
+        <ejb>jboss-seam.jar</ejb>
+    </module>
+
+</application>

Added: trunk/examples/metawidget/booking/resources/WEB-INF/inspector-config.xml
===================================================================
--- trunk/examples/metawidget/booking/resources/WEB-INF/inspector-config.xml	                        (rev 0)
+++ trunk/examples/metawidget/booking/resources/WEB-INF/inspector-config.xml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<inspector-config xmlns="http://metawidget.org/inspector-config"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://metawidget.org/inspector-config http://metawidget.org/inspector-config/inspector-config-1.0.xsd" version="1.0">
+
+	<compositeInspector xmlns="java:org.metawidget.inspector.composite" config="CompositeInspectorConfig">
+		<inspectors>
+			<metawidgetAnnotationInspector xmlns="java:org.metawidget.inspector.annotation"/>
+			<propertyTypeInspector xmlns="java:org.metawidget.inspector.propertytype"/>
+			<facesInspector xmlns="java:org.metawidget.inspector.faces"/>
+			<jpaInspector xmlns="java:org.metawidget.inspector.jpa"/>
+			<hibernateValidatorInspector xmlns="java:org.metawidget.inspector.hibernate.validator"/>
+		</inspectors>
+	</compositeInspector>
+
+</inspector-config>
\ No newline at end of file

Added: trunk/examples/metawidget/booking/src/org/jboss/seam/example/booking/Booking.java
===================================================================
--- trunk/examples/metawidget/booking/src/org/jboss/seam/example/booking/Booking.java	                        (rev 0)
+++ trunk/examples/metawidget/booking/src/org/jboss/seam/example/booking/Booking.java	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,219 @@
+//$Id: Booking.java 5579 2007-06-27 00:06:49Z gavin $
+package org.jboss.seam.example.booking;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.util.Date;
+
+import javax.persistence.Basic;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.NotNull;
+import org.hibernate.validator.Pattern;
+import org.jboss.seam.annotations.Name;
+
+import org.metawidget.inspector.annotation.*;
+import org.metawidget.inspector.faces.*;
+
+ at Entity
+ at Name("booking")
+public class Booking implements Serializable
+{
+   private Long id;
+   private User user;
+   private Hotel hotel;
+   private Date checkinDate;
+   private Date checkoutDate;
+   private String creditCard;
+   private String creditCardName;
+   private int creditCardExpiryMonth;
+   private int creditCardExpiryYear;
+   private boolean smoking;
+   private int beds;
+   
+   public Booking() {}
+   
+   public Booking(Hotel hotel, User user)
+   {
+      this.hotel = hotel;
+      this.user = user;
+   }
+   
+   @Transient
+   @UiHidden   
+   @UiFacesNumberConverter(type="currency",currencySymbol="$")
+   @UiLabel("Total payment")
+   public BigDecimal getTotal()
+   {
+      return hotel.getPrice().multiply( new BigDecimal( getNights() ) );
+   }
+
+   @Transient
+   @UiHidden
+   public int getNights()
+   {
+      return (int) ( checkoutDate.getTime() - checkinDate.getTime() ) / 1000 / 60 / 60 / 24;
+   }
+
+   @Id @GeneratedValue
+   public Long getId()
+   {
+      return id;
+   }
+   public void setId(Long id)
+   {
+      this.id = id;
+   }
+   
+   @NotNull
+   @Basic @Temporal(TemporalType.DATE) 
+   @UiComesAfter( "total" )
+   @UiFacesDateTimeConverter( pattern = "MM/dd/yyyy" )
+   public Date getCheckinDate()
+   {
+      return checkinDate;
+   }
+   public void setCheckinDate(Date datetime)
+   {
+      this.checkinDate = datetime;
+   }
+
+   @ManyToOne @NotNull
+   @UiHidden
+   public Hotel getHotel()
+   {
+      return hotel;
+   }
+   public void setHotel(Hotel hotel)
+   {
+      this.hotel = hotel;
+   }
+   
+   @ManyToOne @NotNull
+   @UiHidden
+   public User getUser()
+   {
+      return user;
+   }
+   public void setUser(User user)
+   {
+      this.user = user;
+   }
+   
+   @Basic @Temporal(TemporalType.DATE) 
+   @NotNull
+   @UiComesAfter( "checkinDate" )
+   @UiFacesDateTimeConverter( pattern = "MM/dd/yyyy" )
+   public Date getCheckoutDate()
+   {
+      return checkoutDate;
+   }
+   public void setCheckoutDate(Date checkoutDate)
+   {
+      this.checkoutDate = checkoutDate;
+   }
+   
+   @NotNull(message="Credit card number is required")
+   @Length(min=16, max=16, message="Credit card number must 16 digits long")
+   @Pattern(regex="^\\d*$", message="Credit card number must be numeric")
+   @UiComesAfter( "smoking" )
+   @UiLabel( "Credit card #" )
+   public String getCreditCard()
+   {
+      return creditCard;
+   }
+
+   public void setCreditCard(String creditCard)
+   {
+      this.creditCard = creditCard;
+   }
+   
+   @Transient
+   @UiHidden   
+   public String getDescription()
+   {
+      DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
+      return hotel==null ? null : hotel.getName() + 
+            ", " + df.format( getCheckinDate() ) + 
+            " to " + df.format( getCheckoutDate() );
+   }
+
+   @UiLookup( value = { "true", "false" }, labels = { "Smoking", "Non Smoking" } )
+   @UiFacesComponent( "javax.faces.HtmlSelectOneRadio" )
+   @UiComesAfter( "beds" )
+   public boolean isSmoking()
+   {
+      return smoking;
+   }
+
+   public void setSmoking(boolean smoking)
+   {
+      this.smoking = smoking;
+   }
+   
+   @UiLabel( "Room preference" )
+   @UiComesAfter( "checkoutDate" )
+   @UiLookup( value = { "1", "2", "3" }, labels = { "One king-size bed", "Two double beds", "Three beds" } )
+   public int getBeds()
+   {
+      return beds;
+   }
+
+   public void setBeds(int beds)
+   {
+      this.beds = beds;
+   }
+   @NotNull(message="Credit card name is required")
+   @Length(min=3, max=70)
+   @UiComesAfter( "creditCard" )
+   public String getCreditCardName()
+   {
+      return creditCardName;
+   }
+
+   public void setCreditCardName(String creditCardName)
+   {
+      this.creditCardName = creditCardName;
+   }
+
+   @UiLookup( value = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }, labels = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } )
+   @UiComesAfter( "creditCardName" )
+   @UiLabel( "Expiry month" )
+   public int getCreditCardExpiryMonth()
+   {
+      return creditCardExpiryMonth;
+   }
+
+   public void setCreditCardExpiryMonth(int creditCardExpiryMonth)
+   {
+      this.creditCardExpiryMonth = creditCardExpiryMonth;
+   }
+
+   @UiComesAfter( "creditCardExpiryMonth" )   
+   @UiLookup( { "2005", "2006", "2007", "2008", "2009" } )
+   @UiLabel( "Expiry year" )
+   public int getCreditCardExpiryYear()
+   {
+      return creditCardExpiryYear;
+   }
+
+   public void setCreditCardExpiryYear(int creditCardExpiryYear)
+   {
+      this.creditCardExpiryYear = creditCardExpiryYear;
+   }
+   
+   @Override
+   public String toString()
+   {
+      return "Booking(" + user + ","+ hotel + ")";
+   }
+
+}

Added: trunk/examples/metawidget/booking/src/org/jboss/seam/example/booking/Hotel.java
===================================================================
--- trunk/examples/metawidget/booking/src/org/jboss/seam/example/booking/Hotel.java	                        (rev 0)
+++ trunk/examples/metawidget/booking/src/org/jboss/seam/example/booking/Hotel.java	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,125 @@
+//$Id: Hotel.java 5579 2007-06-27 00:06:49Z gavin $
+package org.jboss.seam.example.booking;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.NotNull;
+import org.jboss.seam.annotations.Name;
+
+import org.metawidget.inspector.annotation.*;
+import org.metawidget.inspector.faces.*;
+
+ at Entity
+ at Name("hotel")
+public class Hotel implements Serializable
+{
+   private Long id;
+   private String name;
+   private String address;
+   private String city;
+   private String state;
+   private String zip;
+   private String country;
+   private BigDecimal price;
+   
+   @Id @GeneratedValue
+   public Long getId()
+   {
+      return id;
+   }
+   public void setId(Long id)
+   {
+      this.id = id;
+   }
+   
+   @Length(max=50) @NotNull
+   public String getName()
+   {
+      return name;
+   }
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+   
+   @Length(max=100) @NotNull
+   @UiComesAfter("name")
+   public String getAddress()
+   {
+      return address;
+   }
+   public void setAddress(String address)
+   {
+      this.address = address;
+   }
+
+   @Length(max=40) @NotNull
+   @UiComesAfter("address")
+   public String getCity()
+   {
+      return city;
+   }
+   public void setCity(String city)
+   {
+      this.city = city;
+   }
+
+   @Length(min=4, max=6) @NotNull
+   @UiComesAfter("state")
+   public String getZip()
+   {
+      return zip;
+   }
+   public void setZip(String zip)
+   {
+      this.zip = zip;
+   }
+
+   @Length(min=2, max=10) @NotNull
+   @UiComesAfter("city")
+   public String getState()
+   {
+      return state;
+   }
+   public void setState(String state)
+   {
+      this.state = state;
+   }
+
+   @Length(min=2, max=40) @NotNull
+   @UiComesAfter("zip")
+   public String getCountry()
+   {
+      return country;
+   }
+   public void setCountry(String country)
+   {
+      this.country = country;
+   }
+
+   @Column(precision=6, scale=2)
+   @UiComesAfter("country")
+   @UiFacesNumberConverter(type="currency",currencySymbol="$")
+   @UiLabel("Nightly rate")
+   public BigDecimal getPrice()
+   {
+      return price;
+   }
+   public void setPrice(BigDecimal price)
+   {
+      this.price = price;
+   }
+
+   @Override
+   public String toString()
+   {
+      return "Hotel(" + name + "," + address + "," + city + "," + zip + ")";
+   }
+}

Added: trunk/examples/metawidget/booking/view/book.xhtml
===================================================================
--- trunk/examples/metawidget/booking/view/book.xhtml	                        (rev 0)
+++ trunk/examples/metawidget/booking/view/book.xhtml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,65 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+	    		xmlns:ui="http://java.sun.com/jsf/facelets"
+	  			xmlns:h="http://java.sun.com/jsf/html"
+	  			xmlns:f="http://java.sun.com/jsf/core"
+	  			xmlns:s="http://jboss.com/products/seam/taglib"
+                xmlns:a="http://richfaces.org/a4j"
+                xmlns:rich="http://richfaces.org/rich"
+                xmlns:m="http://metawidget.org/faces/richfaces"
+				template="template.xhtml">
+
+<!-- content -->
+<ui:define name="content">
+<div class="section">
+	<h1>Book Hotel</h1>
+</div>
+<div class="section">
+	<div class="entry errors">
+		<h:messages id="messages" globalOnly="true"/>
+	</div>
+
+	<ui:include src="hotelview.xhtml"/>
+	
+	<div style="clear:both"/>
+
+	<h:form id="booking">
+	<fieldset>
+	
+		<s:validateAll>
+	
+			<m:metawidget value="#{booking}" rendererType="div" validatorClass="org.metawidget.faces.component.validator.RequiredValidator">
+				<f:param name="divStyleClasses" value="entry,label,required,input,error errors"/>
+			</m:metawidget>
+			
+		</s:validateAll>			
+		
+		<div class="buttonBox">
+			<h:commandButton id="proceed" value="Proceed" action="#{hotelBooking.setBookingDetails}"/>
+			&#160;
+			<s:button id="cancel" value="Cancel" action="#{hotelBooking.cancel}"/>
+		</div>
+		
+	</fieldset>
+	</h:form>
+</div>
+</ui:define>
+
+<!-- sidebar -->
+<ui:define name="sidebar">
+
+<h1>Workspace management</h1>
+<p>
+   As you can see, Seam makes it easy to work in multiple windows or multiple browser 
+   tabs. But you can even switch between multiple tasks inside a single browser tab!
+   The "Workspaces" section showcases this advanced feature.
+</p>
+<p>
+   <a href="#" onclick="window.open('exp/workspaceExp.html','exp','width=752,height=500,scrollbars=yes');">
+	  How does the workspace list work?
+   </a>
+</p>
+
+</ui:define>
+
+</ui:composition>

Added: trunk/examples/metawidget/booking/view/confirm.xhtml
===================================================================
--- trunk/examples/metawidget/booking/view/confirm.xhtml	                        (rev 0)
+++ trunk/examples/metawidget/booking/view/confirm.xhtml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,60 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+	    		xmlns:ui="http://java.sun.com/jsf/facelets"
+	  			xmlns:h="http://java.sun.com/jsf/html"
+	  			xmlns:f="http://java.sun.com/jsf/core"
+                xmlns:s="http://jboss.com/products/seam/taglib"
+                xmlns:m="http://metawidget.org/faces/richfaces"
+				template="template.xhtml">
+
+<!-- content -->
+<ui:define name="content">
+
+<div class="section">
+	<h1>Confirm Hotel Booking</h1>
+</div>
+
+<div class="section">
+
+	<ui:include src="hotelview.xhtml"/>
+
+	<m:metawidget value="#{booking}" rendererType="div" readOnly="#{true}">
+		<f:param name="divStyleClasses" value="entry,label,required,input"/>
+		<h:outputText value="#{booking.total}"/>
+		<m:stub value="#{booking.creditCardExpiryMonth}"/>
+		<m:stub value="#{booking.creditCardExpiryYear}"/>
+	</m:metawidget>
+			
+	<div class="buttonBox">
+		<h:form id="confirm">
+			<h:commandButton id="confirm" value="Confirm" action="#{hotelBooking.confirm}"/>
+			&#160;
+    		<s:button id="revise" value="Revise" view="/book.xhtml"/>
+    		&#160;
+    		<h:commandButton id="cancel" value="Cancel" action="#{hotelBooking.cancel}"/>
+		</h:form>
+	</div>
+
+</div>
+
+</ui:define>
+
+<!-- sidebar -->
+<ui:define name="sidebar">
+<h1>Back button navigation</h1>
+<p>
+   When you click "Confirm", the new booking is written to the database, the 
+   conversation ends, and state associated with the conversation is automatically 
+   destroyed by Seam. After you confirm your booking, try hitting the back button
+   on your web browser and clicking "Confirm" again. Seam makes it easy implement
+   applications that behave elegantly in response to the back, forward and refresh
+   buttons.
+</p>
+<p>
+   <a href="#" onclick="window.open('exp/confirmExp.html','exp','width=752,height=500,scrollbars=yes');">
+      What happens when the conversation ends?
+   </a>
+</p>
+</ui:define>
+
+</ui:composition>

Added: trunk/examples/metawidget/booking/view/hotelview.xhtml
===================================================================
--- trunk/examples/metawidget/booking/view/hotelview.xhtml	                        (rev 0)
+++ trunk/examples/metawidget/booking/view/hotelview.xhtml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,11 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+	    		 xmlns:ui="http://java.sun.com/jsf/facelets"
+	  			 xmlns:f="http://java.sun.com/jsf/core"
+                 xmlns:m="http://metawidget.org/faces/richfaces">
+    
+	<m:metawidget value="#{hotel}" rendererType="div" readOnly="#{true}">
+		<f:param name="divStyleClasses" value="entry,label,required,input"/>
+	</m:metawidget>
+	  
+</ui:composition>

Added: trunk/examples/metawidget/booking/view/main.xhtml
===================================================================
--- trunk/examples/metawidget/booking/view/main.xhtml	                        (rev 0)
+++ trunk/examples/metawidget/booking/view/main.xhtml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,139 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+	    		xmlns:ui="http://java.sun.com/jsf/facelets"
+	  			xmlns:h="http://java.sun.com/jsf/html"
+	  			xmlns:f="http://java.sun.com/jsf/core"
+	  			xmlns:s="http://jboss.com/products/seam/taglib"
+                xmlns:a="http://richfaces.org/a4j"
+				template="template.xhtml">
+
+<!-- content -->
+<ui:define name="content">
+
+<div class="section">
+  
+    <span class="errors">
+       <h:messages id="messages" globalOnly="true"/>
+    </span>
+    
+    <h1>Search Hotels</h1>
+
+	<h:form id="searchCriteria">
+	<fieldset> 
+	   <h:inputText id="searchString" value="#{hotelSearch.searchString}" style="width: 165px;">
+         <a:support id="onkeyup" event="onkeyup" actionListener="#{hotelSearch.find}" reRender="searchResults" />
+       </h:inputText>
+       &#160;
+	   <h:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}"/>
+       &#160;
+       <a:status id="status">
+          <f:facet id="StartStatus" name="start">
+             <h:graphicImage id="SpinnerGif" value="/img/spinner.gif"/>
+          </f:facet>
+       </a:status>
+	   <br/>
+       <h:outputLabel id="MaximumResultsLabel" for="pageSize">Maximum results:</h:outputLabel>&#160;
+       <h:selectOneMenu id="pageSize" value="#{hotelSearch.pageSize}">
+          <f:selectItem id="PageSize5" itemLabel="5" itemValue="5"/>
+          <f:selectItem id="PageSize10" itemLabel="10" itemValue="10"/>
+          <f:selectItem id="PageSize20" itemLabel="20" itemValue="20"/>
+       </h:selectOneMenu>
+    </fieldset>
+    </h:form>
+    
+</div>
+
+<a:outputPanel id="searchResults">
+  <div class="section">
+	<h:outputText id="NoHotelsFoundMessage" value="No Hotels Found" rendered="#{hotels != null and hotels.rowCount==0}"/>
+	<h:dataTable id="hotels" value="#{hotels}" var="hot" rendered="#{hotels.rowCount>0}">
+		<h:column id="column1">
+			<f:facet id="NameFacet" name="header">Name</f:facet>
+			#{hot.name}
+		</h:column>
+		<h:column id="column2">
+			<f:facet id="AddressFacet" name="header">Address</f:facet>
+			#{hot.address}
+		</h:column>
+		<h:column id="column3">
+			<f:facet id="CityStateFacet" name="header">City, State</f:facet>
+			#{hot.city}, #{hot.state}, #{hot.country}
+		</h:column> 
+		<h:column id="column4">
+			<f:facet id="ZipFacet" name="header">Zip</f:facet>
+			#{hot.zip}
+		</h:column>
+		<h:column id="column5">
+			<f:facet id="ActionFacet" name="header">Action</f:facet>
+			<s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>
+		</h:column>
+	</h:dataTable>
+	<s:link id="MoreResultsLink" value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}"/>
+  </div>
+</a:outputPanel>
+
+<div class="section">
+	<h1>Current Hotel Bookings</h1>
+</div>
+<div class="section">
+  <h:form id="bookings">
+	<h:outputText id="NoBookingsFoundMessage" value="No Bookings Found" rendered="#{bookings.rowCount==0}"/>
+	<h:dataTable id="bookings" value="#{bookings}" var="book" rendered="#{bookings.rowCount>0}">
+		<h:column id="column1">
+			<f:facet id="NameFacet" name="header">Name</f:facet>
+			#{book.hotel.name}
+		</h:column>
+		<h:column id="column2">
+			<f:facet id="AddressFacet" name="header">Address</f:facet>
+			#{book.hotel.address}
+		</h:column>
+		<h:column id="column3">
+			<f:facet id="CityStateFacet" name="header">City, State</f:facet>
+			#{book.hotel.city}, #{book.hotel.state}
+		</h:column>
+        <h:column id="column4">
+            <f:facet id="CheckInDateFacet" name="header">Check in date</f:facet>
+            <h:outputText id="BookingCheckInDate" value="#{book.checkinDate}"/>
+        </h:column>
+        <h:column id="column5">
+            <f:facet id="CheckOutDateFacet" name="header">Check out date</f:facet>
+            <h:outputText id="BookingCheckOutDate" value="#{book.checkoutDate}"/>
+        </h:column>
+		<h:column id="column6">
+			<f:facet id="ConfNumberFacet" name="header">Confirmation number</f:facet>
+			#{book.id}
+		</h:column>
+		<h:column id="column7">
+			<f:facet id="ActionFacet" name="header">Action</f:facet>
+			<h:commandLink id="cancel" value="Cancel" action="#{bookingList.cancel}"/>
+		</h:column>
+	</h:dataTable>
+  </h:form>
+</div>
+
+</ui:define>
+
+<!-- sidebar -->
+<ui:define name="sidebar">
+
+<h1>State management in Seam</h1>
+<p>
+   State in Seam is <em>contextual</em>. When you click "Find Hotels", the application
+   retrieves a list of hotels from the database and caches it in the session context. When you
+   navigate to one of the hotel records by clicking the "View Hotel" link, a <em>conversation</em> 
+   begins. The conversation is attached to a particular tab, in a particular browser window. You can
+   navigate to multiple hotels using "open in new tab" or "open in new window" in your web browser.
+   Each window will execute in the context of a different conversation. The application keeps state
+   associated with your hotel booking in the conversation context, which ensures that the concurrent
+   conversations do not interfere with each other.
+</p>
+
+<p>
+   <a href="#" onclick="window.open('exp/mainExp.html','exp','width=752,height=500,scrollbars=yes');">
+      How does the search page work?
+   </a>
+</p>
+
+</ui:define>
+
+</ui:composition>


Property changes on: trunk/examples/metawidget/dvdstore
___________________________________________________________________
Name: svn:ignore
   + dist
exploded-archives
staging


Added: trunk/examples/metawidget/dvdstore/build.properties
===================================================================
--- trunk/examples/metawidget/dvdstore/build.properties	                        (rev 0)
+++ trunk/examples/metawidget/dvdstore/build.properties	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1 @@
+# Define overrides here

Added: trunk/examples/metawidget/dvdstore/build.xml
===================================================================
--- trunk/examples/metawidget/dvdstore/build.xml	                        (rev 0)
+++ trunk/examples/metawidget/dvdstore/build.xml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<project name="Metawidget DVD Store" default="deploy" basedir=".">
+
+    <!-- Naming -->
+    <property name="Name"                   value="Seam DVD Store Example"/>
+    <property name="example.name"           value="jboss-seam-metawidget-dvdstore"/>
+
+    <property file="${basedir}/build.properties" />
+
+    <!-- Define location of merged source -->
+    <property name="staging.dir" value="${basedir}/staging"/>
+    <property name="src.java.dir" value="${staging.dir}/src"/>
+    <property name="src.test.dir" value="${src.java.dir}"/>
+    <property name="view.dir" value="${staging.dir}/view"/>
+    <property name="resources.dir" value="${staging.dir}/resources"/>
+    <property name="clean.extra" value="${staging.dir}"/>
+    
+    <!-- Libraries to include -->
+    <property name="seam.ui.lib" value="yes"/>
+    <property name="seam.debug.lib" value="yes"/>
+    <property name="facelets.lib" value="yes"/>
+    <property name="jbpm.lib" value="yes"/>
+    <property name="search.lib" value="yes"/>
+    <property name="urlrewrite.lib" value="yes"/>
+    <!--<property name="metawidget-ear.lib" value="yes"/>-->
+    
+    <!-- Datasource -->
+    <property name="example.ds" value="jboss-seam-metawidget-dvdstore-ds.xml"/>
+
+    <target name="build">
+
+        <!-- Copy the original Seam booking example -->
+        <copy todir="${staging.dir}">
+            <fileset dir="${seam.dir}/examples/dvdstore">
+                <include name="src/**"/>
+                <include name="view/**"/>
+                <include name="resources/**"/>
+            </fileset>
+        </copy>
+        
+        <!-- Copy metawidget example overrides -->
+        <copy todir="${staging.dir}" overwrite="true">
+            <fileset dir=".">
+                <include name="src/**"/>
+                <include name="view/**"/>
+                <include name="resources/**"/>
+            </fileset>
+        </copy>
+        
+        <move file="${resources.dir}/jboss-seam-dvdstore-ds.xml" tofile="${resources.dir}/${example.ds}"/>
+    </target>
+    
+    <import file="${basedir}/../../build.xml"/>
+
+    <path id="build.classpath.extras">
+        <fileset dir="${basedir}/..">
+            <include name="metawidget.jar"/>
+        </fileset>
+    </path>
+
+    <fileset id="ear.lib.extras" dir="${basedir}/..">
+        <include name="metawidget-backend.jar"/>
+    </fileset>
+
+    <fileset id="war.lib.extras" dir="${basedir}/..">
+        <include name="metawidget-frontend.jar"/>
+    </fileset>
+
+</project>

Added: trunk/examples/metawidget/dvdstore/readme.txt
===================================================================
--- trunk/examples/metawidget/dvdstore/readme.txt	                        (rev 0)
+++ trunk/examples/metawidget/dvdstore/readme.txt	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,15 @@
+Seam Metawidget DVD Store Example
+=================================
+
+This example demonstrates the use of Seam with jBPM pageflow and business
+process management. It uses metawidget to layout the forms. The example runs on
+JBoss AS as an EAR and Tomcat with Embedded JBoss as a WAR.
+
+example.name=dvdstore
+
+The source files in this example are just the overrides needed to utilize
+metawidget. Before you can deploy the example, you have to merge these
+overrides with the original groovybooking source code in a staging directory.
+That is done using the following command:
+
+  ant build

Added: trunk/examples/metawidget/dvdstore/resources/META-INF/application.xml
===================================================================
--- trunk/examples/metawidget/dvdstore/resources/META-INF/application.xml	                        (rev 0)
+++ trunk/examples/metawidget/dvdstore/resources/META-INF/application.xml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application xmlns="http://java.sun.com/xml/ns/javaee" 
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
+             version="5">
+    
+    <display-name>Metawidget DVD Store</display-name>
+    
+    <module>
+        <ejb>jboss-seam-metawidget-dvdstore.jar</ejb>
+    </module>
+    
+    <module>
+        <web>
+            <web-uri>jboss-seam-metawidget-dvdstore.war</web-uri>
+            <context-root>/seam-metawidget-dvdstore</context-root>
+        </web>
+    </module>
+    
+    <module>
+        <ejb>jboss-seam.jar</ejb>
+    </module>
+    
+</application>

Added: trunk/examples/metawidget/dvdstore/resources/WEB-INF/inspector-config.xml
===================================================================
--- trunk/examples/metawidget/dvdstore/resources/WEB-INF/inspector-config.xml	                        (rev 0)
+++ trunk/examples/metawidget/dvdstore/resources/WEB-INF/inspector-config.xml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<inspector-config xmlns="http://metawidget.org/inspector-config"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://metawidget.org/inspector-config http://metawidget.org/inspector-config/inspector-config-1.0.xsd" version="1.0">
+
+	<compositeInspector xmlns="java:org.metawidget.inspector.composite" config="CompositeInspectorConfig">
+		<inspectors>
+			<metawidgetAnnotationInspector xmlns="java:org.metawidget.inspector.annotation"/>
+			<propertyTypeInspector xmlns="java:org.metawidget.inspector.propertytype"/>
+			<facesInspector xmlns="java:org.metawidget.inspector.faces"/>
+			<jpaInspector xmlns="java:org.metawidget.inspector.jpa"/>
+			<hibernateValidatorInspector xmlns="java:org.metawidget.inspector.hibernate.validator"/>
+			<jbpmInspector xmlns="java:org.metawidget.inspector.jbpm" config="JbpmInspectorConfig">
+				<files>
+					<string>checkout.jpdl.xml</string>
+					<string>newuser.jpdl.xml</string>
+				</files>
+			</jbpmInspector>
+		</inspectors>
+	</compositeInspector>
+
+</inspector-config>
\ No newline at end of file

Added: trunk/examples/metawidget/dvdstore/src/com/jboss/dvd/seam/Customer.java
===================================================================
--- trunk/examples/metawidget/dvdstore/src/com/jboss/dvd/seam/Customer.java	                        (rev 0)
+++ trunk/examples/metawidget/dvdstore/src/com/jboss/dvd/seam/Customer.java	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,175 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */ 
+package com.jboss.dvd.seam;
+
+import java.io.Serializable;
+
+import javax.persistence.*;
+
+import org.jboss.seam.annotations.Name;
+import org.hibernate.validator.*;
+import org.metawidget.inspector.annotation.*;
+import org.metawidget.inspector.faces.*;
+
+ at Entity
+ at Name("customer")
+ at DiscriminatorValue("customer")
+public class Customer
+    extends User
+    implements Serializable
+{
+    private static final long serialVersionUID = 5699525147178760355L;
+
+    public static String[] cctypes = {"MasterCard", "Visa", "Discover", "Amex", "Dell Preferred"}; 
+
+    String  address1;
+    String  address2;
+    String  city;
+    String  state;
+    String  zip;  
+
+    String  email;
+    String  phone;
+
+    Integer creditCardType = 1;
+    String  creditCard     = "000-0000-0000";
+    int     ccMonth        = 1;
+    int     ccYear         = 2005;
+
+
+    public Customer() {
+    }
+
+
+    @Column(name="ADDRESS1",length=50)
+    @NotNull
+    @UiComesAfter("lastName")
+    public String getAddress1() {
+        return address1;
+    }
+    public void setAddress1(String address1) {
+        this.address1 = address1;
+    }
+
+    @Column(name="ADDRESS2",length=50)
+    @NotNull
+    @UiComesAfter("address1")
+    public String getAddress2() {
+        return address2;
+    }
+    public void setAddress2(String address2) {
+        this.address2 = address2;
+    }
+
+    @Column(name="CITY",length=50)  
+    @NotNull
+    @UiComesAfter("address2")
+    public String getCity() {
+        return city;
+    }
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+
+    @Column(name="STATE",length=2)
+    @NotNull
+    @Length(min=2,max=2)
+    @UiComesAfter("city")
+    public String getState() {
+        return state;
+    }
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    @Column(name="ZIP", length=10)
+    @Length(min=5, max=10)
+    @Pattern(regex="[0-9]{5}(-[0-9]{4})?", message="not a valid zipcode") // {validator.zip}
+    @NotNull
+    @UiComesAfter("state")
+    public String getZip() {
+        return zip;
+    }
+    public void setZip(String zip) {
+        this.zip = zip;
+    }
+
+    @Column(name="EMAIL",length=50)
+    @Email
+    @UiComesAfter("zip")
+    public String getEmail() {
+        return email;
+    }
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    @Column(name="PHONE",length=50)
+    @UiComesAfter("email")
+    public String getPhone() {
+        return phone;
+    }
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+
+    @Column(name="CREDITCARDTYPE")
+    @UiFacesLookup("#{editCustomer.creditCardTypes}")
+    public Integer getCreditCardType() {
+        return creditCardType;
+    }
+    public void setCreditCardType(Integer type) {
+        this.creditCardType = type;
+    }
+
+    @Transient @UiHidden public String getCreditCardTypeString() {
+        if (creditCardType<1 || creditCardType>cctypes.length) {
+            return "";
+        }
+        return cctypes[creditCardType-1];
+    }
+
+    @Column(name="CC_NUM", length=50)
+    public String getCreditCard() {
+        return creditCard;
+    }
+    public void setCreditCard(String creditCard) {
+        this.creditCard = creditCard;
+    }
+
+    @Column(name="CC_MONTH", length=50)
+    @UiLookup( value = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }, labels = { "#{messages.mo_1}", "#{messages.mo_2}", "#{messages.mo_3}", "#{messages.mo_4}", "#{messages.mo_5}", "#{messages.mo_6}", "#{messages.mo_7}", "#{messages.mo_8}", "#{messages.mo_9}", "#{messages.mo_10}", "#{messages.mo_11}", "#{messages.mo_12}" } )    
+    public int getCreditCardMonth() {
+        return ccMonth;
+    }
+    public void setCreditCardMonth(int ccMonth) {
+        this.ccMonth = ccMonth;
+    }
+
+    @Column(name="CC_YEAR", length=50)
+    @UiLookup( { "2005", "2006", "2007", "2008", "2009", "2010" } )
+    public int getCreditCardYear() {
+        return ccYear;
+    }
+    public void setCreditCardYear(int ccYear) {
+        this.ccYear = ccYear;
+    }
+
+    @Transient
+    @UiHidden
+    public String getCreditCardExpiration() {
+        return "" + ccMonth + "/" + ccYear;
+    }
+
+    @Override
+    public String toString() {
+        return "Customer#" + getId() + "(" + userName + ")";
+    }
+
+}

Added: trunk/examples/metawidget/dvdstore/src/com/jboss/dvd/seam/EditCustomer.java
===================================================================
--- trunk/examples/metawidget/dvdstore/src/com/jboss/dvd/seam/EditCustomer.java	                        (rev 0)
+++ trunk/examples/metawidget/dvdstore/src/com/jboss/dvd/seam/EditCustomer.java	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */ 
+package com.jboss.dvd.seam;
+
+import java.util.Map;
+
+import javax.ejb.Local;
+
+import org.hibernate.validator.*;
+import org.metawidget.inspector.annotation.*;
+
+ at Local
+public interface EditCustomer
+{
+    public void startEdit();
+
+    public Map<String,Integer> getCreditCardTypes();
+
+    public void   setPasswordVerify(String password);
+    
+    @UiMasked
+    @NotNull
+    public String getPasswordVerify();
+
+    public boolean isValidNamePassword();
+
+    public String saveUser();
+
+    public void destroy();
+}

Added: trunk/examples/metawidget/dvdstore/src/com/jboss/dvd/seam/User.java
===================================================================
--- trunk/examples/metawidget/dvdstore/src/com/jboss/dvd/seam/User.java	                        (rev 0)
+++ trunk/examples/metawidget/dvdstore/src/com/jboss/dvd/seam/User.java	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */ 
+package com.jboss.dvd.seam;
+
+import java.io.Serializable;
+
+import javax.persistence.*;
+import org.hibernate.validator.*;
+import org.metawidget.inspector.annotation.*;
+
+ at Entity
+ at Table(name="USERS")
+public abstract class User
+    implements Serializable
+{
+    long    id;
+
+    String  userName;
+    String  password;
+
+    String  firstName;
+    String  lastName;
+
+    @Id @GeneratedValue
+    @Column(name="USERID")
+    public long getId() {
+        return id;
+    }                    
+    public void setId(long id) {
+        this.id = id;
+    }     
+
+    @Column(name="USERNAME",unique=true,nullable=false,length=50)
+    @NotNull 
+    @Length(min=4,max=16)
+    public String getUserName() {
+        return userName;
+    }
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    @Column(name="PASSWORD",nullable=false,length=50)
+    @NotNull
+    @Length(min=6,max=50)
+    @UiMasked
+    public String getPassword() {
+        return password;
+    }
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    @Column(name="FIRSTNAME",length=50)
+    public String getFirstName() {
+        return firstName;
+    }
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+    @Column(name="LASTNAME",length=50)    
+    @UiComesAfter("firstName")
+    public String getLastName() {
+        return lastName;
+    }
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+    
+    @Transient
+    @UiHidden
+    public boolean isAdmin() {
+       return false;
+    }
+}

Added: trunk/examples/metawidget/dvdstore/view/confirm.xhtml
===================================================================
--- trunk/examples/metawidget/dvdstore/view/confirm.xhtml	                        (rev 0)
+++ trunk/examples/metawidget/dvdstore/view/confirm.xhtml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,93 @@
+<!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"
+      xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:f="http://java.sun.com/jsf/core"
+      xmlns:h="http://java.sun.com/jsf/html"
+	  xmlns:m="http://metawidget.org/faces">
+<body>
+    <ui:composition template="/WEB-INF/template.xhtml">
+        <ui:define name="topnav"> 
+            <ui:include src="/WEB-INF/incl/store_nav.xhtml">
+                <ui:param name="page" value="cart" />
+            </ui:include>
+        </ui:define>
+
+        <ui:define name="sidebar">
+            <ui:include src="/WEB-INF/incl/login.xhtml" />
+        </ui:define>
+
+        <ui:define name="body">
+            <h1>Confirm Order</h1>
+            
+            <f:subview id="no_order" rendered="#{currentOrder==null}">
+                <p>You have no order.</p>
+            </f:subview>
+
+            <f:subview id="orderdetail" rendered="#{currentOrder != null}">
+                <h:form id="OrderDetailForm">
+                    <h:dataTable id="OrderDetailDataTable"
+                                 value="#{currentOrder.orderLines}" var="line"
+                                 styleClass="dvdtable" 
+                                 headerClass="dvdtablehead"
+                                 rowClasses="dvdtableodd,dvdtableeven"
+                                 columnClasses="dvdtablecol">
+                        <h:column id="column1">
+                            <f:facet id="TitleFacet" name="header">
+                                <h:outputText id="TitleText" value="#{messages.cartTitleColumn}" />
+                            </f:facet>
+                            <h:outputText id="TitleValue" value="#{line.product.title}" />
+                        </h:column>                        
+                        <h:column id="column2">
+                            <f:facet id="ActorFacet" name="header">
+                                <h:outputText id="ActorText" value="#{messages.cartActorColumn}" />
+                            </f:facet>
+                            <h:outputText id="ActorValue" value="#{line.product.actors[0].name}" />
+                        </h:column>                        
+                        
+                        <h:column id="column3">
+                            <f:facet id="PriceFacet" name="header">
+                                <h:outputText id="PriceText" value="#{messages.cartPriceColumn}" />
+                            </f:facet>
+                            <h:outputText id="PriceValue" value="#{line.product.price}">
+                                <f:convertNumber type="currency" currencySymbol="$" />
+                            </h:outputText>
+                        </h:column>                        
+                        <h:column id="column4">
+                            <f:facet id="QuantityFacet" name="header">
+                                <h:outputText id="QuantityText" value="#{messages.cartQuantityColumn}" />
+                            </f:facet>
+                            <h:outputText id="QuantityValue" value="#{line.quantity}"/>
+                        </h:column>                        
+                    </h:dataTable>
+                </h:form>
+                
+                <div style="width: 100%;">
+                    <div class="cntInfo" style="float:right;">
+                        <h:panelGrid id="CostSummary" columns="2">
+                            <h:outputText id="CartSubtotalText" value="#{messages.checkoutSubtotal}" />
+                            <h:outputText id="CartSubtotalValue" value="#{currentOrder.netAmount}">
+                                <f:convertNumber type="currency" currencySymbol="$" />
+                            </h:outputText>
+                            
+                            <h:outputText id="CartTaxText" value="#{messages.checkoutTax}" />
+                            <h:outputText id="CartTaxValue" value="#{currentOrder.tax}">
+                                <f:convertNumber type="currency" currencySymbol="$" />
+                            </h:outputText>
+                            
+                            <h:outputText id="CartTotalText" value="#{messages.checkoutTotal}" />
+                            <h:outputText id="CartTotalValue" value="#{currentOrder.totalAmount}">
+                                <f:convertNumber type="currency" currencySymbol="$" />
+                            </h:outputText>
+                        </h:panelGrid>
+                        
+                        <h:form id="ConfirmOrCancelForm">
+                        	<m:metawidget value="checkout.confirm" rendererType="simple"/>
+                        </h:form>
+                    </div>
+                </div>
+            </f:subview>            
+        </ui:define>
+    </ui:composition>
+</body>
+</html>

Added: trunk/examples/metawidget/dvdstore/view/newuser/account.xhtml
===================================================================
--- trunk/examples/metawidget/dvdstore/view/newuser/account.xhtml	                        (rev 0)
+++ trunk/examples/metawidget/dvdstore/view/newuser/account.xhtml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,55 @@
+<!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"
+      xmlns:s="http://jboss.com/products/seam/taglib"
+      xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:f="http://java.sun.com/jsf/core"
+      xmlns:h="http://java.sun.com/jsf/html"
+	  xmlns:m="http://metawidget.org/faces">
+<body>
+    <ui:composition template="/WEB-INF/template.xhtml">
+        <ui:define name="topnav">
+            <ui:include src="/WEB-INF/incl/store_nav.xhtml">
+                <ui:param name="page" value="home" />
+            </ui:include>
+        </ui:define>
+
+        <ui:define name="sidebar">
+            <ui:include src="/WEB-INF/incl/login.xhtml" />
+        </ui:define>
+        
+        <ui:define name="body">
+            <h2><h:outputText id="NewCustomerHeader" value="#{messages.newCustomerHeader}" /></h2>
+            
+            <p><em><h:outputText id="NewCustomerInfo" value="#{messages.newCustomerInfo}" /></em></p>
+            
+
+            <p>
+                The user registration wizard uses a 
+                <a onclick="window.open('../img/newuser.html','flowimg','height=580,width=510,toolbar=no,status=no,directories=no,menubar=no,scrollbars=no,resizable=no'); return false;"
+                   href="img/newuser.html">pageflow</a>
+                to define the flow of the user interaction.
+            </p>
+        
+            <div class="cntInfo">
+                <h:form id="NewAccountForm">
+
+                    <m:metawidget>
+	                	<f:param name="labelStyle" value="text-align: left; font-weight: normal"/>
+    	            	<f:param name="messageStyleClass" value="cntError"/>
+                    
+                    	<m:metawidget value="#{customer.userName}" inspectFromParent="true" rendererType="simple"/>
+                    	<m:metawidget value="#{customer.password}" inspectFromParent="true" rendererType="simple"/>
+                    	<m:metawidget value="#{editCustomer.passwordVerify}" inspectFromParent="true" rendererType="simple"/>
+
+                    	<f:facet name="footer">
+							<m:metawidget value="newuser.account" rendererType="simple"/>
+						</f:facet>
+                    </m:metawidget>
+					
+                </h:form>
+            </div>
+        </ui:define>
+    </ui:composition>
+</body>
+</html>

Added: trunk/examples/metawidget/dvdstore/view/newuser/card.xhtml
===================================================================
--- trunk/examples/metawidget/dvdstore/view/newuser/card.xhtml	                        (rev 0)
+++ trunk/examples/metawidget/dvdstore/view/newuser/card.xhtml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,46 @@
+<!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"
+      xmlns:s="http://jboss.com/products/seam/taglib"
+      xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:f="http://java.sun.com/jsf/core"
+      xmlns:h="http://java.sun.com/jsf/html"
+	  xmlns:m="http://metawidget.org/faces">      
+<body>
+    <ui:composition template="/WEB-INF/template.xhtml">
+        <ui:define name="topnav">
+            <ui:include src="/WEB-INF/incl/store_nav.xhtml">
+                <ui:param name="page" value="home" />
+            </ui:include>
+        </ui:define>
+
+        <ui:define name="sidebar">
+            <ui:include src="/WEB-INF/incl/login.xhtml" />
+        </ui:define>
+       
+        <ui:define name="body">
+            <h2><h:outputText id="NewCustomerHeaderText" value="#{messages.newCustomerHeader}" /></h2>
+            
+            <p><em><h:outputText id="NewCustomerInfoText" value="#{messages.newCustomerInfo}" /></em></p>
+            
+            <h:form id="NewAccountForm">
+                <m:metawidget>
+                	<f:param name="labelStyle" value="text-align: left; font-weight: normal"/>
+   	            	<f:param name="messageStyleClass" value="cntError"/>
+                
+                    <m:metawidget value="#{customer.creditCardType}" inspectFromParent="true" rendererType="simple"/>
+                    <m:metawidget value="#{customer.creditCard}" inspectFromParent="true" rendererType="simple"/>
+                    <m:stub value="#{customer.creditCardMonth}">
+                    	<m:metawidget value="#{customer.creditCardMonth}" inspectFromParent="true" rendererType="simple"/>
+	                	<m:metawidget value="#{customer.creditCardYear}" inspectFromParent="true" rendererType="simple"/>
+	            	</m:stub>
+                    <f:facet name="footer">                
+	                	<m:metawidget value="newuser.card" rendererType="simple"/>
+	                </f:facet>
+				</m:metawidget>
+            </h:form>
+
+        </ui:define>
+    </ui:composition>
+</body>
+</html>

Added: trunk/examples/metawidget/dvdstore/view/newuser/contact.xhtml
===================================================================
--- trunk/examples/metawidget/dvdstore/view/newuser/contact.xhtml	                        (rev 0)
+++ trunk/examples/metawidget/dvdstore/view/newuser/contact.xhtml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,49 @@
+<!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"
+      xmlns:s="http://jboss.com/products/seam/taglib"
+      xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:f="http://java.sun.com/jsf/core"
+      xmlns:h="http://java.sun.com/jsf/html"
+	  xmlns:m="http://metawidget.org/faces">
+<body>
+    <ui:composition template="/WEB-INF/template.xhtml">
+        <ui:define name="topnav">
+            <ui:include src="/WEB-INF/incl/store_nav.xhtml">
+                <ui:param name="page" value="home" />
+            </ui:include>
+        </ui:define>
+
+        <ui:define name="sidebar">
+            <ui:include src="/WEB-INF/incl/login.xhtml" />
+        </ui:define>
+       
+        <ui:define name="body">
+            <h2><h:outputText id="CustomerHeaderText" value="#{messages.newCustomerHeader}" /></h2>
+            
+            <p><em><h:outputText id="NewCustomerInfoText" value="#{messages.newCustomerInfo}" /></em></p>
+            
+            <h:form id="NewAccountForm">
+                <s:validateAll id="ValidateAll">
+	                <m:metawidget value="#{customer}" validatorClass="org.metawidget.faces.component.validator.RequiredValidator">
+	                	<f:param name="labelStyle" value="text-align: left; font-weight: normal"/>
+	                	<f:param name="messageStyleClass" value="cntError"/>
+	
+	                	<m:stub value="#{customer.userName}"/>
+	                	<m:stub value="#{customer.password}"/>
+	                	<m:stub value="#{customer.creditCard}"/>
+	                	<m:stub value="#{customer.creditCardMonth}"/>
+	                	<m:stub value="#{customer.creditCardYear}"/>
+	                	<m:stub value="#{customer.creditCardType}"/>
+	                	
+	                	<f:facet name="footer">
+	                		<m:metawidget value="newuser.contact" rendererType="simple"/>
+	                	</f:facet>
+	                </m:metawidget>
+            	</s:validateAll>
+            </h:form>
+
+        </ui:define>
+    </ui:composition>
+</body>
+</html>


Property changes on: trunk/examples/metawidget/groovybooking
___________________________________________________________________
Name: svn:ignore
   + dist
exploded-archives
staging


Added: trunk/examples/metawidget/groovybooking/build.properties
===================================================================
--- trunk/examples/metawidget/groovybooking/build.properties	                        (rev 0)
+++ trunk/examples/metawidget/groovybooking/build.properties	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,2 @@
+# Uncomment when deploying to JBoss AS 5
+#loadPersistenceUnits=false

Added: trunk/examples/metawidget/groovybooking/build.xml
===================================================================
--- trunk/examples/metawidget/groovybooking/build.xml	                        (rev 0)
+++ trunk/examples/metawidget/groovybooking/build.xml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,145 @@
+<?xml version="1.0"?>
+<project name="Seam Metawidget Groovy Booking" default="jbosswar.restart" basedir=".">
+
+    <!-- Naming -->
+    <property name="Name"                   value="Seam Metawidget Groovy Booking Example"/>
+    <property name="example.name"           value="jboss-seam-metawidget-groovybooking"/>
+
+    <property file="${basedir}/build.properties" />
+
+    <!-- Define location of merged source -->
+    <property name="staging.dir" value="${basedir}/staging"/>
+    <property name="src.model.dir" value="${staging.dir}/src/model" />
+    <property name="src.action.dir" value="${staging.dir}/src/action" />
+    <property name="src.test.dir" value="${staging.dir}/src/test" />
+    <property name="src.java.dir" value="${src.model.dir}"/>
+    <property name="view.dir" value="${staging.dir}/view"/>
+    <property name="resources.dir" value="${staging.dir}/resources"/>
+    <property name="clean.extra" value="${staging.dir}"/>
+    
+    <!-- Libraries to include -->
+    <property name="seam.ui.lib" value="yes"/>
+    <property name="seam.debug.lib" value="yes"/>
+    <property name="facelets.lib" value="yes"/>
+    <property name="richfaces.lib" value="yes"/>
+    <property name="groovy.lib" value="yes" />
+    <!--<property name="metawidget-war.lib" value="yes" />-->
+
+    <property name="profile" value="dev" />
+    
+    <!-- Datasource -->
+    <property name="example.ds" value="metawidget-groovybooking-${profile}-ds.xml"/>
+
+    <target name="build">
+
+        <!-- Copy the original Seam booking example -->
+        <copy todir="${staging.dir}">
+            <fileset dir="${seam.dir}/examples/groovybooking">
+                <include name="src/**"/>
+                <include name="view/**"/>
+                <include name="resources/**"/>
+            </fileset>
+        </copy>
+        
+        <!-- Copy metawidget example overrides -->
+        <copy todir="${staging.dir}" overwrite="true">
+            <fileset dir=".">
+                <include name="src/**"/>
+                <include name="view/**"/>
+                <include name="resources/**"/>
+            </fileset>
+        </copy>
+        
+        <move file="${resources.dir}/groovybooking-dev-ds.xml" tofile="${resources.dir}/metawidget-groovybooking-dev-ds.xml"/>
+        <move file="${resources.dir}/groovybooking-prod-ds.xml" tofile="${resources.dir}/metawidget-groovybooking-prod-ds.xml"/>
+    </target>
+    
+    <import file="${basedir}/../../build.xml"/>
+
+    <path id="build.classpath.extras">
+        <fileset dir="${basedir}/..">
+            <include name="metawidget.jar"/>
+        </fileset>
+    </path>
+
+    <fileset id="war.lib.extras" dir="${basedir}/..">
+        <include name="metawidget.jar"/>
+    </fileset>
+
+    <!-- remaining configuration copied from ../../groovybooking/build.xml -->
+    <target name="explode">
+        <antcall target="jbosswar.explode" />
+    </target>
+
+    <target name="restart">
+        <antcall target="jbosswar.restart" />
+    </target>
+
+    <target name="unexplode">
+        <antcall target="jbosswar.unexplode" />
+    </target>
+    
+    <property name="classes.model.dir" value="${war.dir}/WEB-INF/classes" />
+    <property name="classes.action.dir" value="${war.dir}/WEB-INF/dev" />
+    <property name="debug" value="true" />
+    
+    <path id="src.test.path">
+        <path path="${src.model.dir}" />
+        <path path="${src.test.dir}" />
+        <path path="${src.action.dir}" />
+    </path>
+
+    <target name="groovy.init" description="Initialize the build">
+        <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="build.classpath" />
+        <!-- really only the groovy jar is necessary -->
+        <mkdir dir="${classes.model.dir}" />
+        <mkdir dir="${classes.action.dir}" />
+        <condition property="groovy.dynamic" value="true">
+            <and>
+                <istrue value="${debug}" />
+            </and>
+        </condition>
+        <condition property="groovy.static" value="true">
+            <and>
+                <isfalse value="${debug}" />
+            </and>
+        </condition>
+    </target>
+
+    <target name="compilemodel" depends="groovy.init">
+        <groovyc classpathref="build.classpath" destdir="${classes.model.dir}" srcdir="${src.model.dir}" />
+    </target>
+
+    <target name="compileactions" depends="groovy.init,compileactions.compilegroovy,compileactions.copygroovy,compilemodel">
+        <javac classpathref="build.classpath" destdir="${classes.action.dir}" debug="${javac.debug}" deprecation="${javac.deprecation}" nowarn="on">
+            <classpath path="${classes.model.dir}" />
+            <src path="${src.action.dir}" />
+        </javac>
+    </target>
+
+    <!-- private task -->
+    <target name="compileactions.compilegroovy" if="groovy.static" depends="groovy.init,compilemodel">
+        <path id="groovy.action.classpath">
+            <path refid="build.classpath" />
+            <dirset dir="${classes.model.dir}" />
+        </path>
+        <groovyc classpathref="groovy.action.classpath" destdir="${classes.action.dir}" srcdir="${src.action.dir}">
+        </groovyc>
+    </target>
+
+    <!-- private task -->
+    <target name="compileactions.copygroovy" if="groovy.dynamic">
+        <!-- copy the action groovy files into action if not compiled -->
+        <copy todir="${classes.action.dir}">
+            <fileset dir="${src.action.dir}">
+                <include name="**/*.groovy" />
+            </fileset>
+        </copy>
+    </target>
+
+    <target name="init.war" depends="compilemodel,compileactions">
+        <copy tofile="${war.dir}/WEB-INF/classes/META-INF/persistence.xml" file="${resources.dir}/META-INF/persistence-${profile}-war.xml" overwrite="true" />
+        <copy tofile="${war.dir}/WEB-INF/classes/import.sql" file="${resources.dir}/import-${profile}.sql" overwrite="true" />
+    </target>
+
+</project>

Added: trunk/examples/metawidget/groovybooking/readme.txt
===================================================================
--- trunk/examples/metawidget/groovybooking/readme.txt	                        (rev 0)
+++ trunk/examples/metawidget/groovybooking/readme.txt	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,24 @@
+Seam Metawidget GroovyBooking Example
+=====================================
+
+This is the Hotel Booking example implemented in Groovy Beans and Hibernate JPA
+and uses Metawidget to layout the forms. This application runs on JBoss AS, but
+is deployed as a WAR rather than an EAR.  Thus, you prefix all the typical
+targets (explode, restart, unexplode) with "jbosswar." (e.g., jbosswar.explode,
+jbosswar.restart, jbosswar.unexplode).
+
+Please note that you need to uncomment the loadPersistenceUnits=true property
+in build.properties when deploying to JBoss AS 5.
+
+The source files in this example are just the overrides needed to utilize
+metawidget. Before you can deploy the example, you have to merge these
+overrides with the original groovybooking source code in a staging directory.
+That is done using the following command:
+
+  ant build
+
+When editing Groovy files from the src/action directory, you can run "ant
+build jbosswar.explode" to see your changes take effect.  When editing Groovy files
+from src/model, you need to run "ant build jbosswar.explode jbosswar.restart"
+
+Access the application at http://localhost:8080/jboss-seam-metawidget-groovybooking

Added: trunk/examples/metawidget/groovybooking/resources/WEB-INF/inspector-config.xml
===================================================================
--- trunk/examples/metawidget/groovybooking/resources/WEB-INF/inspector-config.xml	                        (rev 0)
+++ trunk/examples/metawidget/groovybooking/resources/WEB-INF/inspector-config.xml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<inspector-config xmlns="http://metawidget.org/inspector-config"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://metawidget.org/inspector-config http://metawidget.org/inspector-config/inspector-config-1.0.xsd" version="1.0">
+
+	<compositeInspector xmlns="java:org.metawidget.inspector.composite" config="CompositeInspectorConfig">
+		<inspectors>
+			<metawidgetAnnotationInspector xmlns="java:org.metawidget.inspector.annotation" config="org.metawidget.inspector.impl.BaseObjectInspectorConfig">
+				<propertyStyle>org.metawidget.inspector.impl.propertystyle.groovy.GroovyPropertyStyle</propertyStyle>			
+			</metawidgetAnnotationInspector>
+			<propertyTypeInspector xmlns="java:org.metawidget.inspector.propertytype" config="org.metawidget.inspector.impl.BaseObjectInspectorConfig">
+				<propertyStyle>org.metawidget.inspector.impl.propertystyle.groovy.GroovyPropertyStyle</propertyStyle>
+			</propertyTypeInspector>
+			<facesInspector xmlns="java:org.metawidget.inspector.faces" config="org.metawidget.inspector.impl.BaseObjectInspectorConfig">
+				<propertyStyle>org.metawidget.inspector.impl.propertystyle.groovy.GroovyPropertyStyle</propertyStyle>
+			</facesInspector>
+			<jpaInspector xmlns="java:org.metawidget.inspector.jpa" config="JpaInspectorConfig">
+				<propertyStyle>org.metawidget.inspector.impl.propertystyle.groovy.GroovyPropertyStyle</propertyStyle>
+			</jpaInspector>
+			<hibernateValidatorInspector xmlns="java:org.metawidget.inspector.hibernate.validator" config="org.metawidget.inspector.impl.BaseObjectInspectorConfig">
+				<propertyStyle>org.metawidget.inspector.impl.propertystyle.groovy.GroovyPropertyStyle</propertyStyle>
+			</hibernateValidatorInspector>
+		</inspectors>
+	</compositeInspector>
+
+</inspector-config>
\ No newline at end of file

Added: trunk/examples/metawidget/groovybooking/src/model/org/jboss/seam/example/groovy/Booking.groovy
===================================================================
--- trunk/examples/metawidget/groovybooking/src/model/org/jboss/seam/example/groovy/Booking.groovy	                        (rev 0)
+++ trunk/examples/metawidget/groovybooking/src/model/org/jboss/seam/example/groovy/Booking.groovy	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,121 @@
+//$Id: Booking.groovy 4698 2007-04-18 06:40:06Z ebernard $
+package org.jboss.seam.example.groovy
+
+import java.text.DateFormat
+import javax.persistence.Basic
+import javax.persistence.Entity
+import javax.persistence.GeneratedValue
+import javax.persistence.Id
+import javax.persistence.ManyToOne
+import javax.persistence.Temporal
+import javax.persistence.TemporalType
+import javax.persistence.Transient
+
+import org.hibernate.validator.Length
+import org.hibernate.validator.NotNull
+import org.hibernate.validator.Pattern
+import org.jboss.seam.annotations.Name
+
+import org.metawidget.inspector.annotation.*;
+import org.metawidget.inspector.faces.*;
+
+ at Entity
+ at Name("booking")
+class Booking implements Serializable
+{
+   @Id @GeneratedValue
+   Long id
+
+   @ManyToOne @NotNull
+   @UiHidden
+   User user
+
+   @ManyToOne @NotNull
+   @UiHidden
+   Hotel hotel
+
+   @NotNull
+   @Basic @Temporal(TemporalType.DATE)
+   @UiComesAfter( [ "total" ] ) 
+   @UiFacesDateTimeConverter( pattern = "MM/dd/yyyy" )
+   Date checkinDate
+
+   @Basic @Temporal(TemporalType.DATE)
+   @NotNull
+   @UiComesAfter( [ "checkinDate" ] )
+   @UiFacesDateTimeConverter( pattern = "MM/dd/yyyy" )
+   Date checkoutDate
+
+   @NotNull(message="Credit card number is required")
+   @Length(min=16, max=16, message="Credit card number must 16 digits long")
+   @Pattern(regex=/^\d*$/, message="Credit card number must be numeric")
+   @UiComesAfter( [ "smoking" ] )
+   @UiLabel( "Credit card #" )
+   String creditCard
+
+   @NotNull(message="Credit card name is required")
+   @Length(min=3, max=70)
+   @UiComesAfter( [ "creditCard" ] )
+   String creditCardName
+
+   @UiLookup( value = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" ], labels = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ] )
+   @UiComesAfter( [ "creditCardName" ] )
+   @UiLabel( "Expiry month" )
+   int creditCardExpiryMonth
+
+   @UiComesAfter( [ "creditCardExpiryMonth" ] )   
+   @UiLookup( [ "2005", "2006", "2007", "2008", "2009" ] )
+   @UiLabel( "Expiry year" )
+   int creditCardExpiryYear
+
+   @UiLookup( value = [ "true", "false" ], labels = [ "Smoking", "Non Smoking" ] )
+   @UiFacesComponent( "javax.faces.HtmlSelectOneRadio" )
+   @UiComesAfter( [ "beds" ] )
+   boolean smoking
+
+   @UiLabel( "Room preference" )
+   @UiComesAfter( [ "checkoutDate" ] )
+   @UiLookup( value = [ "1", "2", "3" ], labels = [ "One king-size bed", "Two double beds", "Three beds" ] )
+   int beds
+
+   Booking() {}
+
+   Booking(Hotel hotel, User user)
+   {
+      this.hotel = hotel
+      this.user = user
+   }
+
+   @Transient
+   @UiHidden   
+   @UiFacesNumberConverter(type="currency",currencySymbol="\$")
+   @UiLabel("Total payment")   
+   BigDecimal getTotal()
+   {
+      return hotel.price * getNights()
+   }
+
+   @Transient
+   @UiHidden
+   int getNights()
+   {
+      return (int) ( ( checkoutDate.time - checkinDate.time ) / 1000 / 60 / 60 / 24 )
+   }
+
+   @Transient
+   @UiHidden
+   String getDescription()
+   {
+      DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM)
+      return hotel ?
+            "${hotel.name}, ${df.format( checkinDate )} to ${df.format(checkoutDate)}" :
+            null
+   }
+
+   @Override
+   String toString()
+   {
+      return "Booking(" + user + ","+ hotel + ")"
+   }
+
+}

Added: trunk/examples/metawidget/groovybooking/src/model/org/jboss/seam/example/groovy/Hotel.groovy
===================================================================
--- trunk/examples/metawidget/groovybooking/src/model/org/jboss/seam/example/groovy/Hotel.groovy	                        (rev 0)
+++ trunk/examples/metawidget/groovybooking/src/model/org/jboss/seam/example/groovy/Hotel.groovy	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,57 @@
+//$Id: Hotel.groovy 4698 2007-04-18 06:40:06Z ebernard $
+package org.jboss.seam.example.groovy
+
+import javax.persistence.Column
+import javax.persistence.Entity
+import javax.persistence.GeneratedValue
+import javax.persistence.Id
+
+import org.hibernate.validator.Length
+import org.hibernate.validator.NotNull
+import org.jboss.seam.annotations.Name
+
+import org.metawidget.inspector.annotation.*;
+import org.metawidget.inspector.faces.*;
+
+ at Entity
+ at Name("hotel")
+class Hotel implements Serializable
+{
+   @Id @GeneratedValue
+   Long id
+
+   @Length(max=50) @NotNull
+   String name
+
+   @Length(max=100) @NotNull
+   @UiComesAfter( [ "name" ] )
+   String address
+
+   @Length(max=40) @NotNull
+   @UiComesAfter( [ "address" ] )
+   String city
+
+   @Length(min=2, max=10) @NotNull
+   @UiComesAfter( [ "city" ] )
+   String state
+
+   @Length(min=4, max=6) @NotNull
+   @UiComesAfter( [ "state" ] )
+   String zip
+
+   @Length(min=2, max=40) @NotNull
+   @UiComesAfter( [ "zip" ] )
+   String country
+
+   @Column(precision=6, scale=2)
+   @UiComesAfter( [ "country" ])
+   @UiFacesNumberConverter(type="currency",currencySymbol="\$")
+   @UiLabel("Nightly rate")
+   BigDecimal price
+
+   @Override
+   String toString()
+   {
+      return "Hotel(${name},${address},${city},${zip})"
+   }
+}

Added: trunk/examples/metawidget/groovybooking/view/book.xhtml
===================================================================
--- trunk/examples/metawidget/groovybooking/view/book.xhtml	                        (rev 0)
+++ trunk/examples/metawidget/groovybooking/view/book.xhtml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,53 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+	    		xmlns:ui="http://java.sun.com/jsf/facelets"
+	  			xmlns:h="http://java.sun.com/jsf/html"
+	  			xmlns:f="http://java.sun.com/jsf/core"
+	  			xmlns:s="http://jboss.com/products/seam/taglib"
+                xmlns:a="http://richfaces.org/a4j"
+                xmlns:rich="http://richfaces.org/rich"
+                xmlns:m="http://metawidget.org/faces/richfaces"
+				template="template.xhtml">
+
+<!-- content -->
+<ui:define name="content">
+<div class="section">
+	<h1>Book Hotel</h1>
+</div>
+<div class="section">
+	<h:form id="booking">
+	<fieldset>
+	
+		<m:metawidget value="#{hotel}" rendererType="div" readOnly="#{true}">
+			<f:param name="divStyleClasses" value="entry,label,required,output"/>
+		</m:metawidget>
+		
+		<s:validateAll>
+    
+			<m:metawidget value="#{booking}" rendererType="div" validatorClass="org.metawidget.faces.component.validator.RequiredValidator">
+				<f:param name="divStyleClasses" value="entry,label,required,input,error errors"/>
+			</m:metawidget>
+			
+		</s:validateAll>
+		
+		<div class="entry errors">
+			<h:messages globalOnly="true"/>
+		</div>
+		
+		<div class="entry">
+			<div class="label">&#160;</div>
+			<div class="input">
+				<h:commandButton id="proceed" value="Proceed" action="#{hotelBooking.setBookingDetails}"/>&#160;
+				<s:button id="cancel" value="Cancel" action="#{hotelBooking.cancel}"/>
+			</div>
+		</div>		
+	</fieldset>
+	</h:form>
+</div>
+</ui:define>
+
+<!-- sidebar -->
+<ui:define name="sidebar">
+</ui:define>
+
+</ui:composition>

Added: trunk/examples/metawidget/groovybooking/view/confirm.xhtml
===================================================================
--- trunk/examples/metawidget/groovybooking/view/confirm.xhtml	                        (rev 0)
+++ trunk/examples/metawidget/groovybooking/view/confirm.xhtml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,47 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+	    		xmlns:ui="http://java.sun.com/jsf/facelets"
+	  			xmlns:h="http://java.sun.com/jsf/html"
+	  			xmlns:f="http://java.sun.com/jsf/core"
+                xmlns:s="http://jboss.com/products/seam/taglib"
+                xmlns:m="http://metawidget.org/faces/richfaces"
+				template="template.xhtml">
+
+<!-- content -->
+<ui:define name="content">
+<div class="section">
+	<h1>Confirm Hotel Booking</h1>
+</div>
+<div class="section">
+	<h:form id="confirm">
+	<fieldset>
+
+		<m:metawidget value="#{hotel}" rendererType="div" readOnly="#{true}">
+			<f:param name="divStyleClasses" value="entry,label,required,output"/>
+		</m:metawidget>
+
+		<m:metawidget value="#{booking}" rendererType="div" readOnly="#{true}">
+			<f:param name="divStyleClasses" value="entry,label,required,output"/>
+			<h:outputText value="#{booking.total}"/>
+			<m:stub value="#{booking.creditCardExpiryMonth}"/>
+			<m:stub value="#{booking.creditCardExpiryYear}"/>
+		</m:metawidget>
+
+		<div class="entry">
+			<div class="label">&#160;</div>
+			<div class="input">
+				<h:commandButton id="confirm" value="Confirm" action="#{hotelBooking.confirm}"/>&#160;
+    			<s:button id="revise" value="Revise" view="/book.xhtml"/>&#160;
+    			<h:commandButton id="cancel" value="Cancel" action="#{hotelBooking.cancel}"/>
+			</div>
+		</div>
+	</fieldset>
+	</h:form>
+</div>
+</ui:define>
+
+<!-- sidebar -->
+<ui:define name="sidebar">
+</ui:define>
+
+</ui:composition>

Added: trunk/examples/metawidget/groovybooking/view/hotel.xhtml
===================================================================
--- trunk/examples/metawidget/groovybooking/view/hotel.xhtml	                        (rev 0)
+++ trunk/examples/metawidget/groovybooking/view/hotel.xhtml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,36 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+	    		xmlns:ui="http://java.sun.com/jsf/facelets"
+	  			xmlns:h="http://java.sun.com/jsf/html"
+	  			xmlns:f="http://java.sun.com/jsf/core"
+				xmlns:s="http://jboss.com/products/seam/taglib"
+				xmlns:m="http://metawidget.org/faces/richfaces"
+				template="template.xhtml">
+
+<!-- content -->
+<ui:define name="content">
+<div class="section">
+	<h1>View Hotel</h1>
+</div>
+<div class="section">
+
+	<m:metawidget value="#{hotel}" rendererType="div" readOnly="#{true}">
+		<f:param name="divStyleClasses" value="entry,label,required,output"/>
+	</m:metawidget>
+
+</div>
+<div class="section">
+	<h:form id="hotel">
+	<fieldset class="buttonBox">
+		<h:commandButton id="bookHotel" action="#{hotelBooking.bookHotel}" value="Book Hotel"/>&#160;
+		<h:commandButton id="cancel" action="#{hotelBooking.cancel}" value="Back to Search"/>
+	</fieldset>
+	</h:form>
+</div>
+</ui:define>
+
+<!-- sidebar -->
+<ui:define name="sidebar">
+</ui:define>
+
+</ui:composition>

Added: trunk/examples/metawidget/groovybooking/view/main.xhtml
===================================================================
--- trunk/examples/metawidget/groovybooking/view/main.xhtml	                        (rev 0)
+++ trunk/examples/metawidget/groovybooking/view/main.xhtml	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,119 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+	    		xmlns:ui="http://java.sun.com/jsf/facelets"
+	  			xmlns:h="http://java.sun.com/jsf/html"
+	  			xmlns:f="http://java.sun.com/jsf/core"
+	  			xmlns:s="http://jboss.com/products/seam/taglib"
+                xmlns:a="http://richfaces.org/a4j"
+				template="template.xhtml">
+
+<!-- content -->
+<ui:define name="content">
+
+<div class="section">
+  <h:form id="main">
+  
+    <span class="errors">
+       <h:messages id="messages" globalOnly="true"/>
+    </span>
+    
+	<h1>Search Hotels</h1>
+	<fieldset> 
+	   <h:inputText id="searchString" value="#{hotelSearch.searchString}" style="width: 165px;">
+         <a:support event="onkeyup" actionListener="#{hotelSearch.find}" reRender="searchResults" />
+       </h:inputText>
+       &#160;
+	   <h:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}"/>
+       &#160;
+       <a:status>
+          <f:facet name="start">
+             <h:graphicImage id="Spinner" value="/img/spinner.gif"/>
+          </f:facet>
+       </a:status>
+	   <br/>
+       <h:outputLabel for="pageSize">Maximum results:</h:outputLabel>&#160;
+       <h:selectOneMenu value="#{hotelSearch.pageSize}" id="pageSize">
+          <f:selectItem itemLabel="5" itemValue="5"/>
+          <f:selectItem itemLabel="10" itemValue="10"/>
+          <f:selectItem itemLabel="20" itemValue="20"/>
+       </h:selectOneMenu>
+    </fieldset>
+    
+  </h:form>
+</div>
+
+<a:outputPanel id="searchResults">
+  <div class="section">
+	<h:outputText id="NoHotelsFoundMessage" value="No Hotels Found" rendered="#{hotels != null and hotels.rowCount==0}"/>
+	<h:dataTable id="hotels" value="#{hotels}" var="hot" rendered="#{hotels.rowCount>0}">
+		<h:column>
+			<f:facet name="header">Name</f:facet>
+			#{hot.name}
+		</h:column>
+		<h:column>
+			<f:facet name="header">Address</f:facet>
+			#{hot.address}
+		</h:column>
+		<h:column>
+			<f:facet name="header">City, State</f:facet>
+			#{hot.city}, #{hot.state}, #{hot.country}
+		</h:column> 
+		<h:column>
+			<f:facet name="header">Zip</f:facet>
+			#{hot.zip}
+		</h:column>
+		<h:column>
+			<f:facet name="header">Action</f:facet>
+			<s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>
+		</h:column>
+	</h:dataTable>
+	<s:link id="MoreResultsLink" value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}"/>
+  </div>
+</a:outputPanel>
+
+<div class="section">
+	<h1>Current Hotel Bookings</h1>
+</div>
+<div class="section">
+  <h:form id="bookings">
+	<h:outputText value="No Bookings Found" rendered="#{bookings.rowCount==0}"/>
+	<h:dataTable id="bookings" value="#{bookings}" var="book" rendered="#{bookings.rowCount>0}">
+		<h:column>
+			<f:facet name="header">Name</f:facet>
+			#{book.hotel.name}
+		</h:column>
+		<h:column>
+			<f:facet name="header">Address</f:facet>
+			#{book.hotel.address}
+		</h:column>
+		<h:column>
+			<f:facet name="header">City, State</f:facet>
+			#{book.hotel.city}, #{book.hotel.state}
+		</h:column>
+        <h:column>
+            <f:facet name="header">Check in date</f:facet>
+            <h:outputText value="#{book.checkinDate}"/>
+        </h:column>
+        <h:column>
+            <f:facet name="header">Check out date</f:facet>
+            <h:outputText value="#{book.checkoutDate}"/>
+        </h:column>
+		<h:column>
+			<f:facet name="header">Confirmation number</f:facet>
+			#{book.id}
+		</h:column>
+		<h:column>
+			<f:facet name="header">Action</f:facet>
+			<h:commandLink id="cancel" value="Cancel" action="#{bookingList.cancel}"/>
+		</h:column>
+	</h:dataTable>
+  </h:form>
+</div>
+
+</ui:define>
+
+<!-- sidebar -->
+<ui:define name="sidebar">
+</ui:define>
+
+</ui:composition>

Added: trunk/examples/metawidget/metawidget-backend.jar
===================================================================
(Binary files differ)


Property changes on: trunk/examples/metawidget/metawidget-backend.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/examples/metawidget/metawidget-frontend.jar
===================================================================
(Binary files differ)


Property changes on: trunk/examples/metawidget/metawidget-frontend.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/examples/metawidget/metawidget.jar
===================================================================
(Binary files differ)


Property changes on: trunk/examples/metawidget/metawidget.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/examples/metawidget/readme.txt
===================================================================
--- trunk/examples/metawidget/readme.txt	                        (rev 0)
+++ trunk/examples/metawidget/readme.txt	2009-03-28 19:54:58 UTC (rev 10226)
@@ -0,0 +1,13 @@
+Metawidget Examples
+===================
+
+These examples demonstrate the use of the Metawidget user interface builder.
+These examples demonstrate the Metawidget JSF componenents, though Metawidget
+supports many other user interface platforms.
+
+You can find information about Metawidget at the project homepage:
+
+http://metawidget.sourceforge.net
+
+Thanks to Richard Kennard for porting the original Seam examples to use the
+Metawidget JSF components.




More information about the seam-commits mailing list