You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2010/10/23 01:56:55 UTC

svn commit: r1026534 - in /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib: components/ pages/

Author: hlship
Date: Fri Oct 22 23:56:54 2010
New Revision: 1026534

URL: http://svn.apache.org/viewvc?rev=1026534&view=rev
Log:
Update many component reference pages to current
naming standards, use of public fields, use
of @Property annotation, etc.

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ActionLink.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanDisplay.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Checkbox.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Delegate.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/EventLink.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/If.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Loop.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/PageLink.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Radio.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Submit.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Trigger.xdoc
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyDisplayBlocks.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ActionLink.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ActionLink.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ActionLink.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ActionLink.xdoc Fri Oct 22 23:56:54 2010
@@ -13,13 +13,9 @@
                 <source><![CDATA[
 public class Account
 {
-    private long id;
+    public long id;
 
-    private String userName;
-
-    // etc., etc., ...
-
-    // Getters and setters omitted ...
+    public String userName;
     
 }]]></source>
             </subsection>
@@ -106,21 +102,13 @@ public class ViewAccount
                 you may need to include a company id as well as the account id. You can
                 build an object array to contain both values:
             </p>
-            <p>You can do this in a template using the following syntax</p>
+            <p>You can do this in a template using the following syntax:</p>
             <source><![CDATA[
-<t:actionlink t:id="foo" context="[account.companyId,account.id]">test foo</t:actionlink>
+<t:actionlink t:id="delete" context="[account.companyId, account.id]">delete ${company.name} / ${account.id}</t:actionlink>
 
-            ]]>
-            </source>
-			<p>
-			Alternatively, you can provide a getter which returns an object array.
-			</p>
+            ]]>        </source>
+            
             <source><![CDATA[
-    public Object[] getAccountContext()
-    {
-        return new Object[] { account.companyId, account.id };
-    }
-
     Object onActionFromDelete(long companyId, long accountId)
     {
         accountDAO.delete(companyId, accountId);
@@ -128,6 +116,15 @@ public class ViewAccount
         accountsSummaryPage.setMessage(String.format("Account #%d has been deleted.", accountId));
 
         return accountsSummaryPage;
+    }]]></source>            
+            
+			<p>
+			Alternatively, you can provide a getter which returns an object array.
+			</p>
+            <source><![CDATA[
+    public Object[] getAccountContext()
+    {
+        return new Object[] { account.companyId, account.id };
     }]]></source>
 
             <p>
@@ -139,10 +136,9 @@ public class ViewAccount
         </p>]]></source>
 
             <p>
-                This highlights the use of the component class: any complicated processing should be offloaded
-                out of the template and into the class.
-            </p>
-
+  This pattern was more common in early versions of Tapestry; the older versions of the property
+  expression language did not have the ability to create an array on the fly.
+</p>
         </section>
 
     </body>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/AjaxFormLoop.xdoc Fri Oct 22 23:56:54 2010
@@ -184,7 +184,7 @@ public class Phone
 
         <h2>Phones</h2>
 
-        <div t:type="ajaxformloop" t:id="phones" source="person.phones" encoder="phoneEncoder" value="phone">
+        <div t:type="ajaxformloop" t:id="phones" source="person.phones" value="phone">
           <t:select t:id="type" value="phone.type"/>
           <t:textfield t:id="number" value="phone.number"/>
 
@@ -205,8 +205,8 @@ public class Phone
 </html>]]></source>
 
                 <p>
-                    Here we're editting the direct properties of the Person object and adding a section below to allow
-                    the phones for the person to be editted. The AjaxFormLoop looks much like a Loop component here,
+                    Here we're editing the direct properties of the Person object and adding a section below to allow
+                    the phones for the person to be edited. The AjaxFormLoop looks much like a Loop component here,
                     except we must provide a PrimaryKeyEncoder object.
                 </p>
 
@@ -248,26 +248,6 @@ public class Edit
   @Inject
   private Session session;
 
