001: // The contents of this file are subject to the Mozilla Public License Version
002: // 1.1
003: //(the "License"); you may not use this file except in compliance with the
004: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
005: //
006: //Software distributed under the License is distributed on an "AS IS" basis,
007: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
008: //for the specific language governing rights and
009: //limitations under the License.
010: //
011: //The Original Code is "The Columba Project"
012: //
013: //The Initial Developers of the Original Code are Frederik Dietz and Timo
014: // Stich.
015: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
016: //
017: //All Rights Reserved.
018: package org.columba.chat.ui.frame;
019:
020: import java.awt.BorderLayout;
021: import java.io.InputStream;
022:
023: import javax.swing.BorderFactory;
024: import javax.swing.JPanel;
025: import javax.swing.JScrollPane;
026:
027: import org.columba.api.gui.frame.IContainer;
028: import org.columba.api.gui.frame.IDock;
029: import org.columba.api.gui.frame.IDockable;
030: import org.columba.chat.resourceloader.ResourceLoader;
031: import org.columba.chat.ui.conversation.ConversationController;
032: import org.columba.chat.ui.conversation.api.IConversationController;
033: import org.columba.chat.ui.frame.api.IChatFrameMediator;
034: import org.columba.chat.ui.presence.PresenceComboBox;
035: import org.columba.chat.ui.presence.api.IPresenceController;
036: import org.columba.chat.ui.roaster.RoasterTree;
037: import org.columba.chat.ui.roaster.api.IRoasterController;
038: import org.columba.core.config.ViewItem;
039: import org.columba.core.gui.frame.DockFrameController;
040:
041: /**
042: * @author fdietz
043: *
044: */
045: public class AlturaFrameController extends DockFrameController
046: implements IChatFrameMediator {
047:
048: private RoasterTree tree;
049:
050: private PresenceComboBox presence;
051:
052: private ConversationController conversation;
053:
054: private IDockable treePanel;
055:
056: private IDockable conversationPanel;
057:
058: /**
059: * @param c
060: * @param viewItem
061: */
062: public AlturaFrameController(ViewItem viewItem) {
063: super (viewItem);
064:
065: tree = new RoasterTree(this );
066: presence = new PresenceComboBox(this );
067: conversation = new ConversationController();
068:
069: registerDockables();
070:
071: // connect to server
072: // new ConnectAction(this).actionPerformed(null);
073:
074: }
075:
076: private void registerDockables() {
077:
078: JPanel leftPanel = new JPanel();
079: leftPanel.setLayout(new BorderLayout());
080:
081: JScrollPane treeScrollPane = new JScrollPane(tree);
082: treeScrollPane.setBorder(BorderFactory.createEmptyBorder(0, 0,
083: 0, 0));
084: leftPanel.add(treeScrollPane, BorderLayout.CENTER);
085: leftPanel.add(presence, BorderLayout.NORTH);
086:
087: treePanel = registerDockable("roaster_tree", ResourceLoader
088: .getString("global", "dockable_roaster"), leftPanel,
089: null);
090:
091: conversationPanel = registerDockable("conversation_view",
092: ResourceLoader.getString("global",
093: "dockable_conversation"), conversation, null);
094:
095: }
096:
097: /**
098: * @see org.columba.core.gui.frame.DockFrameController#loadDefaultPosition()
099: */
100: public void loadDefaultPosition() {
101:
102: super .dock(conversationPanel, IDock.REGION.CENTER);
103:
104: super .dock(treePanel, conversationPanel, IDock.REGION.WEST,
105: 0.3f);
106:
107: super .setSplitProportion(conversationPanel, 0.35f);
108: }
109:
110: /**
111: * @see org.columba.chat.ui.frame.api.IChatFrameMediator#getRoasterTree()
112: */
113: public IRoasterController getRoasterTree() {
114: return tree;
115: }
116:
117: /**
118: * @see org.columba.chat.ui.frame.api.IChatFrameMediator#getPresenceController()
119: */
120: public IPresenceController getPresenceController() {
121: return presence;
122: }
123:
124: /**
125: * @see org.columba.chat.ui.frame.api.IChatFrameMediator#getConversationController()
126: */
127: public IConversationController getConversationController() {
128: return conversation;
129: }
130:
131: /** *********************** container callbacks ************* */
132:
133: public void extendMenu(IContainer container) {
134:
135: InputStream is = this .getClass().getResourceAsStream(
136: "/org/columba/chat/action/menu.xml");
137: container.extendMenu(this , is);
138:
139: }
140:
141: public void extendToolBar(IContainer container) {
142:
143: InputStream is2 = this .getClass().getResourceAsStream(
144: "/org/columba/chat/action/toolbar.xml");
145: container.extendToolbar(this , is2);
146:
147: }
148:
149: /**
150: * @see org.columba.core.gui.frame.DefaultFrameController#getString(java.lang.String, java.lang.String, java.lang.String)
151: */
152: @Override
153: public String getString(String sPath, String sName, String sID) {
154: return ResourceLoader.getString(sPath, sID);
155: }
156:
157: }
|