1 3 package org.objectweb.fractal.swing; 4 5 import org.objectweb.fractal.api.control.BindingController; 6 7 import java.util.Map ; 8 import java.util.TreeMap ; 9 import java.util.Iterator ; 10 11 import javax.swing.JComponent ; 12 13 public class JTabbedPaneImpl 14 extends javax.swing.JTabbedPane 15 implements JTabbedPaneItf, JTabbedPaneAttributes, BindingController 16 { 17 18 public final static String TABS_BINDING = "tabs"; 20 private Map tabs = new TreeMap (); 21 22 public JTabbedPaneImpl () { 23 super(); 24 } 25 public JTabbedPaneImpl (int arg0) { 26 super(arg0); 27 } 28 29 public String [] listFc () { 30 return (String [])tabs.keySet().toArray(new String [tabs.size()]); 32 } 33 34 public Object lookupFc (String clientItfName) { 35 if (clientItfName.startsWith(TABS_BINDING)) { 37 return tabs.get(clientItfName); 38 } 39 return null; 40 } 41 42 public void bindFc (String clientItfName, Object serverItf) { 43 if (clientItfName.startsWith(TABS_BINDING)) { 45 tabs.put(clientItfName, serverItf); 46 Iterator i = tabs.entrySet().iterator(); 47 while (i.hasNext()) { 48 Map.Entry e = (Map.Entry )i.next(); 49 remove((java.awt.Component )e.getValue()); 50 } 51 i = tabs.entrySet().iterator(); 52 while (i.hasNext()) { 53 Map.Entry e = (Map.Entry )i.next(); 54 JComponent comp = (JComponent )e.getValue(); 55 addTab(comp.getName(), comp); 56 } 57 } 58 } 59 60 public void unbindFc (String clientItfName) { 61 if (clientItfName.startsWith(TABS_BINDING)) { 63 Object tab = tabs.remove(clientItfName); 64 remove((java.awt.Component )tab); 65 } 66 } 67 68 } 69 | Popular Tags |