KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > table > TableModelDecorator


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  *
11  *
12  */

13 package com.tonbeller.wcf.table;
14
15 /**
16  * @author av
17  */

18 public class TableModelDecorator implements TableModel, TableModelChangeListener {
19   private TableModel decoree;
20
21   protected TableModelDecorator() {
22   }
23
24   public TableModelDecorator(TableModel decoree) {
25     this.decoree = decoree;
26     decoree.addTableModelChangeListener(this);
27   }
28
29   public TableModel getDecoree() {
30     return decoree;
31   }
32
33   public void setDecoree(TableModel newDecoree) {
34     if (decoree != null)
35       decoree.removeTableModelChangeListener(this);
36     decoree = newDecoree;
37     decoree.addTableModelChangeListener(this);
38   }
39
40   public void addTableModelChangeListener(TableModelChangeListener listener) {
41     decoree.addTableModelChangeListener(listener);
42   }
43
44   public void fireModelChanged(boolean identityChanged) {
45     decoree.fireModelChanged(identityChanged);
46   }
47
48   public int getColumnCount() {
49     return decoree.getColumnCount();
50   }
51
52   public String JavaDoc getColumnTitle(int columnIndex) {
53     return decoree.getColumnTitle(columnIndex);
54   }
55
56   public TableRow getRow(int rowIndex) {
57     return decoree.getRow(rowIndex);
58   }
59
60   public int getRowCount() {
61     return decoree.getRowCount();
62   }
63
64   public String JavaDoc getTitle() {
65     return decoree.getTitle();
66   }
67
68   public void removeTableModelChangeListener(TableModelChangeListener listener) {
69     decoree.removeTableModelChangeListener(listener);
70   }
71
72   public void tableModelChanged(TableModelChangeEvent event) {
73   }
74
75 }
76
Popular Tags