Coverage Report - javax.faces.model.DataModel
 
Classes in this File Line Coverage Branch Coverage Complexity
DataModel
94%
15/16
50%
2/4
1.182
 
 1  
 /*
 2  
  * Copyright 2004-2011 the Seasar Foundation and the Others.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 13  
  * either express or implied. See the License for the specific language
 14  
  * governing permissions and limitations under the License.
 15  
  */
 16  
 package javax.faces.model;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.List;
 20  
 
 21  
 import org.seasar.framework.util.AssertionUtil;
 22  
 
 23  
 /**
 24  
  * @author shot
 25  
  */
 26  
 public abstract class DataModel {
 27  
 
 28  113
     private List listeners = null;
 29  
 
 30  113
     public DataModel() {
 31  113
         listeners = new ArrayList();
 32  113
     }
 33  
 
 34  
     public abstract int getRowCount();
 35  
 
 36  
     public abstract Object getRowData();
 37  
 
 38  
     public abstract int getRowIndex();
 39  
 
 40  
     public abstract Object getWrappedData();
 41  
 
 42  
     public abstract boolean isRowAvailable();
 43  
 
 44  
     public abstract void setRowIndex(int rowIndex);
 45  
 
 46  
     public abstract void setWrappedData(Object data);
 47  
 
 48  
     public void addDataModelListener(DataModelListener listener) {
 49  16
         AssertionUtil.assertNotNull("listener", listener);
 50  15
         listeners.add(listener);
 51  15
     }
 52  
 
 53  
     public DataModelListener[] getDataModelListeners() {
 54  204
         DataModelListener[] dataModelListeners = null;
 55  204
         if (listeners == null) {
 56  0
             dataModelListeners = new DataModelListener[0];
 57  
         } else {
 58  204
             dataModelListeners = (DataModelListener[]) this.listeners
 59  
                     .toArray(new DataModelListener[this.listeners.size()]);
 60  
         }
 61  204
         return dataModelListeners;
 62  
     }
 63  
 
 64  
     public void removeDataModelListener(DataModelListener listener) {
 65  2
         AssertionUtil.assertNotNull("listener", listener);
 66  1
         if (listeners != null) {
 67  1
             listeners.remove(listener);
 68  
         }
 69  1
     }
 70  
 
 71  
 }