-  public PrimaryKeyEncoder<Long, Phone> getPhoneEncoder()
-  {
-    return new PrimaryKeyEncoder<Long, Phone>()
-    {
-      public Long toKey(Phone value)
-      {
-        return value.getId();
-      }
-
-      public void prepareForKeys(List<Long> keys)
-      {
-      }
-
-      public Phone toValue(Long key)
-      {
-        return (Phone) session.get(Phone.class, key);
-      }
-    };
-  }
-
   @CommitAfter
   public Object onSuccess()
   {
@@ -307,9 +287,11 @@ public class Edit
             </p>
 
             <p>
-                The minimal implementation of a PrimaryKeyEncoder is also shown; this one is customized for
-                Phone instances, and knows how to extract primary keys (the id property) and convert
-                primary keys back into objects. This could easily be rolled out as a Tapestry IoC service.
+            AjaxFormLoop has to determine how to store an id for each editable row (remember that the client
+            side can only really store strings, not full Java objects); in some cases you will
+            have to bind the encoder parameter to a ValueEncoder object that is specific for your data type.
+            However, this is not necessary for any Hibernate entities, as Tapestry automatically provides
+            th ValueEncoder.
             </p>
 
         </section>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanDisplay.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanDisplay.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanDisplay.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanDisplay.xdoc Fri Oct 22 23:56:54 2010
@@ -41,7 +41,7 @@ public class User
 
     public long getId() { return id; }
 
-     public void setId(long id) { this.id = id; }
+    public void setId(long id) { this.id = id; }
 
     public String getFirstName() { return firstName; }
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditForm.xdoc Fri Oct 22 23:56:54 2010
@@ -89,14 +89,14 @@ public class User
 
                 <p>
                     Nominally, we should have to bind the object parameter of the BeanEditForm component. However, as
-                    a convienience, Tapestry has defaulted the object parameter
+                    a convenience, Tapestry has defaulted the object parameter
                     based on the component id. This works because the CreateUser class
                     includes a property named "user", which matches the BeanEditForm component's id.
 
                 </p>
 
                 <p>
-                    When the object to be editted is not a direct property of the page,
+                    When the object to be edited is not a direct property of the page,
                     it will be necessary to bind the object parameter explicitly. For example,
                     <code>object="registration.address"</code>
                     to create or edit the address

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Checkbox.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Checkbox.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Checkbox.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Checkbox.xdoc Fri Oct 22 23:56:54 2010
@@ -31,7 +31,7 @@
                 <p>
                     Normally, we should bind the value parameter explicitly; here the component's id, "showAll",
                     matches against a property of the page and the value parameter is automatically bound
-                    as a convienience.
+                    as a convenience.
                 </p>
 
                 <p>
@@ -59,24 +59,22 @@
                 <source><![CDATA[
 public class ViewAccount
 {
+    @Property
     @Persist
-    private boolean _showAll;
+    private boolean showAll;
 
     @Inject
-    private AccountDAO _accountDAO;
+    private AccountDAO accountDAO;
 
-    public boolean isShowAll() { return _showAll; }
-
-    public void setShowAll(boolean showAll) { _showAll = showAll; }
 
     public List<Account> getAccounts()
     {
-        return _showAll ? _accountDAO.getAllAccounts() : _accountDAO.getActiveAccounts();
+        return showAll ? accountDAO.getAllAccounts() : accountDAO.getActiveAccounts();
     }
 }]]></source>
 
                 <p>
-                    The component updates the _showAll field, and that's used to determine which
+                    The component updates the showAll field, and that's used to determine which
                     set of accounts should be provided to the Grid component. As always in Tapestry, you
                     must be careful to mark fields persistent if they need to hold their value between
                     the action request (the form submission) and the render request.

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Delegate.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Delegate.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Delegate.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Delegate.xdoc Fri Oct 22 23:56:54 2010
@@ -47,46 +47,43 @@
 public class ViewAccount
 {
     @Persist
-    private Account _account;
+    private Account account;
 
     @Persist
-    private boolean _editMode;
+    private boolean editMode;
 
     @Inject
-    private Block _view;
+    private Block edit, view;
 
     @Inject
-    private Block _edit;
-
-    @Inject
-    private AccountDAO _accountDAO;
+    private AccountDAO accountDAO;
 
     public Account getAccount()
     {
-        return _account;
+        return account;
     }
 
     public void setAccount(Account account)
     {
-        _account = account;
-        _editMode = false;
+        account = account;
+        editMode = false;
     }
 
     void onSuccess()
     {
-         _accountDAO.update(_account);
+         accountDAO.update(_account);
 
-        _editMode = false;
+        editMode = false;
     }
 
     void onActionFromEdit()
     {
-        _editMode = true;
+        editMode = true;
     }
 
     public Object getActiveBlock()
     {
-        return _editMode ? _edit : _view;
+        return editMode ? edit : view;
     }
 }]]></source>
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/EventLink.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/EventLink.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/EventLink.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/EventLink.xdoc Fri Oct 22 23:56:54 2010
@@ -30,18 +30,18 @@ public class GridColumns
     . . .
 
     @Component(parameters = {"event=sort", "context=columnModel.id"})
