1 13 package com.tonbeller.wcf.table; 14 15 import java.util.ArrayList ; 16 import java.util.Iterator ; 17 import java.util.List ; 18 19 22 public class TableModelChangeSupport { 23 ArrayList listeners = new ArrayList (); 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 copy = (List ) listeners.clone(); 34 for (Iterator 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 |