tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkuhn...@apache.org
Subject svn commit: r544021 - in /tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table: components/ model/ model/common/ model/sql/
Date Mon, 04 Jun 2007 00:39:12 GMT
Author: jkuhnert
Date: Sun Jun  3 17:39:10 2007
New Revision: 544021

URL: http://svn.apache.org/viewvc?view=rev&rev=544021
Log:
Resolves TAPESTRY-933. I needed this as well recently. Added no-brainer enhancement of getRowCount()
to ITableModel.

Modified:
    tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/components/TableView.java
    tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/ITableModel.java
    tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/common/AbstractTableModel.java
    tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/common/BasicTableModelWrap.java
    tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/sql/SqlTableModel.java

Modified: tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/components/TableView.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/components/TableView.java?view=diff&rev=544021&r1=544020&r2=544021
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/components/TableView.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/components/TableView.java
Sun Jun  3 17:39:10 2007
@@ -14,28 +14,12 @@
 
 package org.apache.tapestry.contrib.table.components;
 
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
 import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.tapestry.BaseComponent;
 import org.apache.tapestry.IComponent;
 import org.apache.tapestry.IMarkupWriter;
 import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.contrib.table.model.IAdvancedTableColumnSource;
-import org.apache.tapestry.contrib.table.model.IBasicTableModel;
-import org.apache.tapestry.contrib.table.model.ITableAction;
-import org.apache.tapestry.contrib.table.model.ITableColumn;
-import org.apache.tapestry.contrib.table.model.ITableColumnModel;
-import org.apache.tapestry.contrib.table.model.ITableDataModel;
-import org.apache.tapestry.contrib.table.model.ITableModel;
-import org.apache.tapestry.contrib.table.model.ITableModelSource;
-import org.apache.tapestry.contrib.table.model.ITablePagingState;
-import org.apache.tapestry.contrib.table.model.ITableSessionStateManager;
-import org.apache.tapestry.contrib.table.model.ITableSessionStoreManager;
+import org.apache.tapestry.contrib.table.model.*;
 import org.apache.tapestry.contrib.table.model.common.BasicTableModelWrap;
 import org.apache.tapestry.contrib.table.model.simple.SimpleListTableDataModel;
 import org.apache.tapestry.contrib.table.model.simple.SimpleTableColumnModel;
@@ -45,6 +29,12 @@
 import org.apache.tapestry.event.PageDetachListener;
 import org.apache.tapestry.event.PageEvent;
 
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
 /**
  * A low level Table component that wraps all other low level Table components.
  * This component carries the
@@ -232,8 +222,7 @@
             m_objTableModel = generateTableModel(null);
 
         if (m_objTableModel == null)
-            throw new ApplicationRuntimeException(TableMessages
-                    .missingTableModel(this));
+            throw new ApplicationRuntimeException(TableMessages.missingTableModel(this));
 
         return m_objTableModel;
     }

Modified: tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/ITableModel.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/ITableModel.java?view=diff&rev=544021&r1=544020&r2=544021
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/ITableModel.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/ITableModel.java
Sun Jun  3 17:39:10 2007
@@ -61,4 +61,11 @@
      *         data, sorting, and paging state
      */
     Iterator getCurrentPageRows();
+
+    /**
+     * Returns the total number of rows / values this model is managing.
+     *
+     * @return The total number of rows - if known.
+     */
+    int getRowCount();
 }

Modified: tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/common/AbstractTableModel.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/common/AbstractTableModel.java?view=diff&rev=544021&r1=544020&r2=544021
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/common/AbstractTableModel.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/common/AbstractTableModel.java
Sun Jun  3 17:39:10 2007
@@ -14,13 +14,13 @@
 
 package org.apache.tapestry.contrib.table.model.common;
 
-import java.io.Serializable;
-
 import org.apache.tapestry.contrib.table.model.ITableModel;
 import org.apache.tapestry.contrib.table.model.ITablePagingState;
 import org.apache.tapestry.contrib.table.model.ITableSortingState;
 import org.apache.tapestry.contrib.table.model.simple.SimpleTableState;
 
+import java.io.Serializable;
+
 /**
  * A base table model that implements the handling of the model state.
  * Used by most standard ITableModel implementations.
@@ -65,8 +65,6 @@
     {
         return m_objTableState;
     }
-
-    protected abstract int getRowCount();
     
     public int getPageCount()
     {
@@ -80,5 +78,4 @@
 
         return (nRowCount - 1) / nPageSize + 1;
     }
-    
 }

Modified: tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/common/BasicTableModelWrap.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/common/BasicTableModelWrap.java?view=diff&rev=544021&r1=544020&r2=544021
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/common/BasicTableModelWrap.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/common/BasicTableModelWrap.java
Sun Jun  3 17:39:10 2007
@@ -14,13 +14,13 @@
 
 package org.apache.tapestry.contrib.table.model.common;
 
-import java.util.Iterator;
-
 import org.apache.tapestry.contrib.table.model.IBasicTableModel;
 import org.apache.tapestry.contrib.table.model.ITableColumn;
 import org.apache.tapestry.contrib.table.model.ITableColumnModel;
 import org.apache.tapestry.contrib.table.model.simple.SimpleTableState;
 
+import java.util.Iterator;
+
 /**
  * @author mindbridge
  */
@@ -57,7 +57,7 @@
     /**
      * @see org.apache.tapestry.contrib.table.model.common.AbstractTableModel#getRowCount()
      */
-    protected int getRowCount()
+    public int getRowCount()
     {
         return m_objBasicTableModel.getRowCount();
     }

Modified: tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/sql/SqlTableModel.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/sql/SqlTableModel.java?view=diff&rev=544021&r1=544020&r2=544021
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/sql/SqlTableModel.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/table/model/sql/SqlTableModel.java
Sun Jun  3 17:39:10 2007
@@ -14,16 +14,16 @@
 
 package org.apache.tapestry.contrib.table.model.sql;
 
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Iterator;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.tapestry.contrib.table.model.ITableColumnModel;
 import org.apache.tapestry.contrib.table.model.common.AbstractTableModel;
 import org.apache.tapestry.contrib.table.model.simple.SimpleTableState;
 
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Iterator;
+
 /**
  * An implementation of ITableModel that obtains its data through SQL queries.
  * This is a very efficient model, since it uses SQL to perform the data sorting
@@ -109,8 +109,7 @@
     {
         try
         {
-            ResultSet objResultSet = getSqlDataSource().getCurrentRows(
-                    getSqlColumnModel(), getState());
+            ResultSet objResultSet = getSqlDataSource().getCurrentRows(getSqlColumnModel(),
getState());
 
             return new ResultSetIterator(objResultSet)
             {
@@ -141,7 +140,7 @@
     /**
      * @see org.apache.tapestry.contrib.table.model.common.AbstractTableModel#getRowCount()
      */
-    protected int getRowCount()
+    public int getRowCount()
     {
         try
         {



Mime
View raw message