KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > swing > table > TableModelDecorator


1 /*
2  * EJTools, the Enterprise Java Tools
3  *
4  * Distributable under LGPL license.
5  * See terms of license at www.gnu.org.
6  */

7 package org.ejtools.swing.table;
8
9 import javax.swing.event.TableModelEvent JavaDoc;
10 import javax.swing.event.TableModelListener JavaDoc;
11 import javax.swing.table.AbstractTableModel JavaDoc;
12 import javax.swing.table.TableModel JavaDoc;
13
14 /**
15  * @author Laurent Etiemble
16  * @version $Revision: 1.9 $
17  */

18 public abstract class TableModelDecorator extends AbstractTableModel JavaDoc implements TableModelListener JavaDoc
19 {
20    /** Description of the Field */
21    protected TableModel JavaDoc model = null;
22
23
24    /**
25     * Constructor for TableFilter.
26     *
27     * @param model Description of the Parameter
28     */

29    public TableModelDecorator(TableModel JavaDoc model)
30    {
31       this.model = model;
32       this.model.addTableModelListener(this);
33    }
34
35
36    /** Constructor for TableModelDecorator. */
37    protected TableModelDecorator()
38    {
39       super();
40    }
41
42
43    /**
44     * @param column Description of the Parameter
45     * @return The columnClass value
46     */

47    public Class JavaDoc getColumnClass(int column)
48    {
49       return this.model.getColumnClass(column);
50    }
51
52
53    /**
54     * @return The columnCount value
55     */

56    public int getColumnCount()
57    {
58       return this.model.getColumnCount();
59    }
60
61
62    /**
63     * @param column Description of the Parameter
64     * @return The columnName value
65     */

66    public String JavaDoc getColumnName(int column)
67    {
68       return this.model.getColumnName(column);
69    }
70
71
72    /**
73     * Returns the model.
74     *
75     * @return TableModel
76     */

77    public TableModel JavaDoc getModel()
78    {
79       return this.model;
80    }
81
82
83    /**
84     * @return The rowCount value
85     */

86    public int getRowCount()
87    {
88       return this.model.getRowCount();
89    }
90
91
92    /**
93     * @param row Description of the Parameter
94     * @param column Description of the Parameter
95     * @return The valueAt value
96     */

97    public Object JavaDoc getValueAt(int row, int column)
98    {
99       return this.model.getValueAt(row, column);
100    }
101
102
103    /**
104     * @param row Description of the Parameter
105     * @param column Description of the Parameter
106     * @return The cellEditable value
107     */

108    public boolean isCellEditable(int row, int column)
109    {
110       return this.model.isCellEditable(row, column);
111    }
112
113
114    /**
115     * Sets the model.
116     *
117     * @param model The model to set
118     */

119    public void setModel(TableModel JavaDoc model)
120    {
121       this.model = model;
122    }
123
124
125    /**
126     * @param o The new valueAt value
127     * @param row The new valueAt value
128     * @param column The new valueAt value
129     */

130    public void setValueAt(Object JavaDoc o, int row, int column)
131    {
132       this.model.setValueAt(o, row, column);
133    }
134
135
136    /**
137     * @param event Description of the Parameter
138     */

139    public void tableChanged(TableModelEvent JavaDoc event)
140    {
141       this.fireTableChanged(event);
142    }
143 }
144
Popular Tags