[sip-comm-cvs] CVS update: /sip-communicator/src/net/java/sip/communicator/service/gui/event/, /sip-communicator/src/net/java/sip/communicator/impl/gui/main/menus...

yanas at dev.java.net yanas at dev.java.net
Thu May 3 18:08:52 CEST 2007


User: yanas   
Date: 2007-05-03 16:08:52+0000
Modified:
   sip-communicator/src/net/java/sip/communicator/service/gui/event/PluginComponentEvent.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/menus/QuickMenu.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/menus/ToolsMenu.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupRightButtonMenu.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomServerRightButtonMenu.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java

Log:
 when a PluginComponentEvent is received should check the container id in order to add it or remove it from the appropriate container

File Changes:

Directory: /sip-communicator/src/net/java/sip/communicator/service/gui/event/
=============================================================================

File [changed]: PluginComponentEvent.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/service/gui/event/PluginComponentEvent.java?r1=1.4&r2=1.5
Delta lines:  +23 -2
--------------------
--- PluginComponentEvent.java	2006-08-16 14:28:44+0000	1.4
+++ PluginComponentEvent.java	2007-05-03 16:08:49+0000	1.5
@@ -15,7 +15,8 @@
  * @author Yana Stamcheva
  */
 public class PluginComponentEvent
-    extends EventObject{
+    extends EventObject
+{
 
     private int eventID = -1;
 
@@ -32,6 +33,12 @@
     public static final int PLUGIN_COMPONENT_REMOVED = 2;
 
     /**
+     * The identifier of the container to which or from which the plugin
+     * component is added or removed.
+     */
+    private ContainerID containerID;
+    
+    /**
      * Creates a new PluginComponentEvent according to the specified
      * parameters.
      * @param source The pluginComponent that is added to the container.
@@ -40,9 +47,12 @@
      * @param eventID one of the PLUGIN_COMPONENT_XXX static fields indicating
      * the nature of the event.
      */
-    public PluginComponentEvent(Object source, ContainerID containerID, int eventID) {
+    public PluginComponentEvent(Object source, ContainerID containerID,
+            int eventID)
+    {
         super(source);
         this.eventID = eventID;
+        this.containerID = containerID;
     }
     
     /**
@@ -53,4 +63,15 @@
     public int getEventID(){
         return eventID;
     }
+
+    /**
+     * Returns the identifier of the container, where the plugin component, which
+     * is the source of this event is added or removed.
+     * 
+     * @return the identifier of the plugin container
+     */
+    public ContainerID getContainerID()
+    {
+        return containerID;
+    }
 }

Directory: /sip-communicator/src/net/java/sip/communicator/impl/gui/main/menus/
===============================================================================

File [changed]: QuickMenu.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/menus/QuickMenu.java?r1=1.26&r2=1.27
Delta lines:  +15 -2
--------------------
--- QuickMenu.java	2007-04-13 14:03:58+0000	1.26
+++ QuickMenu.java	2007-05-03 16:08:49+0000	1.27
@@ -280,9 +280,16 @@
      * Implements the <code>PluginComponentListener.pluginComponentAdded</code>
      * method.
      */
-    public void pluginComponentAdded(PluginComponentEvent event) {
+    public void pluginComponentAdded(PluginComponentEvent event)
+    {
         Component c = (Component) event.getSource();
         
+        // If the container id doesn't correspond to the id of the plugin
+        // container we're not interested.
+        if(!event.getContainerID()
+                .equals(UIService.CONTAINER_MAIN_TOOL_BAR))
+            return;
+        
         this.add(c);
         
         if (c instanceof ContactAwareComponent)
@@ -313,6 +320,12 @@
     public void pluginComponentRemoved(PluginComponentEvent event) {
         Component c = (Component) event.getSource();
         
+        // If the container id doesn't correspond to the id of the plugin
+        // container we're not interested.
+        if(!event.getContainerID()
+                .equals(UIService.CONTAINER_MAIN_TOOL_BAR))
+            return;
+        
         this.remove(c);
     }
 

File [changed]: ToolsMenu.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/menus/ToolsMenu.java?r1=1.9&r2=1.10
Delta lines:  +11 -5
--------------------
--- ToolsMenu.java	2007-04-26 21:43:49+0000	1.9
+++ ToolsMenu.java	2007-05-03 16:08:49+0000	1.10
@@ -105,16 +105,22 @@
     {
         Component c = (Component) event.getSource();
         
+        if(event.getContainerID().equals(UIService.CONTAINER_TOOLS_MENU))
+        {
         this.add(c);
         
         this.revalidate();
         this.repaint();
     }
+    }
 
     public void pluginComponentRemoved(PluginComponentEvent event)
     {
         Component c = (Component) event.getSource();
         
+        if(event.getContainerID().equals(UIService.CONTAINER_TOOLS_MENU))
+        {
         this.remove(c);
     }
+    }
 }

Directory: /sip-communicator/src/net/java/sip/communicator/impl/gui/main/contactlist/
=====================================================================================

File [changed]: ContactRightButtonMenu.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java?r1=1.49&r2=1.50
Delta lines:  +17 -9
--------------------
--- ContactRightButtonMenu.java	2007-04-26 21:43:48+0000	1.49
+++ ContactRightButtonMenu.java	2007-05-03 16:08:49+0000	1.50
@@ -717,6 +717,9 @@
     {
         Component c = (Component) event.getSource();
         
+        if(event.getContainerID()
+                .equals(UIService.CONTAINER_CONTACT_RIGHT_BUTTON_MENU))
+        {
         this.add(c);
         
         if (c instanceof ContactAwareComponent)
@@ -727,13 +730,18 @@
         
         this.repaint();
     }
+    }
 
     public void pluginComponentRemoved(PluginComponentEvent event)
     {
         Component c = (Component) event.getSource();
         
+        if(event.getContainerID()
+                .equals(UIService.CONTAINER_CONTACT_RIGHT_BUTTON_MENU))
+        {
         this.remove(c);
     }
+    }
     
     /**
      * Obtains the status icon for the given protocol contact and

File [changed]: GroupRightButtonMenu.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupRightButtonMenu.java?r1=1.20&r2=1.21
Delta lines:  +17 -9
--------------------
--- GroupRightButtonMenu.java	2007-04-17 15:34:20+0000	1.20
+++ GroupRightButtonMenu.java	2007-05-03 16:08:49+0000	1.21
@@ -229,6 +229,9 @@
     {
         Component c = (Component) event.getSource();
         
+        if(event.getContainerID()
+                .equals(UIService.CONTAINER_GROUP_RIGHT_BUTTON_MENU))
+        {
         this.add(c);
         
         if (c instanceof ContactAwareComponent)
@@ -239,13 +242,18 @@
         
         this.repaint();
     }
+    }
 
     public void pluginComponentRemoved(PluginComponentEvent event)
     {
         Component c = (Component) event.getSource();
         
+        if(event.getContainerID()
+                .equals(UIService.CONTAINER_GROUP_RIGHT_BUTTON_MENU))
+        {
         this.remove(c);
     }
+    }
     
     /**
      * Obtains the status icon for the given protocol contact and

Directory: /sip-communicator/src/net/java/sip/communicator/impl/gui/
====================================================================

File [changed]: UIServiceImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java?r1=1.33&r2=1.34
Delta lines:  +0 -1
-------------------
--- UIServiceImpl.java	2007-04-29 16:09:28+0000	1.33
+++ UIServiceImpl.java	2007-05-03 16:08:49+0000	1.34
@@ -44,7 +44,6 @@
 public class UIServiceImpl
     implements UIService
 {
-
     private static final Logger logger = Logger.getLogger(UIServiceImpl.class);
 
     private PopupDialogImpl popupDialog;

Directory: /sip-communicator/src/net/java/sip/communicator/impl/gui/main/chatroomslist/
=======================================================================================

File [changed]: ChatRoomServerRightButtonMenu.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomServerRightButtonMenu.java?r1=1.3&r2=1.4
Delta lines:  +1 -48
--------------------
--- ChatRoomServerRightButtonMenu.java	2007-05-03 14:23:20+0000	1.3
+++ ChatRoomServerRightButtonMenu.java	2007-05-03 16:08:50+0000	1.4
@@ -31,8 +31,7 @@
  */
 public class ChatRoomServerRightButtonMenu
     extends JPopupMenu
-    implements  ActionListener,
-                PluginComponentListener
+    implements  ActionListener
 {
     private I18NString createChatRoomString
         = Messages.getI18NString("createChatRoom");
@@ -77,8 +76,6 @@
         this.add(createChatRoomItem);
         this.add(joinChannelItem);
         
-        this.initPluginComponents();
-
         this.createChatRoomItem.setName("createChatRoom");
         this.joinChannelItem.setName("joinChatRoom");
         
@@ -92,26 +89,6 @@
     }
     
     /**
-     * Adds all already registered plugin components to this menu.
-     */
-    private void initPluginComponents()
-    {
-        Iterator pluginComponents = GuiActivator.getUIService()
-            .getComponentsForContainer(
-                UIService.CONTAINER_CONTACT_RIGHT_BUTTON_MENU);
-        
-        if(pluginComponents.hasNext())
-            this.addSeparator();
-        
-        while (pluginComponents.hasNext())
-        {
-            Component o = (Component)pluginComponents.next();
-            
-            this.add(o);
-        }
-    }
-    
-    /**
      * Handles the <tt>ActionEvent</tt>. Determines which menu item was
      * selected and makes the appropriate operations.
      */
@@ -142,28 +119,4 @@
             joinChannelDialog.setVisible(true);
         }
     }   
-    
-    /**
-     * Implements the <tt>PluginComponentListener.pluginComponentAdded</tt>
-     * method, in order to add the given plugin component in this container.
-     */
-    public void pluginComponentAdded(PluginComponentEvent event)
-    {
-        Component c = (Component) event.getSource();
-        
-        this.add(c);
-                
-        this.repaint();
-    }
-
-    /**
-     * Implements the <tt>PluginComponentListener.pluginComponentRemoved</tt>
-     * method, in order to remove the given component from this container.
-     */
-    public void pluginComponentRemoved(PluginComponentEvent event)
-    {
-        Component c = (Component) event.getSource();
-        
-        this.remove(c);
-    }
 }