-    private EventLink _sort, _sort2;
+    private EventLink sort, sort2;
 
     void onSort(String columnId)
     {
-        if (columnId.equals(_sortColumnId))
+        if (columnId.equals(sortColumnId))
         {
-            _sortAscending = !_sortAscending;
+            sortAscending = !sortAscending;
         }
         else
         {
-            _sortColumnId = columnId;
-            _sortAscending = true;
+            sortColumnId = columnId;
+            sortAscending = true;
         }
     }
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.xdoc Fri Oct 22 23:56:54 2010
@@ -133,7 +133,7 @@
                     <li>prepareForSubmit</li>
                     <li>prepare</li>
                     <li>validate</li>
-                    <li>validateForm</li>
+                    <li>validateForm <em>(deprecated)</em></li>
                     <li>failure
                         <em>or</em>
                         success
@@ -158,7 +158,7 @@
                 <p>
                     It is considered a best practice to give explicit ids to
                     Form components, and form control element components.
-                    These ids propogate down to the client side as
+                    These ids propagate down to the client side as
                     element names and/or ids, and eventually show up
                     as query parameters when the form is submitted.
                 </p>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.xdoc Fri Oct 22 23:56:54 2010
@@ -49,7 +49,7 @@
     <body>
         <h1>Order Address</h1>
 
-        <t:form>
+        <t:form t:id="order">
 
             <t:errors/>
 
@@ -102,43 +102,21 @@
                 <source><![CDATA[
 public class OrderAddress
 {
+    @Property
     @Persist
-    private ShippingAddress _billingAddress;
+    private ShippingAddress billingAddress;
 
+    @Property
     @Persist
-    private ShippingAddress _shippingAddress;
+    private ShippingAddress shippingAddress;
 
+    @Property
     @Persist
-    private boolean _separateShipTo;
+    private boolean separateShipTo;
 
-    public ShippingAddress getBillingAddress()
+    Object onSuccessFromOrder()
     {
-        return _billingAddress;
-    }
-
-    public void setBillingAddress(ShippingAddress billingAddress)
-    {
-        _billingAddress = billingAddress;
-    }
-
-    public ShippingAddress getShippingAddress()
-    {
-        return _shippingAddress;
-    }
-
-    public void setShippingAddress(ShippingAddress shippingAddress)
-    {
-        _shippingAddress = shippingAddress;
-    }
-
-    public boolean isSeparateShipTo()
-    {
-        return _separateShipTo;
-    }
-
-    public void setSeparateShipTo(boolean separateShipTo)
-    {
-        _separateShipTo = separateShipTo;
+      ...
     }
 }]]></source>
             </subsection>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/If.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/If.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/If.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/If.xdoc Fri Oct 22 23:56:54 2010
@@ -42,7 +42,7 @@
         <section name="Notes">
 
             <p>
-                Tapestry has many builtin coercions to boolean:
+                Tapestry has many built in coercions to boolean:
             </p>
 
             <dl>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.xdoc Fri Oct 22 23:56:54 2010
@@ -34,7 +34,7 @@
         <section name="Notes">
 
             <p>
-                The Label component is very important for user accessiblity. A user will be able to click
+                The Label component is very important for user accessibility. A user will be able to click
                 on the label to move the cursor into the corresponding field.
             </p>
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Loop.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Loop.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Loop.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Loop.xdoc Fri Oct 22 23:56:54 2010
@@ -162,15 +162,15 @@ public class EditOrder
     private OrderDAO orderDAO;
 
     @Property
-    private final PrimaryKeyEncoder<Long,LineItem> encoder = new PrimaryKeyEncoder<Long,LineItem>()
+    private final ValueEncoder<LineItem> encoder = new ValueEncoder<LineItem>()
     {
-        public Long toKey(LineItem value) { return value.getId(); }
+        public String toClient(LineItem value) { return String.valueOf(value.getId()); }
 
-        public void prepareForKeys(List<Long> keys) { }
-
-        public LineItem toValue(Long key)
+        public LineItem toValue(String clientValue)
         {
-            return orderDAO.getLineItem(key);
+            long id = Long.parseLong(clientValue);
+            
+            return orderDAO.getLineItem(id);
         }
     };
 
@@ -189,7 +189,7 @@ public class EditOrder
                 <p>
                     Here, we expect the OrderDAO service to do most of the work,
                     and we create a wrapper around it, in the form of the
-                    PrimeryKeyEncoder instance.
+                    ValueEncoder instance.
                 </p>
 
                 <p>
@@ -199,12 +199,6 @@ public class EditOrder
                     property gets set in the first place.
                 </p>
 
