KickJava   Java API By Example, From Geeks To Geeks.

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


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.TreeMap JavaDoc;
9 import java.util.Iterator JavaDoc;
10
11 import javax.swing.JMenu JavaDoc;
12
13 public class JMenuBarImpl
14   extends javax.swing.JMenuBar JavaDoc
15   implements JMenuBarItf, JMenuBarAttributes, BindingController
16 {
17
18   // fields manually added
19
private final static String JavaDoc MENUS_BINDING = "menus";
20   private final Map JavaDoc menus = new TreeMap JavaDoc();
21
22   public JMenuBarImpl () {
23     super();
24   }
25
26   public String JavaDoc[] listFc () {
27     // put your own code here
28
return (String JavaDoc[])menus.keySet().toArray(new String JavaDoc[menus.size()]);
29   }
30
31   public Object JavaDoc lookupFc (String JavaDoc clientItfName) {
32     // put your own code here
33
if (clientItfName.startsWith(MENUS_BINDING)) {
34       return menus.get(clientItfName);
35     }
36     return null;
37   }
38
39   public void bindFc (String JavaDoc clientItfName, Object JavaDoc serverItf) {
40     // put your own code here
41
if (clientItfName.startsWith(MENUS_BINDING)) {
42       menus.put(clientItfName, serverItf);
43       Iterator JavaDoc i = menus.values().iterator();
44       while (i.hasNext()) {
45         super.remove((JMenu JavaDoc)i.next());
46       }
47       i = menus.values().iterator();
48       while (i.hasNext()) {
49         super.add((JMenu JavaDoc)i.next());
50       }
51     }
52   }
53
54   public void unbindFc (String JavaDoc clientItfName) {
55     // put your own code here
56
if (clientItfName.startsWith(MENUS_BINDING)) {
57       Object JavaDoc serverItf = menus.remove(clientItfName);
58       super.remove((JMenu JavaDoc)serverItf);
59     }
60   }
61
62 }
63
Popular Tags