1 23 24 package org.objectweb.fractal.gui.selection.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 35 36 public class SelectionNotifier implements 37 SelectionListener, 38 BindingController 39 { 40 41 45 46 public final static String SELECTION_LISTENERS_BINDING = 47 "selection-listeners"; 48 49 52 53 private Map selectionListeners; 54 55 58 59 public SelectionNotifier () { 60 selectionListeners = new HashMap (); 61 } 62 63 67 public String [] listFc () { 68 return (String [])selectionListeners.keySet().toArray( 69 new String [selectionListeners.size()]); 70 } 71 72 public Object lookupFc (final String clientItfName) { 73 if (clientItfName.startsWith(SELECTION_LISTENERS_BINDING)) { 74 return selectionListeners.get(clientItfName); 75 } 76 return null; 77 } 78 79 80 public void bindFc ( 81 final String clientItfName, 82 final Object serverItf) 83 { 84 if (clientItfName.startsWith(SELECTION_LISTENERS_BINDING)) { 85 selectionListeners.put(clientItfName, serverItf); 86 } 87 } 88 89 90 public void unbindFc (final String clientItfName) { 91 if (clientItfName.startsWith(SELECTION_LISTENERS_BINDING)) { 92 selectionListeners.remove(clientItfName); 93 } 94 } 95 96 100 public void selectionChanged () { 101 Iterator i = selectionListeners.values().iterator(); 102 while (i.hasNext()) { 103 ((SelectionListener)i.next()).selectionChanged(); 104 } 105 } 106 } 107 | Popular Tags |