KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > core > gui > frame > FrameMediatorDockable


1 // The contents of this file are subject to the Mozilla Public License Version
2
// 1.1
3
//(the "License"); you may not use this file except in compliance with the
4
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
5
//
6
//Software distributed under the License is distributed on an "AS IS" basis,
7
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8
//for the specific language governing rights and
9
//limitations under the License.
10
//
11
//The Original Code is "The Columba Project"
12
//
13
//The Initial Developers of the Original Code are Frederik Dietz and Timo
14
// Stich.
15
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
16
//
17
//All Rights Reserved.
18
package org.columba.core.gui.frame;
19
20 import javax.swing.JComponent JavaDoc;
21 import javax.swing.JPopupMenu JavaDoc;
22
23 import org.columba.api.gui.frame.IDockable;
24 import org.columba.core.gui.docking.DockableView;
25
26 public class FrameMediatorDockable implements IDockable {
27
28     private String JavaDoc id;
29
30     private String JavaDoc name;
31
32     private DockableView comp;
33
34     private JPopupMenu JavaDoc popup;
35
36     public FrameMediatorDockable(String JavaDoc id, String JavaDoc name, JComponent JavaDoc comp,
37             JPopupMenu JavaDoc popup) {
38         if (id == null)
39             throw new IllegalArgumentException JavaDoc("id == null");
40         if (name == null)
41             throw new IllegalArgumentException JavaDoc("name == null");
42         if (comp == null)
43             throw new IllegalArgumentException JavaDoc("comp == null");
44
45         this.id = id;
46         this.name = name;
47         this.comp = new DockableView(id, name);
48         this.comp.setContentPane(comp);
49
50         if (popup != null) {
51             this.popup = popup;
52             this.comp.setPopupMenu(this.popup);
53         }
54     }
55
56     public String JavaDoc getId() {
57         return id;
58     }
59
60     public String JavaDoc resolveName() {
61         return name;
62     }
63
64     public JComponent JavaDoc getView() {
65         return (JComponent JavaDoc) comp.getComponent();
66     }
67
68     public JPopupMenu JavaDoc getPopupMenu() {
69         return popup;
70     }
71
72     public void setPopupMenu(JPopupMenu JavaDoc popup) {
73         if (popup == null)
74             throw new IllegalArgumentException JavaDoc("popup == null");
75
76         this.popup = popup;
77         
78         this.comp.setPopupMenu(this.popup);
79     }
80
81     public void setTitle(String JavaDoc title) {
82         comp.setTitle(title);
83     }
84
85 }
86
Popular Tags