KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > fractal > swing > JToolBarImpl


1 // skeleton class automatically generated
2

3 package org.objectweb.fractal.swing;
4
5 import org.objectweb.fractal.api.control.BindingController;
6
7 import java.util.Map JavaDoc;
8 import java.util.HashMap JavaDoc;
9 import java.util.TreeMap JavaDoc;
10 import java.util.Iterator JavaDoc;
11
12 import javax.swing.Action JavaDoc;
13 import javax.swing.JComponent JavaDoc;
14
15 public class JToolBarImpl
16   extends javax.swing.JToolBar JavaDoc
17   implements JToolBarItf, JToolBarAttributes, BindingController
18 {
19
20   // fields manually added
21
public final static String JavaDoc ACTIONS_BINDING = "actions";
22   private Map JavaDoc actions = new TreeMap JavaDoc();
23   private Map JavaDoc components = new HashMap JavaDoc();
24
25   public JToolBarImpl () {
26     super();
27   }
28   public JToolBarImpl (int arg0) {
29     super(arg0);
30   }
31   public JToolBarImpl (String JavaDoc arg0) {
32     super(arg0);
33   }
34   public JToolBarImpl (String JavaDoc arg0, int arg1) {
35     super(arg0,arg1);
36   }
37
38   public String JavaDoc[] listFc () {
39     return (String JavaDoc[])actions.keySet().toArray(new String JavaDoc[actions.size()]);
40   }
41
42   public Object JavaDoc lookupFc (String JavaDoc clientItfName) {
43     // put your own code here
44
if (clientItfName.startsWith(ACTIONS_BINDING)) {
45       return actions.get(clientItfName);
46     }
47     return null;
48   }
49
50   public void bindFc (String JavaDoc clientItfName, Object JavaDoc serverItf) {
51     // put your own code here
52
if (clientItfName.startsWith(ACTIONS_BINDING)) {
53       removeAll();
54       actions.put(clientItfName, serverItf);
55       Iterator JavaDoc i = actions.entrySet().iterator();
56       while (i.hasNext()) {
57         Map.Entry JavaDoc e = (Map.Entry JavaDoc)i.next();
58         Object JavaDoc o = e.getValue();
59         if (o instanceof JSeparatorItf) {
60           addSeparator();
61         } else if (o instanceof JComponent JavaDoc) {
62           add((JComponent JavaDoc)o);
63         } else {
64           add((Action JavaDoc)o);
65         }
66         components.put((String JavaDoc)e.getKey(), getComponent(getComponentCount()-1));
67       }
68     }
69   }
70
71   public void unbindFc (String JavaDoc clientItfName) {
72     // put your own code here
73
if (clientItfName.startsWith(ACTIONS_BINDING)) {
74       actions.remove(clientItfName);
75       remove((java.awt.Component JavaDoc)components.remove(clientItfName));
76     }
77   }
78
79 }
80
Popular Tags