-                <p>
-                    Accounting for those situations would largely be encapsulated inside
-                    the PrimeryKeyEncoder instance.
-                </p>
-
-
             </subsection>
 
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/PageLink.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/PageLink.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/PageLink.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/PageLink.xdoc Fri Oct 22 23:56:54 2010
@@ -45,19 +45,19 @@
                 <source><![CDATA[
 public class ViewUser
 {
-    private User _user;
+    private User user;
 
     @Inject
-    private UserDAO _userDAO;
+    private UserDAO userDAO;
 
     public User getUser()
     {
-        return _user;
+        return user;
     }
 
     void onActivate(long userId)
     {
-        _user = _userDAO.findById(userId);
+        user = userDAO.findById(userId);
     }
 }
             ]]></source>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.xdoc Fri Oct 22 23:56:54 2010
@@ -90,29 +90,18 @@ public enum SpecialHandling
                 <source><![CDATA[
 public class OrderHandling
 {
+    @Property
     @Persist
-    private List<SpecialHandling> _handling;
+    private List<SpecialHandling> handling;
 
     @Inject
-    private Messages _messages;
+    private Messages messages;
 
-    private final ValueEncoder<SpecialHandling> _encoder = new EnumValueEncoder(SpecialHandling.class);
+    @Property
+    private final ValueEncoder<SpecialHandling> encoder = new EnumValueEncoder(SpecialHandling.class);
 
-    private final SelectModel _model = new EnumSelectModel(SpecialHandling.class, _messages);
-
-    public List<SpecialHandling> getHandling()
-    {
-        return _handling;
-    }
-
-    public void setHandling(List<SpecialHandling> handling)
-    {
-        _handling = handling;
-    }
-
-    public ValueEncoder<SpecialHandling> getEncoder() { return _encoder; }
-
-    public SelectModel getModel() { return _model; }
+    @Property
+    private final SelectModel model = new EnumSelectModel(SpecialHandling.class, messages);
 }]]></source>
 
                 <p>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Radio.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Radio.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Radio.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Radio.xdoc Fri Oct 22 23:56:54 2010
@@ -103,12 +103,9 @@ public class Payment
 {
     . . .
 
+    @Property
     @Persist
-    private CardType _type;
-
-    public CardType getType() { return _type; }
-
-    public void setType(CardType type) { _type = type; }
+    private CardType type;
 
     public CardType getMasterCard() { return CardType.MASTER_CARD; }
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.xdoc Fri Oct 22 23:56:54 2010
@@ -55,17 +55,15 @@
 <source><![CDATA[
 public class SelectColor
 {
-  private String _color;
-
   @Validate("required")
-  public String getColor() { return _color; }
+  public String color;
 
-  public void setColor(String color) { _color = color; }
 }]]></source>
 
     <p>
-        Placing the @Validate annotation on the field indicates that it is required.  This prevents the
-        select component from including a blank option for the field (though this can be overridden).
+        Placing the @Validate annotation on the field supplies the default validation for this field, here
+        it indicates that color is required.  This prevents the
+        Select component from including a blank option for the field (though this behavior too can be overridden).
         Without the @Validate, it would be possible for the user to select a blank value, and null would
         be assigned to the color property of SelectColor.  This might be appropriate for a search form, but
         not for an edit form.
@@ -129,13 +127,11 @@ public class Payment
 {
     . . .
 
+    @Property
     @Persist
-    private CardType _type;
-
     @Validate("required")
-    public CardType getType() { return _type; }
+    private CardType type;
 
-    public void setType(CardType type) { _type = type; }
 
     . . .
 }]]></source>
@@ -188,7 +184,7 @@ public enum CarMaker
 				The Select component 'carMaker' of the page SelectZoneDemo shows all available car makers. 
 				When a user selects a car maker, another Select component for selecting available models of the make should appear.
 				This can be accomplished by the parameter <em>zone</em> of the Select component 'carMaker'. When <em>zone</em> parameter is bound 
