Clover coverage report - Code Coverage for tapestry-contrib release 4.0-beta-8
Coverage timestamp: Sat Sep 24 2005 11:56:21 EDT
file stats: LOC: 102   Methods: 7
NCLOC: 50   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SimpleSetTableDataModel.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.simple;
 16   
 17    import java.io.Serializable;
 18    import java.util.Collection;
 19    import java.util.Iterator;
 20    import java.util.Set;
 21   
 22    import org.apache.tapestry.contrib.table.model.CTableDataModelEvent;
 23    import org.apache.tapestry.contrib.table.model.common.AbstractTableDataModel;
 24   
 25    /**
 26    * A minimal set implementation of the
 27    * {@link org.apache.tapestry.contrib.table.model.ITableDataModel} interface
 28    *
 29    * @author mindbridge
 30    */
 31    public class SimpleSetTableDataModel extends AbstractTableDataModel implements Serializable
 32    {
 33    private static final long serialVersionUID = 1L;
 34   
 35    private Set m_setRows;
 36   
 37  0 public SimpleSetTableDataModel(Set setRows)
 38    {
 39  0 m_setRows = setRows;
 40    }
 41   
 42    /**
 43    * @see org.apache.tapestry.contrib.table.model.ITableDataModel#getRowCount()
 44    */
 45  0 public int getRowCount()
 46    {
 47  0 return m_setRows.size();
 48    }
 49   
 50    /**
 51    * @see org.apache.tapestry.contrib.table.model.ITableDataModel#getRows()
 52    */
 53  0 public Iterator getRows()
 54    {
 55  0 return m_setRows.iterator();
 56    }
 57   
 58    /**
 59    * Method addRow.
 60    * Adds a row object to the model at its end
 61    * @param objRow the row object to add
 62    */
 63  0 public void addRow(Object objRow)
 64    {
 65  0 if (m_setRows.contains(objRow)) return;
 66  0 m_setRows.add(objRow);
 67   
 68  0 CTableDataModelEvent objEvent = new CTableDataModelEvent();
 69  0 fireTableDataModelEvent(objEvent);
 70    }
 71   
 72  0 public void addRows(Collection arrRows)
 73    {
 74  0 m_setRows.addAll(arrRows);
 75   
 76  0 CTableDataModelEvent objEvent = new CTableDataModelEvent();
 77  0 fireTableDataModelEvent(objEvent);
 78    }
 79   
 80    /**
 81    * Method removeRow.
 82    * Removes a row object from the model
 83    * @param objRow the row object to remove
 84    */
 85  0 public void removeRow(Object objRow)
 86    {
 87  0 if (!m_setRows.contains(objRow)) return;
 88  0 m_setRows.remove(objRow);
 89   
 90  0 CTableDataModelEvent objEvent = new CTableDataModelEvent();
 91  0 fireTableDataModelEvent(objEvent);
 92    }
 93   
 94  0 public void removeRows(Collection arrRows)
 95    {
 96  0 m_setRows.removeAll(arrRows);
 97   
 98  0 CTableDataModelEvent objEvent = new CTableDataModelEvent();
 99  0 fireTableDataModelEvent(objEvent);
 100    }
 101   
 102    }