tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r306807 - in /jakarta/tapestry/trunk/examples/Vlib/src: context/ context/WEB-INF/ java/org/apache/tapestry/vlib/pages/
Date Thu, 06 Oct 2005 16:59:31 GMT
Author: hlship
Date: Thu Oct  6 09:59:21 2005
New Revision: 306807

URL: http://svn.apache.org/viewcvs?rev=306807&view=rev
Log:
Continue revving Virtual Library for Tapestry 4.0

Added:
    jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/Login.properties
Removed:
    jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/Home.page
Modified:
    jakarta/tapestry/trunk/examples/Vlib/src/context/EditUsers.html
    jakarta/tapestry/trunk/examples/Vlib/src/context/GiveAwayBooks.html
    jakarta/tapestry/trunk/examples/Vlib/src/context/Home.html
    jakarta/tapestry/trunk/examples/Vlib/src/context/Login.html
    jakarta/tapestry/trunk/examples/Vlib/src/context/NewBook.html
    jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/GiveAwayBooks.page
    jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/GiveAwayBooks.properties
    jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/Login.page
    jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/NewBook.page
    jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/NewBook.properties
    jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/ShowValidationError.jwc
    jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/BookMatches.java
    jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/GiveAwayBooks.java
    jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/Home.java
    jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/Login.java
    jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/NewBook.java
    jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/Register.java

