1 16 package javax.faces.model; 17 18 import java.util.ArrayList ; 19 import java.util.List ; 20 21 25 public abstract class DataModel 26 { 27 28 private List _listeners; 30 31 37 public void addDataModelListener(DataModelListener listener) 39 { 40 if (listener == null) throw new NullPointerException ("listener"); 41 if (_listeners == null) 42 { 43 _listeners = new ArrayList (); 44 } 45 _listeners.add(listener); 46 } 47 48 public DataModelListener[] getDataModelListeners() 49 { 50 if (_listeners == null) 51 { 52 return new DataModelListener[0]; 53 } 54 return (DataModelListener[])_listeners.toArray(new DataModelListener[_listeners.size()]); 55 } 56 57 abstract public int getRowCount(); 58 59 abstract public Object getRowData(); 60 61 abstract public int getRowIndex(); 62 63 abstract public Object getWrappedData(); 64 65 abstract public boolean isRowAvailable(); 66 67 public void removeDataModelListener(DataModelListener listener) 68 { 69 if (listener == null) throw new NullPointerException ("listener"); 70 if (_listeners != null) 71 { 72 _listeners.remove(listener); 73 } 74 } 75 76 abstract public void setRowIndex(int rowIndex); 77 78 abstract public void setWrappedData(Object data); 79 80 } 81 | Popular Tags |