You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/03/19 23:32:46 UTC

svn commit: r639042 - /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Grid.xdoc

Author: hlship
Date: Wed Mar 19 15:32:42 2008
New Revision: 639042

URL: http://svn.apache.org/viewvc?rev=639042&view=rev
Log:
TAPESTRY-2265:  Grid component documentation could be simplified

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Grid.xdoc

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Grid.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Grid.xdoc?rev=639042&r1=639041&r2=639042&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Grid.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Grid.xdoc Wed Mar 19 15:32:42 2008
@@ -133,13 +133,10 @@
     @Inject
     private UserDAO _userDAO;
 
+    @Property
     private User _user;
 
     public List<User> getUsers() { return _userDAO.findAll(); }
-
-    public void setUser(User user) { _user = user; }
-
-    public User getUser() { return _user; }
 }]]></source>
 
             </subsection>
@@ -159,23 +156,20 @@
                 for an action. We'll do the latter, adding a column for deleting a user.
             </p>
 
-            <subsection name="UserList.tml">
 
-                <p>
-                    We want to make the user's last name a clickable link to delete
-                    the user for that row.
-                </p>
+            <p>
+                <img src="grid_ref2.png"/>
+            </p>
+
+            <subsection name="UserList.tml">
 
-                <p>
-                    <img src="grid_ref2.png"/>
-                </p>
 
                 <source><![CDATA[
 <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
     <body>
         <h1>List Users</h1>
 
-        <t:grid source="users" row="user" model="model">
+        <t:grid source="users" row="user" add="delete">
             <t:parameter name="lastnamecell">
                 <t:pagelink page="user/view" context="user.id">${user.lastname}</t:pagelink>
             </t:parameter>
@@ -188,7 +182,8 @@
 ]]></source>
 
                 <p>
-                    We now explicitly provide a model parameter. In addition, a block
+                    We now explicitly provide a column for the "delete" property, which doesn't exist. In addition, a
+                    block
                     for the "delete" property has been added that includes an ActionLink
                     used to delete the user for the current row. This property is a
                     <em>virtual</em>
@@ -205,41 +200,22 @@
     @Inject
     private UserDAO _userDAO;
 
-    @Inject
-    private BeanModelSource _beanModelSource;
-
-    @Inject
-    private ComponentResources _resources;
-
-    private final BeanModel _model;
-
-    {
-        _model = _beanModelSource.create(User.class, true, _resources);
-
-        _model.add("delete", null);
-    }
-
+    @Property
     private User _user;
 
     public List<User> getUsers() { return _userDAO.findAll(); }
 
-    public void setUser(User user) { _user = user; }
-
-    public User getUser() { return _user; }
-
-    public BeanModel getModel() { return _model; }
-
     void onActionFromDelete(long userId)
     {
         _userDAO.remove(userId);
     }  
 }]]></source>
 
+
                 <p>
-                    Here we create the model using the BeanModelSource service.
-                    We then customize it, adding a new property, "delete". The null
-                    indicates that this is a virtual property, with no real data behind it.
+                    The only addition here is an event handler method for when the delete link is clicked.
                 </p>
+
 
             </subsection>