01: package vicazh.hyperpool;
02:
03: import java.awt.*;
04: import java.awt.event.*;
05: import java.util.*;
06: import java.util.List;
07: import javax.swing.*;
08: import javax.swing.tree.*;
09:
10: /**
11: * The windows listener
12: *
13: * @author Victor Zhigunov
14: * @version 0.4.0
15: */
16: public class IListener extends WindowAdapter {
17:
18: private Container container;
19:
20: private Component component;
21:
22: private String name;
23:
24: private Map<Object, Object> map;
25:
26: private JMenuItem menu;
27:
28: private List<Object> list;
29:
30: private JTree tree;
31:
32: /**
33: * @param container
34: * container
35: * @param component
36: * component
37: * @param name
38: * name
39: * @param map
40: * frames map
41: * @param menu
42: * close menu
43: * @param list
44: * ui list
45: * @param tree
46: * manager tree
47: */
48: public IListener(Container container, Component component,
49: String name, Map<Object, Object> map, JMenuItem menu,
50: List<Object> list, JTree tree) {
51: this .container = container;
52: this .component = component;
53: this .name = name;
54: this .map = map;
55: this .menu = menu;
56: this .list = list;
57: this .tree = tree;
58: }
59:
60: public void windowClosed(WindowEvent e) {
61: container.add(name, component);
62: Object o = map.remove(name);
63: if (map.size() == 0)
64: menu.setEnabled(false);
65: list.remove(o);
66: TreePath p = tree.getSelectionPath();
67: tree.setSelectionPath(null);
68: tree.setSelectionPath(p);
69: }
70: }
|