Directory: /sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/
=======================================================================================

File [changed]: MainToolBar.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java?r1=1.2&r2=1.3
Delta lines:  +13 -8
--------------------
--- MainToolBar.java	2007-04-29 16:09:28+0000	1.2
+++ MainToolBar.java	2007-05-03 16:08:50+0000	1.3
@@ -19,7 +19,6 @@
 import net.java.sip.communicator.impl.gui.main.chat.*;
 import net.java.sip.communicator.impl.gui.main.chat.history.*;
 import net.java.sip.communicator.impl.gui.utils.*;
-import net.java.sip.communicator.service.contactlist.*;
 import net.java.sip.communicator.service.gui.*;
 import net.java.sip.communicator.service.gui.event.*;
 
@@ -339,12 +338,15 @@
     {
         Component c = (Component) event.getSource();
         
+        if(event.getContainerID().equals(UIService.CONTAINER_CHAT_TOOL_BAR))
+        {
         this.addSeparator();
         this.add(c);
         
         this.revalidate();
         this.repaint();
     }
+    }
 
     /**
      * Implements the <code>PluginComponentListener.pluginComponentRemoved</code>
@@ -354,7 +356,10 @@
     {
         Component c = (Component) event.getSource();
         
+        if(event.getContainerID().equals(UIService.CONTAINER_CHAT_TOOL_BAR))
+        {
         this.remove(c);
     }
+    }
 
 }




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





More information about the commits mailing list