KickJava   Java API By Example, From Geeks To Geeks.

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


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 import java.util.ArrayList JavaDoc;
16 import java.util.Iterator JavaDoc;
17 import java.util.List JavaDoc;
18
19 /**
20  * @author av
21  */

22 public class TableModelChangeSupport {
23   ArrayList JavaDoc listeners = new ArrayList JavaDoc();
24   TableModel source;
25
26   public TableModelChangeSupport(TableModel source) {
27     this.source = source;
28   }
29
30   public void fireModelChanged(boolean identityChanged) {
31     if (listeners.size() > 0) {
32       TableModelChangeEvent event = new TableModelChangeEvent(source, identityChanged);
33       List JavaDoc copy = (List JavaDoc) listeners.clone();
34       for (Iterator JavaDoc it = copy.iterator(); it.hasNext();)
35          ((TableModelChangeListener) it.next()).tableModelChanged(event);
36     }
37   }
38
39   public void addTableModelChangeListener(TableModelChangeListener l) {
40     listeners.add(l);
41   }
42
43   public void removeTableModelChangeListener(TableModelChangeListener l) {
44     listeners.remove(l);
45   }
46
47 }
48
Popular Tags