Return-Path: Delivered-To: apmail-click-commits-archive@www.apache.org Received: (qmail 39883 invoked from network); 12 Apr 2010 14:23:08 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 12 Apr 2010 14:23:08 -0000 Received: (qmail 67196 invoked by uid 500); 12 Apr 2010 14:23:08 -0000 Delivered-To: apmail-click-commits-archive@click.apache.org Received: (qmail 67179 invoked by uid 500); 12 Apr 2010 14:23:08 -0000 Mailing-List: contact commits-help@click.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: click-dev@click.apache.org Delivered-To: mailing list commits@click.apache.org Received: (qmail 67171 invoked by uid 99); 12 Apr 2010 14:23:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Apr 2010 14:23:08 +0000 X-ASF-Spam-Status: No, hits=-1679.3 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Apr 2010 14:23:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2397E23889E2; Mon, 12 Apr 2010 14:22:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r933254 - in /click/trunk/click: documentation/xdocs/src/docbook/click/chapter-introduction.xml examples/src/org/apache/click/examples/page/introduction/SimpleTablePage.java Date: Mon, 12 Apr 2010 14:22:47 -0000 To: commits@click.apache.org From: sabob@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100412142247.2397E23889E2@eris.apache.org> Author: sabob Date: Mon Apr 12 14:22:46 2010 New Revision: 933254 URL: http://svn.apache.org/viewvc?rev=933254&view=rev Log: doco Modified: click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml click/trunk/click/examples/src/org/apache/click/examples/page/introduction/SimpleTablePage.java Modified: click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml URL: http://svn.apache.org/viewvc/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml?rev=933254&r1=933253&r2=933254&view=diff ============================================================================== --- click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml (original) +++ click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml Mon Apr 12 14:22:46 2010 @@ -481,6 +481,15 @@ public HelloWorld extends Page { column.setDecorator(new LinkDecorator(table, links, "id")); column.setSortable(false); table.addColumn(column); + + // Table rowList will be populated through a DataProvider which loads + // data on demand. + table.setDataProvider(new DataProvider() { + + public List getData() { + return getCustomerService().getCustomers(); + } + }); } // ---------------------------------- Event Handlers @@ -493,15 +502,6 @@ public HelloWorld extends Page { getCustomerService().deleteCustomer(id); return true; } - - /** - * @see Page#onRender() - */ - @Override - public void onRender() { - List list = getCustomerService().getCustomersByName(); - table.setRowList(list); - } } @@ -517,15 +517,17 @@ public HelloWorld extends Page { In this Page code example a Table control is declared and a number of Column - objects are added. An editLink - PageLink + objects are added. We set the Table's + DataProvider + instance which provides data on demand to the table. Data retrieved from the + dataProvider will be used to populate the Table rowList before it is rendered. + An editLink PageLink control is used as decorator for the "Action" column. This control navigates to the EditCustomer page. A deleteLink ActionLink control is also used as a decorator for the "Action" column. This control will invoke the Page onDeleteClick() method when it is - clicked. Finally we have the Page onRender() method - which is used to populate the Table control with rows before it is rendered. + clicked. In our Page template we simply reference the $table Modified: click/trunk/click/examples/src/org/apache/click/examples/page/introduction/SimpleTablePage.java URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/SimpleTablePage.java?rev=933254&r1=933253&r2=933254&view=diff ============================================================================== --- click/trunk/click/examples/src/org/apache/click/examples/page/introduction/SimpleTablePage.java (original) +++ click/trunk/click/examples/src/org/apache/click/examples/page/introduction/SimpleTablePage.java Mon Apr 12 14:22:46 2010 @@ -41,10 +41,12 @@ public class SimpleTablePage extends Bor @Resource(name="customerService") private CustomerService customerService; + private Table table; + // Constructor ------------------------------------------------------------ public SimpleTablePage() { - Table table = new Table("table"); + table = new Table("table"); table.setClass(Table.CLASS_ITS); @@ -53,13 +55,15 @@ public class SimpleTablePage extends Bor table.addColumn(new Column("email")); table.addColumn(new Column("investments")); - table.setDataProvider(new DataProvider() { - public List getData() { - return customerService.getCustomersSortedByName(10); - } - }); - addControl(table); } + /** + * @see Page#onRender() + */ + @Override + public void onRender() { + List list = customerService.getCustomersSortedByName(10); + table.setRowList(list); + } }