aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYana Stamcheva <yana@jitsi.org>2007-12-20 15:10:14 +0000
committerYana Stamcheva <yana@jitsi.org>2007-12-20 15:10:14 +0000
commit0ec76bfb0eae1b68075bb86259bf21b9d86afac6 (patch)
treeee7497fe0d48878eb869b334cb9b05f8dbccda63
parent7fda8672e30c2e83ae82207fcd3dd79a2eb8de4e (diff)
downloadjitsi-0ec76bfb0eae1b68075bb86259bf21b9d86afac6.zip
jitsi-0ec76bfb0eae1b68075bb86259bf21b9d86afac6.tar.gz
jitsi-0ec76bfb0eae1b68075bb86259bf21b9d86afac6.tar.bz2
Some new gui plug-in containers.
-rw-r--r--src/net/java/sip/communicator/impl/gui/UIServiceImpl.java5
-rwxr-xr-xsrc/net/java/sip/communicator/impl/gui/main/MainFrame.java109
-rwxr-xr-xsrc/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java48
-rw-r--r--src/net/java/sip/communicator/service/gui/UIService.java33
4 files changed, 192 insertions, 3 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java
index 861f578..4a962be 100644
--- a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java
+++ b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java
@@ -61,6 +61,11 @@ public class UIServiceImpl
supportedContainers.add(UIService.CONTAINER_CALL_HISTORY);
supportedContainers.add(UIService.CONTAINER_MAIN_TABBED_PANE);
supportedContainers.add(UIService.CONTAINER_CHAT_HELP_MENU);
+ supportedContainers.add(UIService.CONTAINER_CHAT_WINDOW_SOUTH);
+ supportedContainers.add(UIService.CONTAINER_CONTACT_LIST_EAST);
+ supportedContainers.add(UIService.CONTAINER_CONTACT_LIST_WEST);
+ supportedContainers.add(UIService.CONTAINER_CONTACT_LIST_SOUTH);
+ supportedContainers.add(UIService.CONTAINER_CONTACT_LIST_NORTH);
}
private static final Hashtable<WindowID, ExportedWindow> exportedWindows
diff --git a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java
index 0570e44..03314e9 100755
--- a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java
+++ b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java
@@ -32,6 +32,7 @@ import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.contacteventhandler.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.gui.event.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
@@ -49,6 +50,7 @@ import org.osgi.framework.*;
*/
public class MainFrame
extends SIPCommFrame
+ implements PluginComponentListener
{
private Logger logger = Logger.getLogger(MainFrame.class.getName());
@@ -105,6 +107,8 @@ public class MainFrame
this.setTitle(Messages.getI18NString("sipCommunicator").getText());
this.init();
+
+ this.initPluginComponents();
}
/**
@@ -128,7 +132,7 @@ public class MainFrame
this.mainPanel.add(contactListPanel, BorderLayout.CENTER);
this.mainPanel.add(statusPanel, BorderLayout.SOUTH);
- this.getContentPane().add(mainPanel);
+ this.getContentPane().add(mainPanel, BorderLayout.CENTER);
}
/**
@@ -1178,4 +1182,107 @@ public class MainFrame
return (ContactEventHandler) GuiActivator.bundleContext
.getService(serRefs[0]);
}
+
+ /**
+ * Initialize plugin components already registered for this container.
+ */
+ private void initPluginComponents()
+ {
+ Iterator pluginComponents = GuiActivator.getUIService()
+ .getComponentsForContainer(
+ UIService.CONTAINER_CONTACT_LIST_SOUTH);
+
+ while (pluginComponents.hasNext())
+ {
+ Component o = (Component) pluginComponents.next();
+
+ this.getContentPane().add(o, BorderLayout.SOUTH);
+ }
+
+ pluginComponents = GuiActivator.getUIService()
+ .getComponentsForContainer(
+ UIService.CONTAINER_CONTACT_LIST_NORTH);
+
+ while (pluginComponents.hasNext())
+ {
+ Component o = (Component) pluginComponents.next();
+
+ this.getContentPane().add(o, BorderLayout.NORTH);
+ }
+
+ pluginComponents = GuiActivator.getUIService()
+ .getComponentsForContainer(
+ UIService.CONTAINER_CONTACT_LIST_EAST);
+
+ while (pluginComponents.hasNext())
+ {
+ Component o = (Component) pluginComponents.next();
+
+ this.getContentPane().add(o, BorderLayout.EAST);
+ }
+
+ pluginComponents = GuiActivator.getUIService()
+ .getComponentsForContainer(
+ UIService.CONTAINER_CONTACT_LIST_WEST);
+
+ while (pluginComponents.hasNext())
+ {
+ Component o = (Component) pluginComponents.next();
+
+ this.getContentPane().add(o, BorderLayout.WEST);
+ }
+
+ GuiActivator.getUIService().addPluginComponentListener(this);
+ }
+
+ /**
+ * Adds the associated with this <tt>PluginComponentEvent</tt> component
+ * to the appropriate container.
+ */
+ public void pluginComponentAdded(PluginComponentEvent event)
+ {
+ Component c = (Component) event.getSource();
+
+ if (event.getContainerID().equals(
+ UIService.CONTAINER_CONTACT_LIST_SOUTH))
+ {
+ this.getContentPane().add(c, BorderLayout.SOUTH);
+ }
+ else if (event.getContainerID().equals(
+ UIService.CONTAINER_CONTACT_LIST_NORTH))
+ {
+ this.getContentPane().add(c, BorderLayout.NORTH);
+ }
+ else if (event.getContainerID().equals(
+ UIService.CONTAINER_CONTACT_LIST_EAST))
+ {
+ this.getContentPane().add(c, BorderLayout.EAST);
+ }
+ else if (event.getContainerID().equals(
+ UIService.CONTAINER_CONTACT_LIST_WEST))
+ {
+ this.getContentPane().add(c, BorderLayout.WEST);
+ }
+
+ this.pack();
+ }
+
+ /**
+ * Removes the associated with this <tt>PluginComponentEvent</tt> component
+ * from this container.
+ */
+ public void pluginComponentRemoved(PluginComponentEvent event)
+ {
+ Component c = (Component) event.getSource();
+
+ ContainerID containerID = event.getContainerID();
+
+ if (containerID.equals(UIService.CONTAINER_CONTACT_LIST_SOUTH)
+ || containerID.equals(UIService.CONTAINER_CONTACT_LIST_NORTH)
+ || containerID.equals(UIService.CONTAINER_CONTACT_LIST_EAST)
+ || containerID.equals(UIService.CONTAINER_CONTACT_LIST_WEST))
+ {
+ this.getContentPane().remove(c);
+ }
+ }
}
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java
index 9eba41e..20d5c7d 100755
--- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java
@@ -13,6 +13,7 @@ import java.util.*;
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.customcontrols.events.*;
import net.java.sip.communicator.impl.gui.main.*;
@@ -20,6 +21,7 @@ import net.java.sip.communicator.impl.gui.main.chat.menus.*;
import net.java.sip.communicator.impl.gui.main.chat.toolBars.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.service.gui.event.*;
import net.java.sip.communicator.util.*;
/**
@@ -37,7 +39,8 @@ import net.java.sip.communicator.util.*;
*/
public class ChatWindow
extends SIPCommFrame
- implements ExportedWindow
+ implements ExportedWindow,
+ PluginComponentListener
{
private Logger logger = Logger.getLogger(ChatWindow.class.getName());
@@ -85,6 +88,8 @@ public class ChatWindow
this.getContentPane().add(menusPanel, BorderLayout.NORTH);
+ this.initPluginComponents();
+
this.addKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT,
KeyEvent.ALT_DOWN_MASK), new ForwordTabAction());
this.addKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT,
@@ -625,4 +630,45 @@ public class ChatWindow
this.toFront();
}
+
+ /**
+ * Initialize plugin components already registered for this container.
+ */
+ private void initPluginComponents()
+ {
+ Iterator pluginComponents = GuiActivator.getUIService()
+ .getComponentsForContainer(UIService.CONTAINER_CHAT_WINDOW_SOUTH);
+
+ while (pluginComponents.hasNext())
+ {
+ Component o = (Component) pluginComponents.next();
+
+ this.add(o, BorderLayout.SOUTH);
+ }
+
+ GuiActivator.getUIService().addPluginComponentListener(this);
+ }
+
+ public void pluginComponentAdded(PluginComponentEvent event)
+ {
+ Component c = (Component) event.getSource();
+
+ if (event.getContainerID().equals(UIService.CONTAINER_CHAT_WINDOW_SOUTH))
+ {
+ this.getContentPane().add(c, BorderLayout.SOUTH);
+
+ this.pack();
+ }
+ }
+
+ public void pluginComponentRemoved(PluginComponentEvent event)
+ {
+ Component c = (Component) event.getSource();
+
+ if (event.getContainerID().equals(UIService.CONTAINER_CHAT_WINDOW_SOUTH))
+ {
+ this.getContentPane().remove(c);
+ }
+ }
+
}
diff --git a/src/net/java/sip/communicator/service/gui/UIService.java b/src/net/java/sip/communicator/service/gui/UIService.java
index f0f6aa9..934dbe5 100644
--- a/src/net/java/sip/communicator/service/gui/UIService.java
+++ b/src/net/java/sip/communicator/service/gui/UIService.java
@@ -117,12 +117,43 @@ public interface UIService
*/
public static final ContainerID CONTAINER_CHAT_SETTINGS_MENU
= new ContainerID("ChatSettingsMenu");
+
/**
* Chat window "help menu" container.
*/
public static final ContainerID CONTAINER_CHAT_HELP_MENU
= new ContainerID("ChatHelpMenu");
-
+
+ /**
+ * Chat window "south area" container.
+ */
+ public static final ContainerID CONTAINER_CHAT_WINDOW_SOUTH
+ = new ContainerID("ChatWindowSouth");
+
+ /**
+ * Indicates the west area on the left of the contact list.
+ */
+ public static final ContainerID CONTAINER_CONTACT_LIST_WEST
+ = new ContainerID("ContactListWest");
+
+ /**
+ * Indicates the east area on the right of the contact list.
+ */
+ public static final ContainerID CONTAINER_CONTACT_LIST_EAST
+ = new ContainerID("ContactListEast");
+
+ /**
+ * Indicates the north area on the top of the contact list.
+ */
+ public static final ContainerID CONTAINER_CONTACT_LIST_NORTH
+ = new ContainerID("ContactListNorth");
+
+ /**
+ * Indicates the south area on the bottom of the contact list.
+ */
+ public static final ContainerID CONTAINER_CONTACT_LIST_SOUTH
+ = new ContainerID("ContactListSouth");
+
/**
* Call history panel container.
*/