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 2008/10/29 01:03:19 UTC

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

Author: hlship
Date: Tue Oct 28 17:03:19 2008
New Revision: 708733

URL: http://svn.apache.org/viewvc?rev=708733&view=rev
Log:
TAP5-238: Component reference for Grid's empty parameter is misleading; provide a good example

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

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.xdoc
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.xdoc?rev=708733&r1=708732&r2=708733&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.xdoc (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.xdoc Tue Oct 28 17:03:19 2008
@@ -39,30 +39,30 @@
                 <source><![CDATA[
 public class User
 {
-    private long _id;
+    @NonVisual
+    private long id;
 
-    private String _firstName;
+    private String firstName;
 
-    private String _lastName;
+    private String lastName;
 
-    private int _age;
+    private int age;
 
-    public long getId() { return _id; }
+    public long getId() { return id; }
 
-    @NonVisual
-    public void setId(long id) { _id = id; }
+    public void setId(long id) { this.id = id; }
 
-    public String getFirstName() { return _firstName; }
+    public String getFirstName() { return firstName; }
 
-    public void setFirstName(String firstName) { _firstName = firstName; }
+    public void setFirstName(String firstName) { this.firstName = firstName; }
 
-    public String getLastName() { return _lastName; }
+    public String getLastName() { return lastName; }
 
-    public void setLastName(String lastName) { _lastName = lastName; }
+    public void setLastName(String lastName) { this.lastName = lastName; }
 
-    public int getAge() { return _age; }
+    public int getAge() { return age; }
 
-    public void setAge(int age) { _age = age; }
+    public void setAge(int age) { this.age = age; }
 }]]></source>
 
                 <p>The @NonVisual annotation prevents the id property from being displayed.</p>
@@ -85,6 +85,9 @@
             <t:parameter name="lastnamecell">
                 <t:pagelink page="user/view" context="user.id">${user.lastname}</t:pagelink>
             </t:parameter>
+            <t:parameter name="empty">
+              <p>There are no users to display; you can <t:pagelink page="user/add">add some</a>.</p>
+            </t:parameter>
         </t:grid>
     </body>
 </html>
@@ -124,6 +127,12 @@
                     providing any links or icons related to sorting.
                 </p>
 
+                <p>
+                    Binding the Grid's empty parameter overrides the default message displayed when there
+                    is no data to display. As demonstrated above, it doesn't have to be simple text, the
+                    block can be a snippet of markup and components.
+                </p>
+
             </subsection>
 
             <subsection name="UserList.java">
@@ -131,12 +140,12 @@
 public class UserList
 {
     @Inject
-    private UserDAO _userDAO;
+    private UserDAO userDAO;
 
     @Property
-    private User _user;
+    private User user;
 
-    public List<User> getUsers() { return _userDAO.findAll(); }
+    public List<User> getUsers() { return userDAO.findAll(); }
 }]]></source>
 
             </subsection>
@@ -176,6 +185,9 @@
             <t:parameter name="deletecell">
                 <t:actionlink t:id="delete" context="user.id">Delete</t:actionlink>
             </t:parameter>
+            <t:parameter name="empty">
+              <p>There are no users to display; you can <t:pagelink page="user/add">add some</a>.</p>
+            </t:parameter>
         </t:grid>
     </body>
 </html>
@@ -198,16 +210,16 @@
 public class UserList
 {
     @Inject
-    private UserDAO _userDAO;
+    private UserDAO userDAO;
 
     @Property
-    private User _user;
+    private User user;
 
-    public List<User> getUsers() { return _userDAO.findAll(); }
+    public List<User> getUsers() { return userDAO.findAll(); }
 
     void onActionFromDelete(long userId)
     {
-        _userDAO.remove(userId);
+        userDAO.remove(userId);
     }  
 }]]></source>