1 23 24 package org.objectweb.fractal.gui.graph.view; 25 26 import org.objectweb.fractal.api.control.BindingController; 27 28 import java.util.HashMap ; 29 import java.util.Map ; 30 import java.util.Iterator ; 31 import java.awt.event.MouseEvent ; 32 33 36 37 public class GraphViewNotifier implements 38 GraphViewListener, 39 BindingController 40 { 41 42 46 47 public final static String GRAPH_VIEW_LISTENERS_BINDING = 48 "graph-view-listeners"; 49 50 53 54 private Map graphViewListeners; 55 56 59 60 public GraphViewNotifier () { 61 graphViewListeners = new HashMap (); 62 } 63 64 68 public String [] listFc () { 69 return (String [])graphViewListeners.keySet().toArray( 70 new String [graphViewListeners.size()]); 71 } 72 73 public Object lookupFc (final String clientItfName) { 74 if (clientItfName.startsWith(GRAPH_VIEW_LISTENERS_BINDING)) { 75 return graphViewListeners.get(clientItfName); 76 } 77 return null; 78 } 79 80 public void bindFc ( 81 final String clientItfName, 82 final Object serverItf) 83 { 84 if (clientItfName.startsWith(GRAPH_VIEW_LISTENERS_BINDING)) { 85 graphViewListeners.put(clientItfName, serverItf); 86 } 87 } 88 89 public void unbindFc (final String clientItfName) { 90 if (clientItfName.startsWith(GRAPH_VIEW_LISTENERS_BINDING)) { 91 graphViewListeners.remove(clientItfName); 92 } 93 } 94 95 99 public void viewChanged () { 100 Iterator i = graphViewListeners.values().iterator(); 101 while (i.hasNext()) { 102 ((GraphViewListener)i.next()).viewChanged(); 103 } 104 } 105 106 public void mousePressed (final MouseEvent e, final ComponentPart p) { 107 Iterator i = graphViewListeners.values().iterator(); 108 while (i.hasNext()) { 109 ((GraphViewListener)i.next()).mousePressed(e, p); 110 } 111 } 112 113 public void mouseReleased (final MouseEvent e, final ComponentPart p) { 114 Iterator i = graphViewListeners.values().iterator(); 115 while (i.hasNext()) { 116 ((GraphViewListener)i.next()).mouseReleased(e, p); 117 } 118 } 119 120 public void mouseClicked (final MouseEvent e, final ComponentPart p) { 121 Iterator i = graphViewListeners.values().iterator(); 122 while (i.hasNext()) { 123 ((GraphViewListener)i.next()).mouseClicked(e, p); 124 } 125 } 126 127 public void mouseEntered (final MouseEvent e) { 128 Iterator i = graphViewListeners.values().iterator(); 129 while (i.hasNext()) { 130 ((GraphViewListener)i.next()).mouseEntered(e); 131 } 132 } 133 134 public void mouseExited (final MouseEvent e) { 135 Iterator i = graphViewListeners.values().iterator(); 136 while (i.hasNext()) { 137 ((GraphViewListener)i.next()).mouseExited(e); 138 } 139 } 140 141 public void mouseDragged (final MouseEvent e) { 142 Iterator i = graphViewListeners.values().iterator(); 143 while (i.hasNext()) { 144 ((GraphViewListener)i.next()).mouseDragged(e); 145 } 146 } 147 148 public void mouseMoved (final MouseEvent e, final ComponentPart p) { 149 Iterator i = graphViewListeners.values().iterator(); 150 while (i.hasNext()) { 151 ((GraphViewListener)i.next()).mouseMoved(e, p); 152 } 153 } 154 } 155 | Popular Tags |