Add getRowCount() to ITableModel interface
------------------------------------------
Key: TAPESTRY-933
URL: http://issues.apache.org/jira/browse/TAPESTRY-933
Project: Tapestry
Type: Improvement
Components: Contrib
Versions: 4.0.1
Environment: N/A
Reporter: Ryan Holmes
Priority: Minor
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.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]