[sip-comm-cvs] CVS update: /sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/, /sip-communicator/src/net/java/sip/communicator/impl/gui/

yanas at dev.java.net yanas at dev.java.net
Sun Apr 29 18:09:31 CEST 2007


User: yanas   
Date: 2007-04-29 16:09:31+0000
Modified:
   sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/MainToolBar.java
   sip-communicator/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java

Log:
 make from the chat toolbar a container for plugins

File Changes:

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.1&r2=1.2
Delta lines:  +58 -1
--------------------
--- MainToolBar.java	2007-03-12 17:38:52+0000	1.1
+++ MainToolBar.java	2007-04-29 16:09:28+0000	1.2
@@ -13,11 +13,15 @@
 
 import javax.swing.*;
 
+import net.java.sip.communicator.impl.gui.*;
 import net.java.sip.communicator.impl.gui.customcontrols.*;
 import net.java.sip.communicator.impl.gui.i18n.*;
 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.*;
 
 /**
  * The <tt>MainToolBar</tt> is a <tt>JToolBar</tt> which contains buttons
@@ -30,7 +34,8 @@
  */
 public class MainToolBar
     extends SIPCommToolBar
-    implements ActionListener
+    implements  ActionListener,
+                PluginComponentListener
 {
 
     private ChatToolbarButton copyButton = new ChatToolbarButton(ImageLoader
@@ -173,6 +178,8 @@
         this.printButton.setEnabled(false);
         this.sendFileButton.setEnabled(false);
         this.fontButton.setEnabled(false);
+        
+        this.initPluginComponents();
     }
 
     /**
@@ -300,4 +307,54 @@
             nextButton.setEnabled(false);
         }
     }
+    
+    private void initPluginComponents()
+    {
+        Iterator pluginComponents = GuiActivator.getUIService()
+            .getComponentsForContainer(
+                UIService.CONTAINER_CHAT_TOOL_BAR);
+        
+        if(pluginComponents.hasNext())
+            this.addSeparator();
+        
+        while (pluginComponents.hasNext())
+        {
+            Component c = (Component)pluginComponents.next();
+            
+            this.add(c);
+            
+            this.revalidate();
+            this.repaint();
+        }
+        
+        GuiActivator.getUIService().addPluginComponentListener(this);
+    }
+
+
+    /**
+     * Implements the <code>PluginComponentListener.pluginComponentAdded</code>
+     * method.
+     */
+    public void pluginComponentAdded(PluginComponentEvent event)
+    {
+        Component c = (Component) event.getSource();
+        
+        this.addSeparator();
+        this.add(c);
+        
+        this.revalidate();
+        this.repaint();
+    }
+
+    /**
+     * Implements the <code>PluginComponentListener.pluginComponentRemoved</code>
+     * method.
+     */
+    public void pluginComponentRemoved(PluginComponentEvent event)
+    {
+        Component c = (Component) event.getSource();
+        
+        this.remove(c);
+    }
+
 }

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.32&r2=1.33
Delta lines:  +1 -0
-------------------
--- UIServiceImpl.java	2007-04-26 21:33:44+0000	1.32
+++ UIServiceImpl.java	2007-04-29 16:09:28+0000	1.33
@@ -62,6 +62,7 @@
         supportedContainers.add(UIService.CONTAINER_CONTACT_RIGHT_BUTTON_MENU);
         supportedContainers.add(UIService.CONTAINER_GROUP_RIGHT_BUTTON_MENU);
         supportedContainers.add(UIService.CONTAINER_TOOLS_MENU);
+        supportedContainers.add(UIService.CONTAINER_CHAT_TOOL_BAR);
     }
 
     private static final Hashtable exportedWindows = new Hashtable();




---------------------------------------------------------------------
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