-				every change of the Select's value causes an ajax request. In this case the Select component publishes the event <em>valuechanged</em> which can 
+				every change of the Select's value causes an Ajax request. In this case the Select component publishes the event <em>valuechanged</em> which can 
 				be used to provide the <em>model</em> for the second Select component.
        	                <source><![CDATA[                                                                   
 <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
@@ -198,21 +194,17 @@ public enum CarMaker
       </p>
       <p>
          <t:select t:id="carMaker" validate="required"
-                   model="makeModel" zone="modelZone" encoder="makeEncoder" />
+                   zone="modelZone" />
       </p>
       
-      <t:zone t:id="modelZone">
+      <t:zone t:id="modelZone" id="modelZone">
          <t:if test="carMaker">
-            <t:delegate to="modelBlock" />
+           <p>
+              <t:select t:id="carModel" model="availableModels" validate="required"/>
+           </p>
          </t:if>
       </t:zone>
       
-      <t:block id="modelBlock">
-         <p>
-            <t:select t:id="carModel" model="availableModels" validate="required"/>
-         </p>
-      </t:block>
-      
       <p>
          <t:submit value="literal:Submit" />
       </p>
@@ -238,20 +230,19 @@ public class SelectZoneDemo
    @Property
    @Persist
    private String carModel;
-   
-   @Inject
-   @Property
-   private Block modelBlock;
+
+   @InjectComponent
+   private Zone modelZone;
    
    @Property
    @Persist
    private List<String> availableModels;
     
-    public Object onValueChanged(final CarMaker maker) 
+    public Object onValueChanged(CarMaker maker) 
     {
        availableModels = findAvailableModels(maker);
        
-       return this.modelBlock;
+       return modelZone.getBody();
     }
     
     public List<String> findAvailableModels(final CarMaker maker) 
@@ -267,20 +258,17 @@ public class SelectZoneDemo
          default:
             return Arrays.asList();
        }
-    }
-    
-    public SelectModel getMakeModel()
-    {
-       return new EnumSelectModel(CarMaker.class, this.messages);
-    }
-    
-    public ValueEncoder<CarMaker> getMakeEncoder() 
-    {
-       return new EnumValueEncoder<CarMaker>(CarMaker.class);
-    }
-
+    }    
 }]]></source>
 
+
+<p>
+The Select component is very smart for enum types; it can automatically create a SelectModel for a given Enum, and a default
+ValueEncoder.  Likewise, it can turn an array or List into a SelectModel automatically.  This streamlines the use of the Select
+in many situations ... but because the model and encode parameters are still present, allows you to override its behavior
+when needed.
+</p>
+
 			</subsection>
         
         </section>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Submit.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Submit.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Submit.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Submit.xdoc Fri Oct 22 23:56:54 2010
@@ -39,29 +39,28 @@
 public class EditUser
 {
     @Inject
-    private UserDAO _userDAO;
+    private UserDAO userDAO;
 
+    @Property
     @Persist
-    private User _user;
+    private User user;
 
-    private boolean _deleteUser;
+    private boolean deleteUser;
 
-    void onSelectedFromDelete() { _deleteUser = true; }
+    void onSelectedFromDelete() { deleteUser = true; }
 
     Object onSuccess()
     {
-        if (_deleteUser)
-            _userDAO.delete(user.getId());
+        if (deleteUser)
+            userDAO.delete(user.getId());
         else
-            _userDAO.update(user);
+            userDAO.update(user);
 
         return UserList.class;
     }
+}]]></source>
 
-    public void setUser(User user) { _user = user; }
 
-    public User getUser() { return _user; }
-}]]></source>
             </subsection>
 
         </section>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Trigger.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Trigger.xdoc?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Trigger.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Trigger.xdoc Fri Oct 22 23:56:54 2010
@@ -40,11 +40,14 @@ public class TriggerDemo
 {
     
     @Environmental
-    private RenderSupport renderSupport;
+    private JavaScriptSupport jsSupport;
+    
+    @Inject @Path("context:js/scripts.js")
+    private Asset scripts;
     
     public void onAddAdditionalScriptLinks()
     {
-        renderSupport.addScriptLink("scripts.js");
+       jsSupport.importJavaScriptLibrary(scripts);
     }
     
     public void onProvideAdditionalMarkup(MarkupWriter writer)

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyDisplayBlocks.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyDisplayBlocks.java?rev=1026534&r1=1026533&r2=1026534&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyDisplayBlocks.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyDisplayBlocks.java Fri Oct 22 23:56:54 2010
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008 The Apache Software Foundation
+// Copyright 2007, 2008, 2010 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.
@@ -19,6 +19,7 @@ import org.apache.tapestry5.Renderable;
 import org.apache.tapestry5.annotations.Environmental;
 import org.apache.tapestry5.internal.TapestryInternalUtils;
 import org.apache.tapestry5.ioc.annotations.Inject;
+import org.apache.tapestry5.services.BeanBlockSource;
 import org.apache.tapestry5.services.PropertyOutputContext;
 
 import java.text.DateFormat;
@@ -26,6 +27,10 @@ import java.util.Calendar;
 import java.util.Date;
 import java.util.Locale;
 
+/**
+ * Contains blocks for displaying basic property types; the blocks are contributed to the
+ * {@link BeanBlockSource} service.
+ */
 public class PropertyDisplayBlocks
 {
     @Environmental