Clover coverage report - Code Coverage for tapestry-contrib release 4.0-beta-12
Coverage timestamp: Sun Oct 30 2005 16:28:27 EST
file stats: LOC: 81   Methods: 5
NCLOC: 42   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
BasicTableModelWrap.java 0% 0% 0% 0%
coverage
 1    // Copyright 2004, 2005 The Apache Software Foundation
 2    //
 3    // Licensed under the Apache License, Version 2.0 (the "License");
 4    // you may not use this file except in compliance with the License.
 5    // You may obtain a copy of the License at
 6    //
 7    // http://www.apache.org/licenses/LICENSE-2.0
 8    //
 9    // Unless required by applicable law or agreed to in writing, software
 10    // distributed under the License is distributed on an "AS IS" BASIS,
 11    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12    // See the License for the specific language governing permissions and
 13    // limitations under the License.
 14   
 15    package org.apache.tapestry.contrib.table.model.common;
 16   
 17    import java.util.Iterator;
 18   
 19    import org.apache.tapestry.contrib.table.model.IBasicTableModel;
 20    import org.apache.tapestry.contrib.table.model.ITableColumn;
 21    import org.apache.tapestry.contrib.table.model.ITableColumnModel;
 22    import org.apache.tapestry.contrib.table.model.simple.SimpleTableState;
 23   
 24    /**
 25    * @author mindbridge
 26    */
 27    public class BasicTableModelWrap extends AbstractTableModel
 28    {
 29    private static final long serialVersionUID = 1L;
 30   
 31    private IBasicTableModel m_objBasicTableModel;
 32    private ITableColumnModel m_objTableColumnModel;
 33   
 34  0 public BasicTableModelWrap(IBasicTableModel objBasicTableModel, ITableColumnModel objColumnModel)
 35    {
 36  0 this(objBasicTableModel, objColumnModel, new SimpleTableState());
 37    }
 38   
 39  0 public BasicTableModelWrap(IBasicTableModel objBasicTableModel, ITableColumnModel objColumnModel, SimpleTableState objState)
 40    {
 41  0 super(objState);
 42  0 m_objBasicTableModel = objBasicTableModel;
 43  0 m_objTableColumnModel = objColumnModel;
 44    }
 45   
 46    /**
 47    * @see org.apache.tapestry.contrib.table.model.ITableModel#getColumnModel()
 48    */
 49  0 public ITableColumnModel getColumnModel()
 50    {
 51  0 return m_objTableColumnModel;
 52    }
 53   
 54    /**
 55    * @see org.apache.tapestry.contrib.table.model.common.AbstractTableModel#getRowCount()
 56    */
 57  0 protected int getRowCount()
 58    {
 59  0 return m_objBasicTableModel.getRowCount();
 60    }
 61   
 62    /**
 63    * @see org.apache.tapestry.contrib.table.model.ITableModel#getCurrentPageRows()
 64    */
 65  0 public Iterator getCurrentPageRows()
 66    {
 67  0 int nPageSize = getPagingState().getPageSize();
 68  0 if (nPageSize <= 0)
 69  0 nPageSize = getRowCount();
 70   
 71  0 int nCurrentPage = getPagingState().getCurrentPage();
 72  0 int nFrom = nCurrentPage * nPageSize;
 73   
 74  0 String strSortColumn = getSortingState().getSortColumn();
 75  0 ITableColumn objSortColumn = getColumnModel().getColumn(strSortColumn);
 76  0 boolean bSortOrder = getSortingState().getSortOrder();
 77   
 78  0 return m_objBasicTableModel.getCurrentPageRows(nFrom, nPageSize, objSortColumn, bSortOrder);
 79    }
 80   
 81    }