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

📄 bsdiscoitemview.java

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

/*
 * BSDiscoItemView.java
 *
 * Project: BuddySpace
 * (C) Copyright Knowledge Media Institute 2002
 *
 *
 * Created on 14 October 2003, 10:31
 */

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

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

import edu.ou.kmi.buddyspace.plugins.disco.xml.*;

/**
 * <code>BSDiscoItemView</code> displays info about <code>IQDiscoInfo</code>.
 *
 * @author  Jiri Komzak, Knowledge Media Institute, Open University, United Kingdom
 */
public class BSDiscoItemView extends JEditorPane {

    private IQDiscoInfo di = null;

    /** Constructor */
    BSDiscoItemView() {
        super();
        initComponents();
    }

    /** Constructor */
    BSDiscoItemView(IQDiscoInfo di) {
        this();
        display(di);
    }

    /** Inits GUI components */
    private void initComponents() {
        setEditable(false);
        setContentType("text/html");
        //setPreferredSize(new Dimension(150, 300));
    }

    /** Displays given <code>IQDiscoInfo</code> */
    public void display(IQDiscoInfo di) {
        this.di = di;
        String pageStr = new String();
        //setText("");
        pageStr += "<html><body>";
        if (di != null) {
            Enumeration enumeration = di.identities();
            if (enumeration != null && enumeration.hasMoreElements())
                pageStr += "<b>Identities:</b><br>";
            while (enumeration.hasMoreElements()) {
                DiscoIdentity iden = (DiscoIdentity)enumeration.nextElement();
                pageStr += iden.getAttribute("name") + " (" + iden.getAttribute("category") + " - " + iden.getAttribute("type") + ")<br>";
            }
            enumeration = di.features();
            if (enumeration != null && enumeration.hasMoreElements())
                pageStr += "<b>Features:</b><br>";
            while (enumeration.hasMoreElements()) {
                DiscoFeature feat = (DiscoFeature)enumeration.nextElement();
                pageStr += "<a href=\"" + feat.getAttribute("var") + "\">" + feat.getAttribute("var") + "</a><br>";
            }

            /*String category = bi.getCategory();
            //append(category + ":\n  ");
            pageStr += "<b>" + category + ":</b><br>";
            String name = bi.getName();
            //append(name);
            pageStr += "<b>" + name + "</b><br>";
            JID jid = bi.getJID();
            if (jid != null)
                //append("\n  (" + jid.toString() + ")");
                pageStr += "(" + jid.toString() + ")<br>";
            String type = bi.getType();
            //append("\nType:\n  " + type);
            pageStr += "<br><b>Type:</b><br>" + type + "<br>";

            //append("\nSupported namespaces:\n  ");
            pageStr += "<br><b>Supported namespaces:</b><br>";
            Enumeration namespaces = bi.namespaces();
            while (namespaces.hasMoreElements()) {
                //append(((String)namespaces.nextElement()) + "\n  ");
                String ns = (String)namespaces.nextElement();
                pageStr += "<a href=\"" + ns + "\">" + ns + "</a><br>";
            }*/
        }
        pageStr += "</body></html>";
        setText(pageStr);
    }

    public JID getJID() {
        return null;
        /*if (di == null) return null;
        else return di.getJID();*/
    }

}

⌨️ 快捷键说明

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