📄 bsmainframe.java
字号:
/* ====================================================================
*
* Skin Look And Feel License.
*
* Copyright (c) 2000-2002 L2FProd.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by L2FProd.com
* (http://www.L2FProd.com/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "Skin Look And Feel", "SkinLF" and "L2FProd.com" must not
* be used to endorse or promote products derived from this software
* without prior written permission. For written permission, please
* contact info@L2FProd.com.
*
* 5. Products derived from this software may not be called "SkinLF"
* nor may "SkinLF" appear in their names without prior written
* permission of L2FProd.com.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL L2FPROD.COM OR ITS CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*/
package edu.ou.kmi.buddyspace.gui;
/*
* BSMainFrame.java
*
* Project: BuddySpace
* (C) Copyright Knowledge Media Institute 2002
*
* Created on 24 June 2002, 18:30
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.util.*;
//import java.util.prefs.*;
import java.io.*;
import javax.swing.text.*;
import com.l2fprod.gui.plaf.skin.Skin;
import com.l2fprod.gui.plaf.skin.CompoundSkin;
import com.l2fprod.gui.plaf.skin.SkinLookAndFeel;
import org.jabber.jabberbeans.*;
import org.jabber.jabberbeans.util.*;
import org.jabber.jabberbeans.Extension.*;
import edu.ou.kmi.buddyspace.gui.systemtray.*;
import edu.ou.kmi.buddyspace.core.*;
import edu.ou.kmi.buddyspace.plugins.*;
import edu.ou.kmi.buddyspace.utils.*;
import edu.ou.kmi.buddyspace.xml.*;
/**
* <code>BSMainFrame</code> is the main window of BuddySpace.
* It provides basic user interface and plug-ins support.
* It uses <code>BSCore</code> to handle basic jabber functionality.
* The plug-ins can use it for both (i) connect to <code>BSCore</code> and
* that way communicate through jabber protocol and (ii) display their output.
*
* @author Jiri Komzak, Knowledge Media Institute, Open University, United Kingdom
*/
public class BSMainFrame extends JFrame
implements ActionListener, ItemListener,
ConnectionListener,
BSIQListener, RosterListener,
BSPresenceListener, BSMessageListener,
BSLoginListener, BSRegListener {
/** menu variables*/
private JMenuBar mainMenuBar;
private JMenu mainMenu;
private JMenu jabberMenu;
private JMenuItem connectMenuItem;
private JMenuItem disconnectMenuItem;
private JMenuItem chatMenuItem;
private JMenuItem messageMenuItem;
private JMenuItem prefsMenuItem;
private JMenuItem exitMenuItem;
private JMenu presenceMenu;
private JMenuItem onlinePresenceMenuItem;
private JMenuItem chatPresenceMenuItem;
private JMenuItem elsePresenceMenuItem;
private JMenuItem busyPresenceMenuItem;
private JMenuItem awayPresenceMenuItem;
private JMenuItem xaPresenceMenuItem;
private JMenuItem dndPresenceMenuItem;
private JMenuItem customPresenceMenuItem;
private JMenu rosterMenu;
private JMenuItem addContactMenuItem;
private JMenuItem changeContactMenuItem;
private JMenuItem deleteContactMenuItem;
private JMenuItem refreshRosterMenuItem;
private JMenu pluginsMenu;
private JCheckBoxMenuItem onlyOnlineMenuItem;
private JCheckBoxMenuItem autoPopupMenuItem;
private JCheckBoxMenuItem scrollTabsMenuItem;
private JCheckBoxMenuItem dockWindowsMenuItem;
private JCheckBoxMenuItem compactViewMenuItem;
private JCheckBoxMenuItem showMsgsMenuItem;
private JCheckBoxMenuItem forceMsgsIntoChatMenuItem;
private JCheckBoxMenuItem showDebugMenuItem;
private JCheckBoxMenuItem showStatusMenuItem;
private JMenu lookAndFeelMenu;
private JMenu bookmarkMenu = null;
private JMenu helpMenu;
private JMenuItem updatesMenuItem;
private JMenuItem aboutMenuItem;
/** tool bar */
JToolBar toolBar;
private JToggleButton connectButton;
private JToggleButton expandGroupsButton;
private JButton addContactButton;
private JButton delContactButton;
private JToggleButton onlyOnlineButton;
private JComboBox showComboBox;
private JToggleButton compactButton;
/** main tabbedPane */
public static JTabbedPane mainTabbedPane;
/** main tab variables */
protected JPanel mainPanel;
//protected JPanel rightPanel;
//private JCheckBox scrollTabsCheckBox;
//private JPanel buttonsPanel;
//private JButton rosterButton;
public static String[] presenceStrs = {"Online",
"Free for chat",
"Low attention, busy",
"Online but elsewhere",
"Away",
"Extended away",
"Do not disturb",
"Custom",
"Offline"};
/** presence show displaying constants */
public static String SHOW_ONLINE_STR = BSPresenceInfo.FRIENDLY_SHOW_ONLINE;
public static String SHOW_CHAT_STR = BSPresenceInfo.FRIENDLY_SHOW_CHAT;
public static String SHOW_AWAY_STR = BSPresenceInfo.FRIENDLY_SHOW_AWAY;
public static String SHOW_XA_STR = BSPresenceInfo.FRIENDLY_SHOW_XA;
public static String SHOW_DND_STR = BSPresenceInfo.FRIENDLY_SHOW_DND;
public static String SHOW_OFFLINE_STR = BSPresenceInfo.FRIENDLY_SHOW_OFFLINE;
public static String STATUS_BUSY_STR = "Low attention, busy";
public static String STATUS_ELSE_STR = "Physically elsewhere";
/** default values */
public final static String VERSION = "BuddySpace2.8";
public final static String DEF_RESOURCE = "BuddySpace2.8";
public final static int DEF_PROFILE_NUM = 1;
public final static String DEF_USERNAME = "";
public final static String DEF_SERVER = "";
public final static int DEF_PORT = 5222;
public final static int DEF_PRIORITY = 0;
public final static String DEF_PASSWORD = "";
public final static boolean DEF_USE_SSL = false;
public final static String DEF_PROXY = "";
public final static String DEF_PROXY_PORT = "80";
public final static String DEF_FILE_SERVER = "";
public final static String DEF_FILE_SERVER_PATH = "/upload";
public final static String DEF_FILE_SERVER_PORT = "80";
//public final static String DEF_IX_PROPS_PATH = "D:/I-X-Jabber/I-X/apps/coakting/config/ime-jabber.props";
public final static String DEF_LOGO_IMG_PATH = "./logos/kmi_logo_big.gif";
public final static String DEF_NEW_MSG_SOUND_FILE_NAME = "./sounds/notify.wav";
Properties properties = new Properties();
/** preferences records names */
public static final String PREF_NAME_PROFILE_NUM = "profileNum";
public static final String PREF_NAME_USERNAME = "username";
public static final String PREF_NAME_RESOURCE = "resource";
public static final String PREF_NAME_SERVER = "server";
public static final String PREF_NAME_PORT = "port";
public static final String PREF_NAME_AUTO_LOGIN = "autoLogin";
public static final String PREF_NAME_PASSWORD = "password";
public static final String PREF_NAME_PRIORITY = "priority";
public static final String PREF_NAME_USE_SSL = "useSSL";
public static final String PREF_NAME_FILE_SERVER = "fileServer";
public static final String PREF_NAME_FILE_SERVER_PATH = "fileServerPath";
public static final String PREF_NAME_FILE_SERVER_PORT = "fileServerPort";
public static final String PREF_NAME_PROXY = "proxy";
public static final String PREF_NAME_PROXY_PORT = "proxyPort";
public static final String PREF_NAME_COMPACT_VIEW = "compactView";
public static final String PREF_NAME_ONLY_ONLINE = "onlyOnline";
public static final String PREF_NAME_DOCK_WINDOWS = "dockWindows";
public static final String PREF_NAME_SHOW_MSGS = "showMsgs";
public static final String PREF_NAME_FORCE_MSGS_INTO_CHAT = "forceMsgsIntoChat";
public static final String PREF_NAME_AUTO_AWAY = "autoAway";
public static final String PREF_NAME_SHOW_STATUS = "showStatus";
public static final String PREF_NAME_SHOW_DEBUG = "showDebug";
public static final String PREF_NAME_SCROLL_TABS = "scrollTabs";
public static final String PREF_NAME_PLUGIN_BUDDYFINDER = "pluginBuddyFinder";
public static final String PREF_NAME_PLUGIN_SIMLINK = "pluginSimLink";
public static final String PREF_NAME_FLASHMEETING_BOT_JID = "flashMeetingBotJID";
public static final String PREF_NAME_BUDDYFINDER_BOT_JID = "buddyFinderBotJID";
public static final String PREF_NAME_SIMLINK_BOT_JID = "simLinkBotJID";
public static final String PREF_NAME_AUTO_SELECT = "autoSelect";
public static final String PREF_NAME_NEW_MSG_SOUND_FILE_NAME = "newMsgSoundFile";
public static final String PREF_NAME_LAF = "LAF";
//public static final String PREF_NAME_LOGO_IMG_PATH = "logoImgPath";
//public static final String PREF_NAME_IX_PROPS_PATH = "ixPropsPath";
public static final String PREF_NAME_STATUSES_BAR_JID_NUM = "statusesBarJidNum";
public static final String PREF_NAME_STATUSES_BAR_JID = "statusesBarJid";
/** preferences variables */
public static String username = new String(DEF_USERNAME);
public static String resource = DEF_RESOURCE;
public static String password = DEF_PASSWORD;
public static String server = DEF_SERVER;
public static int port = DEF_PORT;
public static boolean useSSL = DEF_USE_SSL;
public static int priority = DEF_PRIORITY;
public static String fileServer = DEF_FILE_SERVER;
public static String fileServerPath = DEF_FILE_SERVER_PATH;
public static String fileServerPort = DEF_FILE_SERVER_PORT;
public static String proxy = DEF_PROXY;
public static String proxyPort = DEF_PROXY_PORT;
//public static String ixPropsPath = DEF_IX_PROPS_PATH;
public static String logoImgPath = DEF_LOGO_IMG_PATH;
public static String newMsgSoundFileName = DEF_NEW_MSG_SOUND_FILE_NAME;
private BSCore core = null;
private BSRosterBean rosterBean = null;
private BSPresenceBean presenceBean = null;
private BSMessengerBean messengerBean = null;
private BSInfoQueryBean infoQueryBean = null;
private BSRegisterBean regBean = null;
private BSServedIDs servedIDs = new BSServedIDs();
private BSPluginLoader plugins = null;
private boolean newAccount = false;
private boolean autoLogin = false;
private boolean ouLoginRegHack = false;
private BSRosterTreeView rosterTree = null;
private BSMsgWinManager msgWinMan = null;
private BSChatWinManager chatWinMan = null;
private JLabel logoIconLabel;
private BSStatusesBar statusesBar = null;
private BSLoginProgressDlg loginProgressDlg = null;
public static String NO_GROUP_NAME = "No group";
private boolean autoSelectChat = true;
private boolean onlyOnline = true;
private boolean showStatus = false;
private boolean showDebug = false;
private boolean showMsgs = false;
private boolean forceMsgsIntoChat = false;
private boolean autoAway = true;
private boolean scrollTabs = false;
private boolean compactView = true;
private boolean dockWindows = false;
private boolean expandGroups = true;
public boolean pluginBuddyFinder = true; // accessed from BSMapWindow
public boolean pluginSimLink = false; // accessed from BSConfWindow
public static String buddyFinderBotJID = "buddyfinder@msg.open.ac.uk";
public static String simLinkBotJID = "simlink@msg.open.ac.uk";
public static String flashMeetingBotJID = "multibot@msg.open.ac.uk";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -