1 23 24 package org.objectweb.fractal.gui.model; 25 26 import org.objectweb.fractal.api.control.BindingController; 27 28 import java.util.Map ; 29 import java.util.HashMap ; 30 import java.util.Iterator ; 31 32 36 37 public class ConfigurationNotifier implements 38 ConfigurationListener, 39 BindingController 40 { 41 42 46 47 public final static String CONFIGURATION_LISTENERS_BINDING = 48 "configuration-listeners"; 49 50 53 54 private Map listeners; 55 56 59 60 public ConfigurationNotifier () { 61 listeners = new HashMap (); 62 } 63 64 68 public String [] listFc () { 69 return (String [])listeners.keySet().toArray(new String [listeners.size()]); 70 } 71 72 public Object lookupFc (final String clientItfName) { 73 if (clientItfName.startsWith(CONFIGURATION_LISTENERS_BINDING)) { 74 return listeners.get(clientItfName); 75 } 76 return null; 77 } 78 79 public void bindFc ( 80 final String clientItfName, 81 final Object serverItf) 82 { 83 if (clientItfName.startsWith(CONFIGURATION_LISTENERS_BINDING)) { 84 listeners.put(clientItfName, serverItf); 85 } 86 } 87 88 public void unbindFc (final String clientItfName) { 89 if (clientItfName.startsWith(CONFIGURATION_LISTENERS_BINDING)) { 90 listeners.remove(clientItfName); 91 } 92 } 93 94 98 public void changeCountChanged (Component component, long changeCount) { 99 Iterator i = listeners.values().iterator(); 100 while (i.hasNext()) { 101 ConfigurationListener l = (ConfigurationListener)i.next(); 102 l.changeCountChanged(component, changeCount); 103 } 104 } 105 106 public void rootComponentChanged (final Component oldValue) { 107 Iterator i = listeners.values().iterator(); 108 while (i.hasNext()) { 109 ConfigurationListener l = (ConfigurationListener)i.next(); 110 l.rootComponentChanged(oldValue); 111 } 112 } 113 114 public void nameChanged (final Component component, final String oldValue) { 115 Iterator i = listeners.values().iterator(); 116 while (i.hasNext()) { 117 ConfigurationListener l = (ConfigurationListener)i.next(); 118 l.nameChanged(component, oldValue); 119 } 120 } 121 122 public void typeChanged (final Component component, final String oldValue) { 123 Iterator i = listeners.values().iterator(); 124 while (i.hasNext()) { 125 ConfigurationListener l = (ConfigurationListener)i.next(); 126 l.typeChanged(component, oldValue); 127 } 128 } 129 130 public void implementationChanged ( 131 final Component component, 132 final String oldValue) 133 { 134 Iterator i = listeners.values().iterator(); 135 while (i.hasNext()) { 136 ConfigurationListener l = (ConfigurationListener)i.next(); 137 l.implementationChanged(component, oldValue); 138 } 139 } 140 141 public void interfaceNameChanged (final Interface i, final String oldValue) { 142 Iterator j = listeners.values().iterator(); 143 while (j.hasNext()) { 144 ConfigurationListener l = (ConfigurationListener)j.next(); 145 l.interfaceNameChanged(i, oldValue); 146 } 147 } 148 149 public void interfaceSignatureChanged ( 150 final Interface i, 151 final String oldValue) 152 { 153 Iterator j = listeners.values().iterator(); 154 while (j.hasNext()) { 155 ConfigurationListener l = (ConfigurationListener)j.next(); 156 l.interfaceSignatureChanged(i, oldValue); 157 } 158 } 159 160 public void interfaceContingencyChanged ( 161 final Interface i, 162 final boolean oldValue) 163 { 164 Iterator j = listeners.values().iterator(); 165 while (j.hasNext()) { 166 ConfigurationListener l = (ConfigurationListener)j.next(); 167 l.interfaceContingencyChanged(i, oldValue); 168 } 169 } 170 171 public void interfaceCardinalityChanged ( 172 final Interface i, 173 final boolean oldValue) 174 { 175 Iterator j = listeners.values().iterator(); 176 while (j.hasNext()) { 177 ConfigurationListener l = (ConfigurationListener)j.next(); 178 l.interfaceCardinalityChanged(i, oldValue); 179 } 180 } 181 182 public void clientInterfaceAdded ( 183 final Component component, 184 final ClientInterface i, 185 final int index) 186 { 187 Iterator j = listeners.values().iterator(); 188 while (j.hasNext()) { 189 ConfigurationListener l = (ConfigurationListener)j.next(); 190 l.clientInterfaceAdded(component, i, index); 191 } 192 } 193 194 public void clientInterfaceRemoved ( 195 final Component component, 196 final ClientInterface i, 197 final int index) 198 { 199 Iterator j = listeners.values().iterator(); 200 while (j.hasNext()) { 201 ConfigurationListener l = (ConfigurationListener)j.next(); 202 l.clientInterfaceRemoved(component, i, index); 203 } 204 } 205 206 public void serverInterfaceAdded ( 207 final Component component, 208 final ServerInterface i, 209 final int index) 210 { 211 Iterator j = listeners.values().iterator(); 212 while (j.hasNext()) { 213 ConfigurationListener l = (ConfigurationListener)j.next(); 214 l.serverInterfaceAdded(component, i, index); 215 } 216 } 217 218 public void serverInterfaceRemoved ( 219 final Component component, 220 final ServerInterface i, 221 final int index) 222 { 223 Iterator j = listeners.values().iterator(); 224 while (j.hasNext()) { 225 ConfigurationListener l = (ConfigurationListener)j.next(); 226 l.serverInterfaceRemoved(component, i, index); 227 } 228 } 229 230 public void interfaceBound ( 231 final ClientInterface citf, final ServerInterface sitf) 232 { 233 Iterator i = listeners.values().iterator(); 234 while (i.hasNext()) { 235 ConfigurationListener l = (ConfigurationListener)i.next(); 236 l.interfaceBound(citf, sitf); 237 } 238 } 239 240 public void interfaceRebound ( 241 final ClientInterface citf, 242 final ServerInterface oldSitf) 243 { 244 Iterator i = listeners.values().iterator(); 245 while (i.hasNext()) { 246 ConfigurationListener l = (ConfigurationListener)i.next(); 247 l.interfaceRebound(citf, oldSitf); 248 } 249 } 250 251 public void interfaceUnbound ( 252 final ClientInterface citf, 253 final ServerInterface sitf) 254 { 255 Iterator i = listeners.values().iterator(); 256 while (i.hasNext()) { 257 ConfigurationListener l = (ConfigurationListener)i.next(); 258 l.interfaceUnbound(citf, sitf); 259 } 260 } 261 262 public void attributeControllerChanged ( 263 final Component component, 264 final String oldValue) 265 { 266 Iterator i = listeners.values().iterator(); 267 while (i.hasNext()) { 268 ConfigurationListener l = (ConfigurationListener)i.next(); 269 l.attributeControllerChanged(component, oldValue); 270 } 271 } 272 273 public void attributeChanged ( 274 final Component component, 275 final String attributeName, 276 final String oldValue) 277 { 278 Iterator i = listeners.values().iterator(); 279 while (i.hasNext()) { 280 ConfigurationListener l = (ConfigurationListener)i.next(); 281 l.attributeChanged(component, attributeName, oldValue); 282 } 283 } 284 285 public void templateControllerDescriptorChanged ( 286 final Component component, 287 final String oldValue) 288 { 289 Iterator i = listeners.values().iterator(); 290 while (i.hasNext()) { 291 ConfigurationListener l = (ConfigurationListener)i.next(); 292 l.templateControllerDescriptorChanged(component, oldValue); 293 } 294 } 295 296 public void componentControllerDescriptorChanged ( 297 final Component component, 298 final String oldValue) 299 { 300 Iterator i = listeners.values().iterator(); 301 while (i.hasNext()) { 302 ConfigurationListener l = (ConfigurationListener)i.next(); 303 l.componentControllerDescriptorChanged(component, oldValue); 304 } 305 } 306 307 public void subComponentAdded ( 308 final Component parent, 309 final Component child, 310 final int index) 311 { 312 Iterator i = listeners.values().iterator(); 313 while (i.hasNext()) { 314 ConfigurationListener l = (ConfigurationListener)i.next(); 315 l.subComponentAdded(parent, child, index); 316 } 317 } 318 319 public void subComponentRemoved ( 320 final Component parent, 321 final Component child, 322 final int index) 323 { 324 Iterator i = listeners.values().iterator(); 325 while (i.hasNext()) { 326 ConfigurationListener l = (ConfigurationListener)i.next(); 327 l.subComponentRemoved(parent, child, index); 328 } 329 } 330 } 331 | Popular Tags |