Package nu.fw.jeti.jabber

Examples of nu.fw.jeti.jabber.JIDStatus


            if (o instanceof ItemTag) {
                ItemTag i = (ItemTag) o;
                JID jid = i.getJID();
                if (jid == null) break;
                String nick = null;
                JIDStatus j = Roster.getJIDStatus(jid);
                if (j != null) nick = j.getNick();
                if (nick == null) nick = "?";
               
                BSJIDLabel jidLabel = new BSJIDLabel(jid, nick, getIconForPresence(0));
                jidLabel.setOpaque(false);
                Icon onlineIcon = getIconForPresence(Presence.AVAILABLE);
View Full Code Here


        while (labelLists.hasMoreElements()) {
            BSJIDLabelList labels = (BSJIDLabelList) labelLists.nextElement();
            JID jid = labels.getJID();
            // *** what about people who are not in roster !!!
            //BSPresenceInfo pi = presenceBean.getResourcePresence(jid);
            JIDStatus j = Roster.getJIDStatus(jid);
            int show=0;
            if(j!=null) show = j.getShow();
            else show = Presence.NONE;
            Icon img = getIconForPresence(show);
            labels.setImg(img);
        }
       
View Full Code Here

                    jidPopupMenu.add(new JSeparator());
                } //if connected
               
                //BSPresenceInfo pi = presenceBean.getResourcePresence(jid);
                //if (pi == null) pi = new BSPresenceInfo(jid, false, null, null);
                JIDStatus j = Roster.getJIDStatus(jid);
                int show=0;
                String status=null;
                String nick=null;
                if(j!=null)
                {
                  show = j.getShow();
                  status = j.getStatus();
                  nick = j.getNick();
                }
                else show = Presence.NONE;
                Icon img = getIconForPresence(show);
                presenceMenuItem.setIcon(img);
              
                if (status == null) status = "";
                if(nick==null)nick ="?";
                presenceMenuItem.setText(nick + " - " + status);
                jidPopupMenu.add(presenceMenuItem);
               
                jidPopupMenu.show(e.getComponent(), e.getX(), e.getY());
                //adjustPopupPosition(jidPopupMenu);
            }
           
            // else if we clicked on cluster label
            else if (src instanceof BSClusterLabel) {
               
                clusterPopupMenu.removeAll();
                Enumeration jids = ((BSClusterLabel)src).getJIDs();
               
                // for all jid in cluster
                while (jids.hasMoreElements()) {
                    JID j = (JID) jids.nextElement();
                    //BSPresenceInfo pi = presenceBean.getResourcePresence(j);
                   
                    JIDStatus js = Roster.getJIDStatus(j);
                    int show=0;
                    String nick=null;
                    if(js!=null)
                    {
                      show = js.getShow();
                      nick = js.getNick();
                    }
                    else show = Presence.NONE;
                    Icon img = getIconForPresence(show);
                    if(nick==null)nick ="?";
                                    
                    JMenu jidSubmenu = new JMenu(nick + " (" + j.toString() + ")");
                    jidSubmenu.setIcon(img);
                    clusterPopupMenu.add(jidSubmenu);
                   
                    if (connected) {
                        BSJIDActionMenuItem mi;
                        mi = new BSJIDActionMenuItem(CHAT_MENU_STR, j);
                        mi.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                mapPanel.openChat(((BSJIDActionMenuItem)e.getSource()).getJID());
                            }
                        });
                        jidSubmenu.add(mi);

                        mi = new BSJIDActionMenuItem(MSG_MENU_STR, j);
                        mi.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                mapPanel.sendMessage(((BSJIDActionMenuItem)e.getSource()).getJID());
                            }
                        });
                        jidSubmenu.add(mi);

                        mi = new BSJIDActionMenuItem(SUBSCRIBE_MENU_STR, j);
                        mi.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                mapPanel.sendSubscriptionRequest(((BSJIDActionMenuItem)e.getSource()).getJID());
                            }
                        });
                        jidSubmenu.add(mi);
/*
                        if (mapPanel.supportsPlans()) {
                            mi = new BSJIDActionMenuItem(GET_PLAN_MENU_STR, j);
                            mi.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent e) {
                                    mapPanel.getPlan(((BSJIDActionMenuItem)e.getSource()).getJID());
                                }
                            });
                            jidSubmenu.add(mi);
                        }
                        */

                        jidSubmenu.add(new JSeparator());
                    } // if connected
                   
                    if (js == null) js = new UnknownJIDStatus(j);
                    String status = js.getStatus();
                    if (status == null) status = "";
                    JMenuItem presenceMI = new JMenuItem(Presence.toLongShow(js.getShow()) + " - " + status);
                    presenceMI.setIcon(img);
                    jidSubmenu.add(presenceMI);
                } //while
               
                clusterPopupMenu.show(e.getComponent(), e.getX(), e.getY());
View Full Code Here

      {
        role=muc.getRole();
        affiliation=muc.getAffiliation();
        fullJID = muc.getJID();
                if (fullJID != null) {
                    JIDStatus jidStatus = Roster.getJIDStatus(fullJID);
                    if (jidStatus != null && jidStatus.getNick() != null) {
                      if(Preferences.getBoolean("groupchat","showNick",true))
                      {
                        String nick = " (" + jidStatus.getNick() + ")";
                        if(!getNick().endsWith(nick))setNick(getNick() +nick);
                      }
                    }
                }
      }
View Full Code Here

    public void refreshPresences() {
        presences.clear();
        Enumeration jids = getJIDs();
        while(jids.hasMoreElements()) {
            JID j = (JID) jids.nextElement();
            JIDStatus pi = Roster.getJIDStatus(j);
            //String str = BSPresenceBean.getJIDHashString(j, true);
            if (pi == null) {
                pi = new UnknownJIDStatus(j);
            }
            //presences.put(str, pi);
View Full Code Here

    public void clearPresences() {
        presences.clear();
        Enumeration jids = getJIDs();
        while(jids.hasMoreElements()) {
            JID j = (JID) jids.nextElement();
            JIDStatus pi = new UnknownJIDStatus(j);
             //String str = BSPresenceBean.getJIDHashString(j, false);
            //presences.put(str, pi);
            presences.put(j, pi);
        }
       
View Full Code Here

    private void updateIcon() {
        Enumeration piEnum = presences.elements();
        int online = 0;
        int offline = 0;
        while(piEnum.hasMoreElements()) {
           JIDStatus pi = (JIDStatus) piEnum.nextElement();
            if (pi.isOnline()) online++;
            else offline++;
        }
       
        if (online == 0) {
            setIcon(allOfflineIcon);
View Full Code Here

    }
  }

  private void startChat(Actor actor)
  {
    JIDStatus js = new UnknownJIDStatus(actor.getCompleteJID(),actor.getNick());
    backend.getMain().startChatResource(js);
  }
View Full Code Here

    System.out.println(jid);
    System.out.println(queryText);
   
    if(jid!=null)
    {
      JIDStatus jidStatus = backend.getJIDStatus(jid);
      if(jidStatus==null)jidStatus = new UnknownJIDStatus(jid);
      if(queryText==null)
      {
        backend.getMain().chat(jidStatus);
      }
View Full Code Here

        try {
            jbInit();
        } catch(Exception e) {
            e.printStackTrace();
        }
        JIDStatus js = Roster.getJIDStatus(to);
        if(js!=null)toTxt.setText(js.getNick());
        else toTxt.setText(to.toString());
         
        fileTxt.setText(file.toString());
        sizeTxt.setText(Plugin.getSizeText(file.length()));
        statusTxt.setText(I18N.gettext("filetransfer.Opening_connection") + "...");
View Full Code Here

TOP

Related Classes of nu.fw.jeti.jabber.JIDStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.