KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > faces > model > DataModel


1 /*
2  * Copyright 2004 The Apache Software Foundation.
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, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package javax.faces.model;
17
18 import java.util.ArrayList JavaDoc;
19 import java.util.List JavaDoc;
20
21 /**
22   * @author Thomas Spiegl (latest modification by $Author: mwessendorf $)
23   * @version $Revision: 1.6 $ $Date: 2004/08/22 10:39:27 $
24 */

25 public abstract class DataModel
26 {
27
28     // FIELDS
29
private List JavaDoc _listeners;
30
31     // CONSTRUCTORS
32
/* public DataModel()
33     {
34         setWrappedData(null);
35     }
36 */

37     // METHODS
38
public void addDataModelListener(DataModelListener listener)
39     {
40         if (listener == null) throw new NullPointerException JavaDoc("listener");
41         if (_listeners == null)
42         {
43             _listeners = new ArrayList JavaDoc();
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 JavaDoc getRowData();
60
61     abstract public int getRowIndex();
62
63     abstract public Object JavaDoc getWrappedData();
64
65     abstract public boolean isRowAvailable();
66
67     public void removeDataModelListener(DataModelListener listener)
68     {
69         if (listener == null) throw new NullPointerException JavaDoc("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 JavaDoc data);
79
80 }
81
Popular Tags