1 20 package org.enhydra.barracuda.core.comp; 21 22 import java.util.*; 23 import org.enhydra.barracuda.core.comp.model.*; 24 25 29 public abstract class AbstractListModel implements ListModel { 30 31 protected ViewContext viewContext = null; 32 protected List listeners = new ArrayList(); 33 34 41 public void addModelListener(ModelListener ml) { 42 listeners.add(ml); 43 } 44 45 50 public void removeModelListener(ModelListener ml) { 51 listeners.remove(ml); 52 } 53 54 59 public void fireModelChanged() { 60 Iterator it = listeners.iterator(); 61 ModelListener ml = null; 62 while (it.hasNext()) { 63 ml = (ModelListener) it.next(); 64 ml.modelChanged(this); 65 } 66 } 67 69 76 80 85 89 96 public void resetModel() { 97 } 99 100 112 124 136 148 160 172 178 183 184 193 public void setViewContext(ViewContext ivc) { 194 viewContext = ivc; 195 } 196 197 202 public ViewContext getViewContext() { 203 return viewContext; 204 } 205 206 } | Popular Tags |