[ 
https://issues.apache.org/jira/browse/TAPESTRY-933?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jesse Kuhnert resolved TAPESTRY-933.
------------------------------------

    Resolution: Fixed
      Assignee: Jesse Kuhnert

> Add getRowCount() to ITableModel interface
> ------------------------------------------
>
>                 Key: TAPESTRY-933
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-933
>             Project: Tapestry
>          Issue Type: Improvement
>          Components: Contrib
>    Affects Versions: 4.0.1
>         Environment: N/A
>            Reporter: Ryan Holmes
>            Assignee: Jesse Kuhnert
>            Priority: Minor
>             Fix For: 4.1.2
>
>
> All classes that implement ITableModel already have a getRowCount() method. 
> It would be useful to call this method from subclasses of 
> AbstractTableViewComponent, which can access the underlying ITableModel 
> through ITableModelSource.getTableModelSource().getTableModel(). 
> My specific use case is a "PageInfo" component included in a custom Table 
> component that displays something along the lines of "Viewing items x - x of 
> xx." Because any combination of "source" and "columns" parameters to a 
> TableView component results in an AbstractTableModel (which defines 
> getRowCount() as protected), I currently cast 
> getTableModelSource().getTableModel() to an AbstractTableModel and use 
> reflection to call getRowCount(). This works for the range of data sources I 
> currently use with TableView, but is obviously an ugly hack.
> Adding getRowCount() to ITableModel would require the following additional 
> changes:
> 1. Make getRowCount() in AbstractTableModel public.
> 2. Mage getRowCount() in BasicTableModelWrap public.
> 3. Make getRowCount() in SqlTableModel public.
> I am aware that repeated calls to getRowCount() could create performance 
> issues, especially for database-backed table models such as IBasicTableModel. 
> However, caching the row count can be handled easily in an IBasicTableModel 
> class and is outside the scope of the Table components anyway.
> If a change to the ITableModel interface is considered too radical in the 
> near term, a workaround would be to change the access modifier of 
> AbstractTableModel.getRowCount() from protected to public. This would provide 
> easy access to getRowCount in most cases.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to