1 3 package org.objectweb.fractal.swing; 4 5 import org.objectweb.fractal.api.control.BindingController; 6 7 import java.util.HashMap ; 8 import java.util.Map ; 9 import java.awt.event.ActionListener ; 10 11 public class JButtonImpl 12 extends javax.swing.JButton 13 implements JButtonItf, JButtonAttributes, BindingController 14 { 15 16 public final static String ACTION_LISTENERS_BINDING = "action-listeners"; 18 private Map actionListeners = new HashMap (); 19 20 public JButtonImpl () { 21 super(); 22 } 23 public JButtonImpl (javax.swing.Icon arg0) { 24 super(arg0); 25 } 26 public JButtonImpl (String arg0) { 27 super(arg0); 28 } 29 public JButtonImpl (javax.swing.Action arg0) { 30 super(arg0); 31 } 32 public JButtonImpl (String arg0, javax.swing.Icon arg1) { 33 super(arg0,arg1); 34 } 35 36 public String [] listFc () { 37 int size = actionListeners.size(); 39 return (String [])actionListeners.keySet().toArray(new String [size]); 40 } 41 42 public Object lookupFc (String clientItfName) { 43 if (clientItfName.startsWith(ACTION_LISTENERS_BINDING)) { 45 return actionListeners.get(clientItfName); 46 } 47 return null; 48 } 49 50 public void bindFc (String clientItfName, Object serverItf) { 51 if (clientItfName.startsWith(ACTION_LISTENERS_BINDING)) { 53 actionListeners.put(clientItfName, serverItf); 54 super.addActionListener((java.awt.event.ActionListener )serverItf); 55 } 56 } 57 58 public void unbindFc (String clientItfName) { 59 if (clientItfName.startsWith(ACTION_LISTENERS_BINDING)) { 61 ActionListener a = (ActionListener )actionListeners.get(clientItfName); 62 super.removeActionListener(a); 63 } 64 } 65 66 } 67 | Popular Tags |