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: 80   Methods: 6
NCLOC: 46   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SimpleTableColumnModel.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.HashMap;
 19    import java.util.Iterator;
 20    import java.util.List;
 21    import java.util.Map;
 22   
 23    import org.apache.tapestry.contrib.table.model.ITableColumn;
 24    import org.apache.tapestry.contrib.table.model.ITableColumnModel;
 25    import org.apache.tapestry.contrib.table.model.common.ArrayIterator;
 26   
 27    /**
 28    * A minimal implementation of the
 29    * {@link org.apache.tapestry.contrib.table.model.ITableColumnModel} interface
 30    * that stores columns as an array.
 31    *
 32    * @author mindbridge
 33    */
 34    public class SimpleTableColumnModel implements ITableColumnModel, Serializable
 35    {
 36    private static final long serialVersionUID = 1L;
 37   
 38    private ITableColumn[] m_arrColumns;
 39    private Map m_mapColumns;
 40   
 41  0 public SimpleTableColumnModel(ITableColumn[] arrColumns)
 42    {
 43  0 m_arrColumns = arrColumns;
 44   
 45  0 m_mapColumns = new HashMap();
 46  0 for (int i = 0; i < m_arrColumns.length; i++)
 47  0 m_mapColumns.put(m_arrColumns[i].getColumnName(), m_arrColumns[i]);
 48    }
 49   
 50  0 public SimpleTableColumnModel(List arrColumns)
 51    {
 52  0 this((ITableColumn[]) arrColumns.toArray(new ITableColumn[arrColumns.size()]));
 53    }
 54   
 55  0 public int getColumnCount()
 56    {
 57  0 return m_arrColumns.length;
 58    }
 59   
 60  0 public ITableColumn getColumn(int nColumn)
 61    {
 62  0 if (nColumn < 0 || nColumn >= m_arrColumns.length)
 63    {
 64    // error message
 65  0 return null;
 66    }
 67  0 return m_arrColumns[nColumn];
 68    }
 69   
 70  0 public ITableColumn getColumn(String strColumn)
 71    {
 72  0 return (ITableColumn) m_mapColumns.get(strColumn);
 73    }
 74   
 75  0 public Iterator getColumns()
 76    {
 77  0 return new ArrayIterator(m_arrColumns);
 78    }
 79   
 80    }