Modified: jakarta/tapestry/trunk/examples/Vlib/src/context/EditUsers.html
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/context/EditUsers.html?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/context/EditUsers.html (original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/context/EditUsers.html Thu Oct  6 09:59:21 2005
@@ -30,16 +30,16 @@
             <span jwcid="@Insert" value="ognl:user.email">foo@bar.com</span>
           </td>
           <td class="checkbox">
-            <input type="checkbox" jwcid="admin@Checkbox" selected="ognl:user.admin"/>
+            <input type="checkbox" jwcid="admin@Checkbox" value="ognl:user.admin"/>
           </td>
           <td class="checkbox">
-            <input type="checkbox" jwcid="lockedOut@Checkbox" selected="ognl:user.lockedOut"/>
+            <input type="checkbox" jwcid="lockedOut@Checkbox" value="ognl:user.lockedOut"/>
           </td>
           <td class="checkbox">
-            <input type="checkbox" jwcid="resetPassword@Checkbox" selected="ognl:userConverter.resetPassword"/>
+            <input type="checkbox" jwcid="resetPassword@Checkbox" value="ognl:userConverter.resetPassword"/>
           </td>
           <td class="checkbox">
-            <input type="checkbox" jwcid="delete@Checkbox" selected="ognl:userConverter.deleted"/>
+            <input type="checkbox" jwcid="delete@Checkbox" value="ognl:userConverter.deleted"/>
           </td>
         </tr>
       </table>

Modified: jakarta/tapestry/trunk/examples/Vlib/src/context/GiveAwayBooks.html
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/context/GiveAwayBooks.html?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/context/GiveAwayBooks.html (original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/context/GiveAwayBooks.html Thu Oct  6 09:59:21
2005
@@ -1,12 +1,13 @@
 <html jwcid="$content$">
-<body jwcid="@Border">
+<body jwcid="border@Border">
 
 <span jwcid="@ShowError"/>
+<span jwcid="@ShowValidationError"/>
 
 This page is used to transfer ownership of one or more books to
 another user.
  
-<form jwcid="@Form" listener="listener:formSubmit">
+<form jwcid="form">
 
 <select jwcid="selectBooks"/>
 

Modified: jakarta/tapestry/trunk/examples/Vlib/src/context/Home.html
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/context/Home.html?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/context/Home.html (original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/context/Home.html Thu Oct  6 09:59:21 2005
@@ -11,7 +11,7 @@
 <span jwcid="@ShowError"/>
 <span jwcid="@ShowMessage"/>
 
-<form jwcid="form@Form" listener="listener:search" stateful="ognl:false">
+<form jwcid="form@Form" success="listener:search" stateful="ognl:false">
   <table class="form">
     <tr>
       <th>Title</th>

Modified: jakarta/tapestry/trunk/examples/Vlib/src/context/Login.html
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/context/Login.html?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/context/Login.html (original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/context/Login.html Thu Oct  6 09:59:21 2005
@@ -1,18 +1,18 @@
 <html jwcid="$content$">
-<body jwcid="@Border">
-<span jwcid="@ShowError"/><span jwcid="@ShowValidationError" delegate="ognl:beans.delegate"/>
-<form jwcid="@Form" listener="listener:attemptLogin" delegate="ognl:beans.delegate" stateful="ognl:false">
+<body jwcid="border@Border">
+<span jwcid="@ShowError"/><span jwcid="@ShowValidationError"/>
+<form jwcid="form">
   <table class="form">
     <tr>
-      <th><span jwcid="@FieldLabel" field="ognl:components.inputEmail">Email
Address</span>
+      <th><span jwcid="@FieldLabel" field="component:email">Email Address</span>
       </th>
-      <td><input jwcid="inputEmail" type="text" name="email" size="30" maxlength="60"/>
+      <td><input jwcid="email" type="text" name="email" size="30" maxlength="60"/>
       </td>
     </tr>
     <tr>
-      <th><span jwcid="@FieldLabel" field="ognl:components.inputPassword">Password</span>
+      <th><span jwcid="@FieldLabel" field="component:password">Password</span>
       </th>
-      <td valign="bottom"><input jwcid="inputPassword" type="text" name="password"
size="10" maxlength="20"/>
+      <td valign="bottom"><input jwcid="password" type="text" name="password" size="10"
maxlength="20"/>
 	   </td>
 	</tr>
 	<tr>

Modified: jakarta/tapestry/trunk/examples/Vlib/src/context/NewBook.html
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/context/NewBook.html?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/context/NewBook.html (original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/context/NewBook.html Thu Oct  6 09:59:21 2005
@@ -9,20 +9,20 @@
 </p>
 
 <span jwcid="@ShowError"/>
-<span jwcid="@ShowValidationError" delegate="ognl:validationDelegate"/>
+<span jwcid="@ShowValidationError"/>
 
   <table class="form">
     <tr>
-      <th width="80" height="30"><span jwcid="@FieldLabel" field="ognl:components.inputTitle">Title</span></th>
+      <th width="80" height="30"><span jwcid="@FieldLabel" field="component:title">Title</span></th>
       <td><span class="required-field">*</span></td>
-      <td width="420"><input jwcid="inputTitle" type="text" size="50" maxlength="100"/>
+      <td width="420"><input jwcid="title" type="text" size="50" maxlength="100"/>
       </td>
     </tr>
     <tr>
-      <th><span jwcid="@FieldLabel" field="ognl:components.inputAuthor">Author</span>
+      <th><span jwcid="@FieldLabel" field="component:author">Author</span>
       	 <td><span class="required-field">*</span></td>
       </th>
-      <td><input jwcid="inputAuthor" type="text" size="30" maxlength="60"/>
+      <td><input jwcid="author" type="text" size="30" maxlength="60"/>
       </td>
     </tr>
     <tr>
@@ -32,10 +32,11 @@
       </td>
     </tr>
     <tr>
-      <th><span jwcid="@FieldLabel" field="ognl:components.inputPublisherName">Publisher</span></th>
+      <th><span jwcid="@FieldLabel" field="component:publisherName">Publisher</span></th>
        <td><span class="required-field">*</span></td>
-      <td><select jwcid="inputPublisher@PropertySelection" value="ognl:attributes.publisherId"
model="ognl:engine.publisherModel"/>
-<input jwcid="inputPublisherName" type="text" size="20" maxlength="40"/>
+      <td><select jwcid="publisher@PropertySelection" value="ognl:attributes.publisherId"

+      model="ognl:engine.publisherModel"/>
+<input jwcid="publisherName" type="text" size="20" maxlength="40"/>
       </td>
     </tr>
     <tr>
@@ -47,19 +48,19 @@
     <tr>
       <th>Description</th>
       <td></td>
-      <td><textarea jwcid="inputDescription@TextArea" value="ognl:attributes.description"
cols="35" rows="8"></textarea>
+      <td><textarea jwcid="description@TextArea" value="ognl:attributes.description"
cols="35" rows="8"></textarea>
       </td>
     </tr>
     <tr>
       <th>Hidden</th>
       <td></td>
-      <td><input jwcid="inputHidden@Checkbox" selected="ognl:attributes.hidden"
type="checkbox"/>Check to prevent this book from appearing in searches.
+      <td><input jwcid="hidden@Checkbox" value="ognl:attributes.hidden" type="checkbox"/>Check
to prevent this book from appearing in searches.
       </td>
     </tr>
     <tr>
       <th>Lendable</th>
       <td></td>
-      <td><input jwcid="inputLendable@Checkbox" selected="ognl:attributes.lendable"
type="checkbox"/>Leave checked to allow this book to be borrowed by others.
+      <td><input jwcid="lendable@Checkbox" value="ognl:attributes.lendable" type="checkbox"/>Leave
checked to allow this book to be borrowed by others.
       </td>
     </tr>
     <tr>
@@ -69,7 +70,7 @@
       </td>
     </tr>
   </table>
-<span jwcid="@Script" script="Publisher.script" select="ognl:components.inputPublisher"
field="ognl:components.inputPublisherName"/>
+<span jwcid="@Script" script="Publisher.script" select="component:publisher" field="component:publisherName"/>
 </form>
 </body>
 </html>

Modified: jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/GiveAwayBooks.page
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/GiveAwayBooks.page?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/GiveAwayBooks.page (original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/GiveAwayBooks.page Thu Oct  6
09:59:21 2005
@@ -16,31 +16,24 @@
 -->
 
 <!DOCTYPE page-specification PUBLIC 
-  "-//Apache Software Foundation//Tapestry Specification 3.0//EN" 
-  "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
-	
-<page-specification class="org.apache.tapestry.vlib.pages.GiveAwayBooks">
-
-  <property-specification name="error" type="java.lang.String"/>
-	<property-specification name="booksModel" type="org.apache.tapestry.form.IPropertySelectionModel"/>
-	<property-specification name="personModel" type="org.apache.tapestry.form.IPropertySelectionModel"/>
-	<property-specification name="selectedBooks" type="java.util.List"/>
-
-	<property-specification name="targetUserId" type="java.lang.Integer"/>
-
-    <component id="selectBooks" type="contrib:Palette">
-      <binding name="sort">
-        @org.apache.tapestry.contrib.palette.SortMode@LABEL
-     	</binding>
-      <binding name="model" expression="booksModel"/>
-      <binding name="selected" expression="selectedBooks"/>
-      <binding name="selectedTitleBlock" expression="components.selectedTitleBlock"/>
-      <binding name="availableTitleBlock" expression="components.availableTitleBlock"/>
-    </component>
-    
-    <component id="selectTarget" type="PropertySelection">
-      <binding name="value" expression="targetUserId"/>
-      <binding name="model" expression="personModel"/>
-    </component>
-
+  "-//Apache Software Foundation//Tapestry Specification 4.0//EN" 
+  "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
+<page-specification>
+  <component id="form" type="Form">
+    <binding name="success" value="listener:formSubmit"/>
+    <binding name="clientValidationEnabled" value="true"/>
+  </component>
+  <component id="selectBooks" type="contrib:Palette">
+    <binding name="sort" value="@org.apache.tapestry.contrib.palette.SortMode@LABEL"/>
+    <binding name="model" value="booksModel"/>
+    <binding name="selected" value="selectedBooks"/>
+    <binding name="selectedTitleBlock" value="component:selectedTitleBlock"/>
+    <binding name="availableTitleBlock" value="component:availableTitleBlock"/>
+    <binding name="validators" value="validators:required"/>
+    <binding name="displayName" value="message:books-label"/>
+  </component>
+  <component id="selectTarget" type="PropertySelection">
+    <binding name="value" value="targetUserId"/>
+    <binding name="model" value="personModel"/>
+  </component>
 </page-specification>

Modified: jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/GiveAwayBooks.properties
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/GiveAwayBooks.properties?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/GiveAwayBooks.properties (original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/GiveAwayBooks.properties Thu
Oct  6 09:59:21 2005
@@ -17,4 +17,5 @@
 read-users-failure=Unable to obtain list of users.
 read-books-failure=Unable to retrieve list of books.
 transfered-books=Transfered {0} book(s) to {1}.
-no-books-to-transfer=You own no books that you could give away.
\ No newline at end of file
+no-books-to-transfer=You own no books that you could give away.
+books-label=Books To Transfer
\ No newline at end of file

Modified: jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/Login.page
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/Login.page?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/Login.page (original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/Login.page Thu Oct  6 09:59:21
2005
@@ -16,38 +16,26 @@
 -->
 
 <!DOCTYPE page-specification PUBLIC 
-  "-//Apache Software Foundation//Tapestry Specification 3.0//EN" 
-  "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
-	
-<page-specification class="org.apache.tapestry.vlib.pages.Login">
-
-  <property-specification name="email" type="java.lang.String"/>
-  <property-specification name="password" type="java.lang.String"/>
-  <property-specification name="error" type="java.lang.String"/>
-  <property-specification name="callback" type="org.apache.tapestry.callback.ICallback"
persistent="yes"/>
-  
-  <bean name="delegate" class="org.apache.tapestry.vlib.VirtualLibraryDelegate"/>
-
-  <bean name="validator" class="org.apache.tapestry.valid.StringValidator" lifecycle="page">
-  	<set-property name="required" expression="true"/>
-  	<set-property name="clientScriptingEnabled" expression="true"/>
-  </bean>
-
-  <component id="inputEmail" type="ValidField">
-    <static-binding name="displayName" value="Email Address"/>
-    <binding name="value" expression="email"/>
-    <binding name="validator" expression="beans.validator"/>
+  "-//Apache Software Foundation//Tapestry Specification 4.0//EN" 
+  "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
+<page-specification>
+  <component id="form" type="Form">
+    <binding name="success" value="listener:attemptLogin"/>
+    <binding name="stateful" value="false"/>
+    <binding name="clientValidationEnabled" value="true"/>
   </component>
-  
-  <component id="inputPassword" type="ValidField">
-    <binding name="value" expression="password"/>
-    <binding name="validator" expression="beans.validator"/>
-    <static-binding name="displayName" value="Password"/>
-    <binding name="hidden" expression="true"/>
+  <component id="email" type="TextField">
+    <binding name="displayName" value="message:email-label"/>
+    <binding name="value" value="email"/>
+    <binding name="validators" value="validators:required"/>
+  </component>
+  <component id="password" type="TextField">
+    <binding name="value" value="password"/>
+    <binding name="validators" value="validators:required"/>
+    <binding name="displayName" value="message:password-label"/>
+    <binding name="hidden" value="true"/>
   </component>
-  
   <component id="register" type="PageLink">
-    <static-binding name="page">Register</static-binding>
+    <binding name="page" value="literal:Register"/>
   </component>
-
 </page-specification>

Added: jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/Login.properties
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/Login.properties?rev=306807&view=auto
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/Login.properties (added)
+++ jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/Login.properties Thu Oct  6 09:59:21
2005
@@ -0,0 +1,16 @@
+# Copyright 2005 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+email-label=Email Address
+password-label=Password

Modified: jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/NewBook.page
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/NewBook.page?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/NewBook.page (original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/NewBook.page Thu Oct  6 09:59:21
2005
@@ -16,39 +16,32 @@
 -->
 
 <!DOCTYPE page-specification PUBLIC 
-  "-//Apache Software Foundation//Tapestry Specification 3.0//EN" 
-  "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
+  "-//Apache Software Foundation//Tapestry Specification 4.0//EN" 
+  "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
 	
-<page-specification class="org.apache.tapestry.vlib.pages.NewBook">
-
-  <property-specification name="error" type="java.lang.String"/>
-  <property-specification name="publisherName" type="java.lang.String"/>
-  <property-specification name="attributes" type="java.util.Map"/>
-  
-  <bean name="required" class="org.apache.tapestry.valid.StringValidator" lifecycle="page">
-    <set-property name="required" expression="true"/>
-    <set-property name="clientScriptingEnabled" expression="true"/>
-  </bean>
+<page-specification>
+     
+  <component id="form" type="Form">
+    <binding name="listener" value="listener:addBook"/>
+    <binding name="clientValidationEnabled" value="true"/>
+  </component>    
   
-  <bean name="optional" class="org.apache.tapestry.valid.StringValidator" lifecycle="page"/>
-    
-  <component id="inputTitle" type="ValidField">
-    <binding name="value" expression="attributes.title"/>
-    <static-binding name="displayName" value="Title"/>
-    <binding name="validator" expression="beans.required"/>
+  <component id="title" type="TextField">
+    <binding name="value" value="attributes.title"/>
+    <binding name="displayName" value="message:title-label"/>
+    <binding name="validators" value="validators:required"/>
   </component>
   
-  <component id="inputAuthor" type="ValidField">
-    <binding name="value" expression="attributes.author"/>
-    <binding name="validator" expression="beans.required"/>
-    <static-binding name="displayName" value="Author"/>
+  <component id="author" type="TextField">
+    <binding name="value" value="attributes.author"/>
+    <binding name="validators" value="validators:required"/>
+    <binding name="displayName" value="message:author-title"/>
   </component>
 
   
-  <component id="inputPublisherName" type="ValidField">
-    <binding name="value" expression="publisherName"/>
-    <binding name="validator" expression="beans.optional"/>
-    <static-binding name="displayName" value="Publisher"/>
+  <component id="publisherName" type="TextField">
+    <binding name="value" value="publisherName"/>
+    <binding name="displayName" value="message:publisher-label"/>
   </component>
     
 </page-specification>

Modified: jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/NewBook.properties
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/NewBook.properties?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/NewBook.properties (original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/NewBook.properties Thu Oct  6
09:59:21 2005
@@ -15,3 +15,7 @@
 need-publisher-name=You must provide a publisher name if the publisher option is left empty.
 leave-publisher-name-empty=You may not enter a publisher name if you select a publisher from
the list.
 added-book=Added ''{0}''.
+
+title-label=Title
+author-title=Author
+publisher-label=Publisher

Modified: jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/ShowValidationError.jwc
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/ShowValidationError.jwc?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/ShowValidationError.jwc (original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/context/WEB-INF/ShowValidationError.jwc Thu Oct
 6 09:59:21 2005
@@ -21,6 +21,6 @@
 	
 <component-specification allow-informal-parameters="false" allow-body="false">
 
-  <parameter name="delegate" required="true"/>
+  <parameter name="delegate" default-value="page.validationDelegate"/>
   
 </component-specification>

Modified: jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/BookMatches.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/BookMatches.java?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/BookMatches.java
(original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/BookMatches.java
Thu Oct  6 09:59:21 2005
@@ -75,7 +75,7 @@
      * Invoked by the {@link Home} page to perform a query.
      */
 
-    public void performQuery(MasterQueryParameters parameters, IRequestCycle cycle)
+    public void performQuery(MasterQueryParameters parameters)
     {
         setQueryParameters(parameters);
 
@@ -89,7 +89,7 @@
         }
 
         getBrowser().initializeForResultCount(count);
-        cycle.activate(this);
+        getRequestCycle().activate(this);
     }
 
     public void requery(IRequestCycle cycle)

Modified: jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/GiveAwayBooks.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/GiveAwayBooks.java?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/GiveAwayBooks.java
(original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/GiveAwayBooks.java
Thu Oct  6 09:59:21 2005
@@ -20,14 +20,14 @@
 import javax.ejb.FinderException;
 
 import org.apache.hivemind.ApplicationRuntimeException;
-import org.apache.tapestry.IRequestCycle;
 import org.apache.tapestry.PageRedirectException;
 import org.apache.tapestry.Tapestry;
+import org.apache.tapestry.annotations.InjectPage;
+import org.apache.tapestry.annotations.Message;
+import org.apache.tapestry.event.PageBeginRenderListener;
 import org.apache.tapestry.event.PageEvent;
-import org.apache.tapestry.event.PageRenderListener;
 import org.apache.tapestry.form.IPropertySelectionModel;
 import org.apache.tapestry.vlib.EntitySelectionModel;
-import org.apache.tapestry.vlib.IActivate;
 import org.apache.tapestry.vlib.Protected;
 import org.apache.tapestry.vlib.VirtualLibraryEngine;
 import org.apache.tapestry.vlib.Visit;
@@ -43,7 +43,7 @@
  * @since 3.0
  */
 
-public abstract class GiveAwayBooks extends Protected implements PageRenderListener
+public abstract class GiveAwayBooks extends Protected implements PageBeginRenderListener
 {
     public abstract IPropertySelectionModel getBooksModel();
 
@@ -57,7 +57,25 @@
 
     public abstract Integer getTargetUserId();
 
-    public void formSubmit(IRequestCycle cycle)
+    @Message
+    public abstract String updateFailure();
+
+    @Message
+    public abstract String selectAtLeastOneBook(String targetName);
+
+    @Message
+    public abstract String transferedBooks(int count, String targetName);
+
+    @Message
+    public abstract String readUsersFailure();
+
+    @Message
+    public abstract String readBooksFailure();
+
+    @InjectPage("MyLibrary")
+    public abstract MyLibrary getMyLibrary();
+
+    public void formSubmit()
     {
         VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
 
@@ -71,7 +89,7 @@
 
         if (count == 0)
         {
-            setError(format("select-at-least-one-book", target.getNaturalName()));
+            setError(selectAtLeastOneBook(target.getNaturalName()));
             return;
         }
 
@@ -94,14 +112,13 @@
             }
             catch (RemoteException ex)
             {
-                vengine.rmiFailure(getMessage("update-failure"), ex, i++);
+                vengine.rmiFailure(updateFailure(), ex, i++);
             }
         }
 
-        MyLibrary myLibrary = (MyLibrary) cycle.getPage("MyLibrary");
+        MyLibrary myLibrary = getMyLibrary();
 
-        myLibrary.setMessage(format("transfered-books", Integer.toString(count), target
-                .getNaturalName()));
+        myLibrary.setMessage(transferedBooks(count, target.getNaturalName()));
 
         myLibrary.activate();
     }
@@ -127,7 +144,7 @@
             }
             catch (RemoteException ex)
             {
-                vengine.rmiFailure(getMessage("read-users-failure"), ex, i++);
+                vengine.rmiFailure(readUsersFailure(), ex, i++);
             }
         }
 
@@ -191,7 +208,7 @@
             }
             catch (RemoteException ex)
             {
-                vengine.rmiFailure(getMessage("read-books-failure"), ex, i++);
+                vengine.rmiFailure(readBooksFailure(), ex, i++);
             }
         }
 
@@ -213,8 +230,7 @@
 
         if (model.getOptionCount() == 0)
         {
-            IRequestCycle cycle = getRequestCycle();
-            IActivate page = (IActivate) cycle.getPage("MyLibrary");
+            MyLibrary page = getMyLibrary();
 
             page.activate();
 

Modified: jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/Home.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/Home.java?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/Home.java
(original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/Home.java
Thu Oct  6 09:59:21 2005
@@ -15,6 +15,8 @@
 package org.apache.tapestry.vlib.pages;
 
 import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.annotations.InjectPage;
+import org.apache.tapestry.annotations.Meta;
 import org.apache.tapestry.html.BasePage;
 import org.apache.tapestry.vlib.IErrorProperty;
 import org.apache.tapestry.vlib.IMessageProperty;
@@ -26,6 +28,7 @@
  * @author Howard Lewis Ship
  */
 
+@Meta("page-type=Search")
 public abstract class Home extends BasePage implements IErrorProperty, IMessageProperty
 {
 
@@ -37,18 +40,22 @@
 
     public abstract Integer getOwnerId();
 
+    @InjectPage("BookMatches")
+    public abstract BookMatches getBookMatches();
+
     /**
-     * Invokes {@link BookMatches#performQuery(MasterQueryParameters, IRequestCycle)}.
+     * Listener method, invokes
+     * {@link BookMatches#performQuery(MasterQueryParameters, IRequestCycle)}.
      */
 
-    public void search(IRequestCycle cycle)
+    public void search()
     {
-        BookMatches matches = (BookMatches) cycle.getPage("BookMatches");
+        BookMatches matches = getBookMatches();
 
         MasterQueryParameters parameters = new MasterQueryParameters(getTitle(), getAuthor(),
                 getOwnerId(), getPublisherId());
 
-        matches.performQuery(parameters, cycle);
+        matches.performQuery(parameters);
     }
 
 }

Modified: jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/Login.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/Login.java?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/Login.java
(original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/Login.java
Thu Oct  6 09:59:21 2005
@@ -17,7 +17,12 @@
 import java.rmi.RemoteException;
 
 import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.annotations.Bean;
+import org.apache.tapestry.annotations.InjectComponent;
 import org.apache.tapestry.annotations.InjectObject;
+import org.apache.tapestry.annotations.InjectPage;
+import org.apache.tapestry.annotations.InjectState;
+import org.apache.tapestry.annotations.Persist;
 import org.apache.tapestry.callback.ICallback;
 import org.apache.tapestry.event.PageBeginRenderListener;
 import org.apache.tapestry.event.PageEvent;
@@ -25,8 +30,8 @@
 import org.apache.tapestry.html.BasePage;
 import org.apache.tapestry.services.CookieSource;
 import org.apache.tapestry.valid.IValidationDelegate;
-import org.apache.tapestry.valid.ValidatorException;
 import org.apache.tapestry.vlib.IErrorProperty;
+import org.apache.tapestry.vlib.VirtualLibraryDelegate;
 import org.apache.tapestry.vlib.VirtualLibraryEngine;
 import org.apache.tapestry.vlib.Visit;
 import org.apache.tapestry.vlib.ejb.IOperations;
@@ -50,6 +55,9 @@
 
     private static final String COOKIE_NAME = "org.apache.tapestry.vlib.Login.email";
 
+    @Bean(VirtualLibraryDelegate.class)
+    public abstract IValidationDelegate getValidationDelegate();
+
     public abstract void setEmail(String value);
 
     public abstract String getEmail();
@@ -61,23 +69,22 @@
     @InjectObject("infrastructure:cookieSource")
     public abstract CookieSource getCookieSource();
 
-    protected IValidationDelegate getValidationDelegate()
-    {
-        return (IValidationDelegate) getBeans().getBean("delegate");
-    }
+    @Persist("client:app")
+    public abstract ICallback getCallback();
 
-    protected void setErrorField(String componentId, String message)
-    {
-        IFormComponent field = (IFormComponent) getComponent(componentId);
+    public abstract void setCallback(ICallback value);
 
-        IValidationDelegate delegate = getValidationDelegate();
-        delegate.setFormComponent(field);
-        delegate.record(new ValidatorException(message));
-    }
+    @InjectComponent("email")
+    public abstract IFormComponent getEmailField();
 
-    public abstract void setCallback(ICallback value);
+    @InjectComponent("password")
+    public abstract IFormComponent getPasswordField();
 
-    public abstract ICallback getCallback();
+    @InjectState("visit")
+    public abstract Visit getVisitState();
+
+    @InjectPage("MyLibrary")
+    public abstract MyLibrary getMyLibrary();
 
     /**
      * Attempts to login.
@@ -95,7 +102,7 @@
         setPassword(null);
         IValidationDelegate delegate = getValidationDelegate();
 
-        delegate.setFormComponent((IFormComponent) getComponent("inputPassword"));
+        delegate.setFormComponent(getPasswordField());
         delegate.recordFieldInputValue(null);
 
         // An error, from a validation field, may already have occured.
@@ -114,16 +121,16 @@
 
                 Person person = operations.login(getEmail(), password);
 
-                loginUser(person, cycle);
+                loginUser(person);
 
                 break;
 
             }
             catch (LoginException ex)
             {
-                String fieldName = ex.isPasswordError() ? "inputPassword" : "inputEmail";
+                IFormComponent field = ex.isPasswordError() ? getPasswordField() : getEmailField();
 
-                setErrorField(fieldName, ex.getMessage());
+                getValidationDelegate().record(field, ex.getMessage());
                 return;
             }
             catch (RemoteException ex)
@@ -139,29 +146,31 @@
      * specified page).
      */
 
-    public void loginUser(Person person, IRequestCycle cycle)
+    public void loginUser(Person person)
     {
+        IRequestCycle cycle = getRequestCycle();
+
         String email = person.getEmail();
 
         // Get the visit object; this will likely force the
         // creation of the visit object and an HttpSession.
 
-        Visit visit = (Visit) getVisit();
+        Visit visit = getVisitState();
         visit.setUser(person);
 
-        // After logging in, go to the MyLibrary page, unless otherwise
+        // After logging in, go to the Home page, unless otherwise
         // specified.
 
         ICallback callback = getCallback();
 
         if (callback == null)
-            cycle.activate("Home");
+            getMyLibrary().activate();
         else
             callback.performCallback(cycle);
 
-        getCookieSource().writeCookieValue(COOKIE_NAME, email);
-
         // TODO: Set max age of cookie once TAPESTRY-438 is fixed.
+
+        getCookieSource().writeCookieValue(COOKIE_NAME, email);
 
         cycle.forgetPage(getPageName());
     }

Modified: jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/NewBook.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/NewBook.java?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/NewBook.java
(original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/NewBook.java
Thu Oct  6 09:59:21 2005
@@ -20,10 +20,14 @@
 
 import javax.ejb.CreateException;
 
-import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.Tapestry;
+import org.apache.hivemind.HiveMind;
+import org.apache.tapestry.annotations.InjectComponent;
+import org.apache.tapestry.annotations.InjectPage;
+import org.apache.tapestry.annotations.Message;
+import org.apache.tapestry.event.PageBeginRenderListener;
 import org.apache.tapestry.event.PageEvent;
-import org.apache.tapestry.event.PageRenderListener;
+import org.apache.tapestry.form.IFormComponent;
+import org.apache.tapestry.valid.IValidationDelegate;
 import org.apache.tapestry.vlib.Protected;
 import org.apache.tapestry.vlib.VirtualLibraryEngine;
 import org.apache.tapestry.vlib.Visit;
@@ -35,40 +39,57 @@
  * @author Howard Lewis Ship
  */
 
-public abstract class NewBook extends Protected implements PageRenderListener
+public abstract class NewBook extends Protected implements PageBeginRenderListener
 {
-
     public abstract Map getAttributes();
 
     public abstract void setAttributes(Map attributes);
 
     public abstract String getPublisherName();
 
-    public void addBook(IRequestCycle cycle)
+    @Message
+    public abstract String needPublisherName();
+
+    @Message
+    public abstract String leavePublisherNameEmpty();
+
+    @Message
+    public abstract String addedBook(Object title);
+
+    @InjectComponent("publisherName")
+    public abstract IFormComponent getPublisherNameField();
+
+    @InjectPage("MyLibrary")
+    public abstract MyLibrary getMyLibrary();
+
+    public void addBook()
     {
+        IValidationDelegate delegate = getValidationDelegate();
+
         Map attributes = getAttributes();
 
         Integer publisherId = (Integer) attributes.get("publisherId");
         String publisherName = getPublisherName();
 
-        if (publisherId == null && Tapestry.isBlank(publisherName))
+        if (publisherId == null && HiveMind.isBlank(publisherName))
         {
-            setErrorField("inputPublisherName", getMessage("need-publisher-name"));
+            delegate.record(getPublisherNameField(), needPublisherName());
             return;
         }
 
-        if (publisherId != null && Tapestry.isNonBlank(publisherName))
+        if (publisherId != null && HiveMind.isNonBlank(publisherName))
         {
-            setErrorField("inputPublisherName", getMessage("leave-publisher-name-empty"));
+            delegate.record(getPublisherNameField(), leavePublisherNameEmpty());
             return;
         }
 
         if (isInError())
             return;
 
-        Visit visit = (Visit) getVisit();
+        Visit visit = getVisitState();
+
         Integer userId = visit.getUserId();
-        VirtualLibraryEngine vengine = (VirtualLibraryEngine) cycle.getEngine();
+        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
 
         attributes.put("ownerId", userId);
         attributes.put("holderId", userId);
@@ -107,9 +128,9 @@
 
         // Success. First, update the message property of the return page.
 
-        MyLibrary myLibrary = (MyLibrary) cycle.getPage("MyLibrary");
+        MyLibrary myLibrary = getMyLibrary();
 
-        myLibrary.setMessage(format("added-book", attributes.get("title")));
+        myLibrary.setMessage(addedBook(attributes.get("title")));
 
         myLibrary.activate();
     }

Modified: jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/Register.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/Register.java?rev=306807&r1=306806&r2=306807&view=diff
==============================================================================
--- jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/Register.java
(original)
+++ jakarta/tapestry/trunk/examples/Vlib/src/java/org/apache/tapestry/vlib/pages/Register.java
Thu Oct  6 09:59:21 2005
@@ -117,7 +117,7 @@
                 // Ask the login page to return us to the proper place, as well
                 // as set a cookie identifying the user for next time.
 
-                login.loginUser(user, cycle);
+                login.loginUser(user);
 
                 break;
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Mime
View raw message