Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.gui.utils
Class PluginContainer

java.lang.Object
  extended by net.java.sip.communicator.impl.gui.utils.PluginContainer
All Implemented Interfaces:
EventListener, PluginComponentListener

public class PluginContainer
extends Object
implements PluginComponentListener

Provides capabilities to a specific JComponent to contain PluginComponents, track when they are added and removed.

Author:
Lyubomir Marinov

Constructor Summary
PluginContainer(JComponent container, Container containerId)
          Initializes a new PluginContainer instance which is to provide capabilities to a specific JComponent container with a specific Container id to contain PluginComponent and track when they are added and removed.
 
Method Summary
protected  void addComponentToContainer(Component component, JComponent container, int preferredIndex)
          Adds a specific Component to a specific JComponent container.
 void dispose()
          Runs clean-up for associated resources which need explicit disposal (e.g.
protected  int getComponentCount(JComponent container)
          Gets the number of Components in a specific JComponent container.
 Iterable<PluginComponent> getPluginComponents()
          Gets the PluginComponents of this PluginContainer.
 void pluginComponentAdded(PluginComponentEvent event)
          Implements PluginComponentListener.pluginComponentAdded(PluginComponentEvent).
 void pluginComponentRemoved(PluginComponentEvent event)
          Implements PluginComponentListener.pluginComponentRemoved(PluginComponentEvent).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginContainer

public PluginContainer(JComponent container,
                       Container containerId)
Initializes a new PluginContainer instance which is to provide capabilities to a specific JComponent container with a specific Container id to contain PluginComponent and track when they are added and removed.

Parameters:
container - the JComponent container the new instance is to provide its capabilities to
containerId - the Container id of the specified container
Method Detail

addComponentToContainer

protected void addComponentToContainer(Component component,
                                       JComponent container,
                                       int preferredIndex)
Adds a specific Component to a specific JComponent container. Allows extenders to apply custom logic to the exact placement of the specified Component in the specified container.

Parameters:
component - the Component to be added to the specified JComponent container
container - the JComponent container to add the specified Component to
preferredIndex - the index at which component is to be added to container if possible or -1 if there is no preference with respect to the index in question

dispose

public void dispose()
Runs clean-up for associated resources which need explicit disposal (e.g. listeners keeping this instance alive because they were added to the model which operationally outlives this instance).


getComponentCount

protected int getComponentCount(JComponent container)
Gets the number of Components in a specific JComponent container. For example, returns the result of getMenuComponentCount() if container is an instance of JMenu.

Parameters:
container - the JComponent container to get the number of Components of
Returns:
the number of Components in the specified container

getPluginComponents

public Iterable<PluginComponent> getPluginComponents()
Gets the PluginComponents of this PluginContainer.

Returns:
an Iterable over the PluginComponents of this PluginContainer

pluginComponentAdded

public void pluginComponentAdded(PluginComponentEvent event)
Implements PluginComponentListener.pluginComponentAdded(PluginComponentEvent).

Specified by:
pluginComponentAdded in interface PluginComponentListener
Parameters:
event - a PluginComponentEvent which specifies the PluginComponent which has been added

pluginComponentRemoved

public void pluginComponentRemoved(PluginComponentEvent event)
Implements PluginComponentListener.pluginComponentRemoved(PluginComponentEvent).

Specified by:
pluginComponentRemoved in interface PluginComponentListener
Parameters:
event - a PluginComponentEvent which specifies the PluginComponent which has been added

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.