Some new gui plug-in containers.

cusax-fix
Yana Stamcheva 18 years ago
parent 7fda8672e3
commit 0ec76bfb0e

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

@ -32,6 +32,7 @@
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 @@
*/
public class MainFrame
extends SIPCommFrame
implements PluginComponentListener
{
private Logger logger = Logger.getLogger(MainFrame.class.getName());
@ -105,6 +107,8 @@ public MainFrame()
this.setTitle(Messages.getI18NString("sipCommunicator").getText());
this.init();
this.initPluginComponents();
}
/**
@ -128,7 +132,7 @@ private void init()
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 @@ private ContactEventHandler getContactHandlerForProvider(
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);
}
}
}

@ -13,6 +13,7 @@
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.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 @@
*/
public class ChatWindow
extends SIPCommFrame
implements ExportedWindow
implements ExportedWindow,
PluginComponentListener
{
private Logger logger = Logger.getLogger(ChatWindow.class.getName());
@ -85,6 +88,8 @@ public void closeOperation(MouseEvent e)
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 void bringToFront()
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);
}
}
}

@ -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.
*/

Loading…
Cancel
Save