⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bssimlinkplugin.java

📁 一款即时通讯软件
💻 JAVA
字号:
package edu.ou.kmi.buddyspace.plugins.simlink;

/*
 * BSBuddyFinderPlugin.java
 *
 * Project: BuddySpace
 * (C) Copyright Knowledge Media Institute 2002
 *
 *
 * Created on 12 May 2005
 */

import java.util.*;
import javax.swing.*;
import java.awt.event.*;

import org.jabber.jabberbeans.*;
import org.jabber.jabberbeans.util.*;
import org.jabber.jabberbeans.Extension.*;

import edu.ou.kmi.buddyspace.core.*;
import edu.ou.kmi.buddyspace.gui.*;

import edu.ou.kmi.buddyspace.plugins.*;
import edu.ou.kmi.buddyspace.plugins.simlink.core.*;
import edu.ou.kmi.buddyspace.plugins.simlink.gui.*;

/**
 * <code>BSSimLinkPlugin</code> is the main class of the SimLink
 * plugin to BuddySpace.
 * It provides methods for plugin loading and user interaction.
 *
 * @author  Chris Denham, Knowledge Media Institute, Open University, United Kingdom
 */
public class BSSimLinkPlugin extends BSPlugin implements ActionListener {

    private BSSimLinkBean simLinkBean;
    private BSSimLinkWinManager simLinkWinMan;
    private JMenuItem simLinkMenuItem;

    /** Constructor */
    public BSSimLinkPlugin(BSMainFrame mainFrame, JTabbedPane tabbedPane, BSCore core) {
        super(mainFrame, tabbedPane, core);
    }

    /** Inits the plugin core */
    protected void initCore() {
    }

    /** Inits plugin GUI */
    protected void initGUI() {
        simLinkBean = new BSSimLinkBean();
        simLinkWinMan = new BSSimLinkWinManager(mainFrame, tabbedPane, simLinkBean);
    }

    /** Adds GUI controls into main window */
    protected void addGUIControls() {
        simLinkMenuItem = new JMenuItem("SimLink Plugins");
        simLinkMenuItem.addActionListener(this);
        simLinkMenuItem.setEnabled(false);
        mainFrame.addPluginJabberMenuItem(simLinkMenuItem);
    }

    /** Connects BuddySpace beans */
    protected void connectBeans() {
        if (core != null) {
            BSMessengerBean msgBean = core.getMessengerBean();
            if (msgBean != null)
                 simLinkBean.setMessengerBean(msgBean.getMessengerBean());
        }
    }

    /** Handles connection change to connected */
    public void connected() {
        super.connected();

        simLinkMenuItem.setEnabled(true);

        BSMessengerBean msgBean = core.getMessengerBean();
         if (msgBean != null)
             simLinkBean.setMessengerBean(msgBean.getMessengerBean());
    }

    /** Handles connection change to disconnected */
    public void disconnected() {
        simLinkWinMan.closeAllWindows();
        simLinkMenuItem.setEnabled(false);
        simLinkMenuItem.removeAll();
    }

    /** Handles action from GUI controls in main window */
    public void actionPerformed(ActionEvent evt) {
        if (evt.getSource() == simLinkMenuItem)
        {
            simLinkWinMan.openNewWindow("SimLink Plugin");
        }
    }

    /**
     * If namespace is <code>jabber:iq:buddyfinder</code>
     * browses given JID and returns true otherwise returns false.
     */
    public boolean performAction(JID jid, String namespace) {
        if (namespace != null && namespace.equals("jabber:iq:simlink")) {
            if (!mainFrame.isConnected()) {
                JOptionPane.showMessageDialog(mainFrame,
                                      "SimLink error - not connected.",
                                      "Error",
                                      JOptionPane.ERROR_MESSAGE);
                return false;
            }
            simLinkWinMan.openNewWindow((jid != null)? jid.toString() : null);
            return true;
        }
        else
            return false;
    }

    /** Adds supported namespaces and their names */
    public void getSupportedNamespaces(Vector namespaces, Vector names) {
        namespaces.addElement(new String("jabber:iq:buddyfinder"));
        names.addElement(new String("Jabber SimLink"));
    }

    /** Loads preferences. Empty implementation. */
    protected void loadPreferences() {}

    /** Returns components and their names for display in preferences dialog.
     *  Empty implementation - returns null.
     */
    public void getPreferencesTab(Vector components, Vector names) {}

    /** Stores preferences from preferences tab.
     *  Empty implementation.
     */
    public boolean storePreferences() {
        return true;
    }

    /** Updates LAF of all plug-ins  */
    public void updateLAF() {
        simLinkWinMan.updateLAF();
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -