[sc1.0-cvs] CVS update: /sip-communicator-1-0-draft/src/net/java/sip/communicator/impl/gui/main/

yanas at dev.java.net yanas at dev.java.net
Tue Feb 21 18:19:26 CET 2006


User: yanas   
Date: 2006/02/21 09:19:26

Log:
 protocol presence

File Changes:

Directory: /sip-communicator-1-0-draft/src/net/java/sip/communicator/impl/gui/main/
===================================================================================

File [changed]: StatusPanel.java
Url: https://sip-communicator-1-0-draft.dev.java.net/source/browse/sip-communicator-1-0-draft/src/net/java/sip/communicator/impl/gui/main/StatusPanel.java?r1=1.6&r2=1.7
Delta lines:  +14 -0
--------------------
--- StatusPanel.java	17 Feb 2006 14:15:12 -0000	1.6
+++ StatusPanel.java	21 Feb 2006 17:19:23 -0000	1.7
@@ -17,6 +17,7 @@
 import javax.swing.JPanel;
 
 import net.java.sip.communicator.impl.gui.main.utils.Constants;
+import net.java.sip.communicator.impl.gui.main.utils.ImageLoader;
 import net.java.sip.communicator.service.protocol.OperationFailedException;
 import net.java.sip.communicator.service.protocol.OperationSetPresence;
 import net.java.sip.communicator.service.protocol.PresenceStatus;
@@ -69,6 +70,19 @@
             = (StatusSelectorBox)protocolStatusCombos.get(protocol);
         
         selectorBox.setIconImage((Image)protocolStatusMap.get(status));
+        
+        selectorBox.repaint();
+    }
+    
+    public void setConnecting(String protocol){
+        
+        Map protocolStatusMap = Constants
+            .getProtocolStatusIcons(protocol);
+        
+        StatusSelectorBox selectorBox
+            = (StatusSelectorBox)protocolStatusCombos.get(protocol);
+        
+        selectorBox.setIconImage(ImageLoader.getImage(ImageLoader.ICQ_CONNECTING));
         
         selectorBox.repaint();
     }

File [changed]: StatusSelectorBox.java
Url: https://sip-communicator-1-0-draft.dev.java.net/source/browse/sip-communicator-1-0-draft/src/net/java/sip/communicator/impl/gui/main/StatusSelectorBox.java?r1=1.1&r2=1.2
Delta lines:  +21 -9
--------------------
--- StatusSelectorBox.java	17 Feb 2006 14:15:13 -0000	1.1
+++ StatusSelectorBox.java	21 Feb 2006 17:19:23 -0000	1.2
@@ -17,6 +17,7 @@
 
 import javax.swing.Icon;
 import javax.swing.ImageIcon;
+import javax.swing.JLabel;
 import javax.swing.JMenuItem;
 
 import net.java.sip.communicator.impl.gui.main.customcontrols.AntialiasedPopupMenu;
@@ -27,7 +28,7 @@
 import net.java.sip.communicator.service.protocol.PresenceStatus;
 import net.java.sip.communicator.service.protocol.icqconstants.IcqStatusEnum;
 
-public class StatusSelectorBox extends SIPCommButton
+public class StatusSelectorBox extends JLabel
     implements ActionListener{
 
     private AntialiasedPopupMenu popup;
@@ -37,23 +38,28 @@
     private OperationSetPresence presence;
     
     public StatusSelectorBox() {
-        
+        /*
         super(  ImageLoader.getImage(ImageLoader.STATUS_SELECTOR_BOX),
                 ImageLoader.getImage(ImageLoader.STATUS_SELECTOR_BOX),
                 null);
+        */
+        super(new ImageIcon(ImageLoader.getImage(ImageLoader.STATUS_SELECTOR_BOX)));
         
         this.popup = new AntialiasedPopupMenu();
         
         this.popup.setInvoker(this);
         
-        this.addActionListener(this);
+        //this.addActionListener(this);
     }
     
     public StatusSelectorBox(Map itemsMap, Image selectedItem) {
-        
+        /*
         super(  ImageLoader.getImage(ImageLoader.STATUS_SELECTOR_BOX),
                 ImageLoader.getImage(ImageLoader.STATUS_SELECTOR_BOX),
                 selectedItem);
+        */
+        super(new ImageIcon(ImageLoader.getImage(
+                    ImageLoader.STATUS_SELECTOR_BOX)));
         
         this.itemsMap = itemsMap;
         
@@ -61,7 +67,7 @@
         
         this.popup.setInvoker(this);
         
-        this.addActionListener(this);
+        //this.addActionListener(this);
         
         this.init();
     }
@@ -115,10 +121,13 @@
                 PresenceStatus status 
                     = ((PresenceStatus)statusSet.next());
                 
-                if(status.getStatusName().equals(menuItem.getText())){
+                if(status.getStatusName().equals(menuItem.getText())
+                        && !this.presence.getPresenceStatus().equals(status)){
                     
                     try {
+                        if(!status.equals(IcqStatusEnum.OFFLINE))
                         this.presence.publishPresenceStatus(status, "");
+                    
                     } catch (IllegalArgumentException e1) {
                         // TODO Auto-generated catch block
                         e1.printStackTrace();
@@ -139,6 +148,11 @@
         }
     }
     
+    public void setIconImage(Image image){
+        
+        this.setIcon(new ImageIcon (image));
+    }
+    
     public Point calculatePopupLocation(){
         
         Component component = this;
@@ -167,6 +181,4 @@
     public void setPresence(OperationSetPresence presence) {
         this.presence = presence;
     }
-    
-
 }

File [changed]: MainFrame.java
Url: https://sip-communicator-1-0-draft.dev.java.net/source/browse/sip-communicator-1-0-draft/src/net/java/sip/communicator/impl/gui/main/MainFrame.java?r1=1.6&r2=1.7
Delta lines:  +6 -1
-------------------
--- MainFrame.java	17 Feb 2006 14:11:23 -0000	1.6
+++ MainFrame.java	21 Feb 2006 17:19:24 -0000	1.7
@@ -176,6 +176,7 @@
                         (new ProviderPresenceStatusAdapter());

                                 

                 try {            

+                    

                     persistentPresence

                         .publishPresenceStatus(IcqStatusEnum.ONLINE, "");                    

                                        

@@ -209,5 +210,9 @@
             

         }

     

+    }

+

+    public StatusPanel getStatusPanel() {

+        return statusPanel;

     }

 }





---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe at sip-communicator-1-0-draft.dev.java.net
For additional commands, e-mail: cvs-help at sip-communicator-1-0-draft.dev.java.net





More information about the commits mailing list