dev@woodstock.java.net

Re: Woodstock table with Seam ?

From: Padraig Byrne <padraigbyrne_at_yahoo.com>
Date: Mon, 13 Aug 2007 10:15:59 -0700 (PDT)

Dan, Thanks for reply & pointers .. Is the source code the documentation for dataprovider ?? I will take a more detailed read through it. Do you know if any work done on working with external entity managers / caches ? or is dataprovider intended as a entity manager and cache of sorts itself ? Rgds, Padraig. ----- Original Message ---- From: Dan Labrecque <Dan.Labrecque@Sun.COM> To: dev@woodstock.dev.java.net Sent: Monday, August 13, 2007 4:11:19 PM Subject: Re: Woodstock table with Seam ? Padraig Byrne wrote: Current situation is I have seam, richfaces & facelets with entity beans generated by seamgen but I like functionality of woodstock table (& some other components), which uses dataprovider as backend for table as far as I can see. seam gen generates beans which extend entityQuery beans & which I can directly connect woodstock table & perform sort functionailty out of the box but when I want to add filtering etc all the example use helper classes which are based on dataprovider ( eg filtercriteria ) I am trying to get a detailed understanding of this table & dataproviders & compatibility with entity beans Although the Woodstock table makes use of DataProvider, it is a separate jar created by the Netbeans Visual Web Pack folks. Go to that site and click on the "contact" link and select Mailing List FAQ. Once there, you'll find a lot of information regarding database connectivity; however, if that does not answer your questions, you can direct DataProvoder queries to the VWP team by clicking the "contact us" link. Below is a snippet from an old FAQ which may be useful -- the pointer to the APIs is particularly helpful. Note that you can also replace the Table's default sort mechanism via the tableDataSorter tag attribute/component property (i.e., if you want your database to do the work). The TableDataSorter class is also found in the com.sun.data.provider package. Can I use an SQL database as the data source for the Table component? I want to use data from an object of type java.sql.ResultSet. Yes. You need to use the following classes: CachedRowSetDataProvider, contained in the dataprovider.jar which is provided with the Sun Java Web UI component download. CachedRowSetImpl, contained in rowset.jar, which is available in Sun Java Studio Creator, or can be downloaded from Sun Developer Network. The rowset.jar has a dependency on sqlx.jar which is provided both in Creator and in the dependent jar download of external jars needed by the components. You can see the javadoc for the dataprovider API and javadoc for RowSet API on the Sun Developer Network. The <ui:tableRowGroup> tag's sourceData attribute can be bound to an object of type com.sun.data.provider.TableDataProvider. The com.sun.data.provider.impl.CachedRowSetDataProvider implements TableDataProvider interface. The java.sql.ResultSet object can be transformed into CachedRowSetDataProvider, using com.sun.rowset.CachedRowSetImpl. Sample code snippet: //java.sql.ResultSet ResultSet rs; .. .. //com.sun.rowset.CachedRowSetImpl from rowset.jar CachedRowSetImpl rslh = new CachedRowSetImpl(); rslh.populate(rs); //com.sun.data.provider.impl.CachedRowSetDataProvider from dataprovider.jar CachedRowSetDataProvider model = new CachedRowSetDataProvider(rslh); On woodstock table, sorting etc is there any detailed document on how this works when filering sorting etc & what is the best forum to put these questions ? Build the webui module of the Woodstock repository and view the TLD docs for Table, TableRowGroup, and TableColumn. These TLD docs have several examples each. In particular, you'll find information about sorting in the TableCoulmn doc. Examples of advanced sorting and filtering can be found in in the Table and TableRowGroup docs These examples can also be found live at: https://woodstock.dev.java.net/Preview.htm Dan