KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > chat > ui > frame > AlturaFrameController


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.chat.ui.frame;
19
20 import java.awt.BorderLayout JavaDoc;
21 import java.io.InputStream JavaDoc;
22
23 import javax.swing.BorderFactory JavaDoc;
24 import javax.swing.JPanel JavaDoc;
25 import javax.swing.JScrollPane JavaDoc;
26
27 import org.columba.api.gui.frame.IContainer;
28 import org.columba.api.gui.frame.IDock;
29 import org.columba.api.gui.frame.IDockable;
30 import org.columba.chat.resourceloader.ResourceLoader;
31 import org.columba.chat.ui.conversation.ConversationController;
32 import org.columba.chat.ui.conversation.api.IConversationController;
33 import org.columba.chat.ui.frame.api.IChatFrameMediator;
34 import org.columba.chat.ui.presence.PresenceComboBox;
35 import org.columba.chat.ui.presence.api.IPresenceController;
36 import org.columba.chat.ui.roaster.RoasterTree;
37 import org.columba.chat.ui.roaster.api.IRoasterController;
38 import org.columba.core.config.ViewItem;
39 import org.columba.core.gui.frame.DockFrameController;
40
41 /**
42  * @author fdietz
43  *
44  */

45 public class AlturaFrameController extends DockFrameController implements
46         IChatFrameMediator {
47
48     private RoasterTree tree;
49
50     private PresenceComboBox presence;
51
52     private ConversationController conversation;
53
54     private IDockable treePanel;
55
56     private IDockable conversationPanel;
57
58     /**
59      * @param c
60      * @param viewItem
61      */

62     public AlturaFrameController(ViewItem viewItem) {
63         super(viewItem);
64
65         tree = new RoasterTree(this);
66         presence = new PresenceComboBox(this);
67         conversation = new ConversationController();
68
69         registerDockables();
70
71         // connect to server
72
// new ConnectAction(this).actionPerformed(null);
73

74     }
75
76     private void registerDockables() {
77
78         JPanel JavaDoc leftPanel = new JPanel JavaDoc();
79         leftPanel.setLayout(new BorderLayout JavaDoc());
80
81         JScrollPane JavaDoc treeScrollPane = new JScrollPane JavaDoc(tree);
82         treeScrollPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
83         leftPanel.add(treeScrollPane, BorderLayout.CENTER);
84         leftPanel.add(presence, BorderLayout.NORTH);
85
86         treePanel = registerDockable("roaster_tree", ResourceLoader.getString(
87                 "global", "dockable_roaster"), leftPanel, null);
88
89         conversationPanel = registerDockable("conversation_view",
90                 ResourceLoader.getString("global", "dockable_conversation"),
91                 conversation, null);
92
93     }
94
95     /**
96      * @see org.columba.core.gui.frame.DockFrameController#loadDefaultPosition()
97      */

98     public void loadDefaultPosition() {
99
100         super.dock(conversationPanel, IDock.REGION.CENTER);
101
102         super.dock(treePanel, conversationPanel, IDock.REGION.WEST, 0.3f);
103
104         super.setSplitProportion(conversationPanel, 0.35f);
105     }
106
107     /**
108      * @see org.columba.chat.ui.frame.api.IChatFrameMediator#getRoasterTree()
109      */

110     public IRoasterController getRoasterTree() {
111         return tree;
112     }
113
114     /**
115      * @see org.columba.chat.ui.frame.api.IChatFrameMediator#getPresenceController()
116      */

117     public IPresenceController getPresenceController() {
118         return presence;
119     }
120
121     /**
122      * @see org.columba.chat.ui.frame.api.IChatFrameMediator#getConversationController()
123      */

124     public IConversationController getConversationController() {
125         return conversation;
126     }
127
128     /** *********************** container callbacks ************* */
129
130     public void extendMenu(IContainer container) {
131
132         InputStream JavaDoc is = this.getClass().getResourceAsStream(
133                 "/org/columba/chat/action/menu.xml");
134         container.extendMenu(this, is);
135
136     }
137
138     public void extendToolBar(IContainer container) {
139
140         InputStream JavaDoc is2 = this.getClass().getResourceAsStream(
141                 "/org/columba/chat/action/toolbar.xml");
142         container.extendToolbar(this, is2);
143
144     }
145
146     /**
147      * @see org.columba.core.gui.frame.DefaultFrameController#getString(java.lang.String, java.lang.String, java.lang.String)
148      */

149     @Override JavaDoc
150     public String JavaDoc getString(String JavaDoc sPath, String JavaDoc sName, String JavaDoc sID) {
151         return ResourceLoader.getString(sPath, sID);
152     }
153
154 }
Popular Tags