mirror of https://github.com/sipwise/jitsi.git
- plugin component listener and events were used only in the implementation, so I have moved them there
- Introduced PluginComponent interface to be implemented by all modules that would like add a component( button, menu item, etc.) in the gui.cusax-fix
parent
a58a2d587e
commit
834eabfa77
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.impl.gui.event;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
|
||||
import net.java.sip.communicator.service.gui.*;
|
||||
import net.java.sip.communicator.service.gui.Container;
|
||||
|
||||
/**
|
||||
* The <tt>PluginComponentEvent</tt>
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public class PluginComponentEvent
|
||||
extends EventObject
|
||||
{
|
||||
|
||||
private int eventID = -1;
|
||||
|
||||
/**
|
||||
* Indicates that the PluginComponentEvent instance was triggered by
|
||||
* adding a plugin component.
|
||||
*/
|
||||
public static final int PLUGIN_COMPONENT_ADDED = 1;
|
||||
|
||||
/**
|
||||
* Indicates that the MetaContactEvent instance was triggered by the
|
||||
* removal of an existing MetaContact.
|
||||
*/
|
||||
public static final int PLUGIN_COMPONENT_REMOVED = 2;
|
||||
|
||||
/**
|
||||
* Creates a new PluginComponentEvent according to the specified
|
||||
* parameters.
|
||||
* @param pluginComponent The pluginComponent that is added to the container.
|
||||
* @param eventID one of the PLUGIN_COMPONENT_XXX static fields indicating
|
||||
* the nature of the event.
|
||||
*/
|
||||
public PluginComponentEvent(PluginComponent pluginComponent,
|
||||
int eventID)
|
||||
{
|
||||
super(pluginComponent);
|
||||
this.eventID = eventID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <tt>PluginComponent</tt> associated with this event.
|
||||
* @return the <tt>PluginComponent</tt> associated with this event
|
||||
*/
|
||||
public PluginComponent getPluginComponent()
|
||||
{
|
||||
return (PluginComponent) getSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an event id specifying whether the type of this event
|
||||
* (PLUGIN_COMPONENT_ADDED or PLUGIN_COMPONENT_REMOVED)
|
||||
*
|
||||
* @return one of the PLUGIN_COMPONENT_XXX int fields of this class.
|
||||
*/
|
||||
public int getEventID()
|
||||
{
|
||||
return eventID;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.impl.gui.event;
|
||||
|
||||
import java.util.*;
|
||||
/**
|
||||
* Listens for all events caused by adding or removing of a plugin component.
|
||||
*
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public interface PluginComponentListener
|
||||
extends EventListener {
|
||||
|
||||
/**
|
||||
* Indicates that a plugin component has been successfully added
|
||||
* to the container.
|
||||
* @param event the PluginComponentEvent containing the corresponding
|
||||
* plugin component
|
||||
*/
|
||||
public void pluginComponentAdded(PluginComponentEvent event);
|
||||
|
||||
/**
|
||||
* Indicates that a plugin component has been successfully removed
|
||||
* from the container.
|
||||
* @param event the PluginComponentEvent containing the corresponding
|
||||
* plugin component
|
||||
*/
|
||||
public void pluginComponentRemoved(PluginComponentEvent event);
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.plugin.branding;
|
||||
|
||||
import java.awt.event.*;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import net.java.sip.communicator.service.contactlist.*;
|
||||
import net.java.sip.communicator.service.gui.*;
|
||||
|
||||
public class AboutWindowPluginComponent
|
||||
implements PluginComponent
|
||||
{
|
||||
private JMenuItem aboutMenuItem
|
||||
= new JMenuItem(Resources.getString("aboutMenuEntry"));
|
||||
|
||||
public AboutWindowPluginComponent()
|
||||
{
|
||||
aboutMenuItem.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
AboutWindow aboutWindow = new AboutWindow(null);
|
||||
aboutWindow.setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Object getComponent()
|
||||
{
|
||||
return aboutMenuItem;
|
||||
}
|
||||
|
||||
public String getConstraints()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Container getContainer()
|
||||
{
|
||||
return Container.CONTAINER_HELP_MENU;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return Resources.getString("aboutMenuEntry");
|
||||
}
|
||||
|
||||
public void setCurrentContact(MetaContact metaContact)
|
||||
{
|
||||
}
|
||||
|
||||
public void setCurrentContactGroup(MetaContactGroup metaGroup)
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.service.gui;
|
||||
|
||||
import net.java.sip.communicator.service.contactlist.*;
|
||||
|
||||
/**
|
||||
* The <tt>PluginComponent</tt> is an interface meant to be implemented by
|
||||
* all plugins that would like to add a user interface component to a particular
|
||||
* container in the graphical user interface (GUI). In order to appear in the
|
||||
* GUI all implementations of this interface should be registered through the
|
||||
* OSGI bundle context.
|
||||
* <p>
|
||||
* All components interested in the current contact or group that they're
|
||||
* dealing with (i.g. the one selected in the contact list for example), should
|
||||
* implement the <tt>setCurrentContact</tt> and
|
||||
* <tt>setCurrentContactGroup</tt> methods.
|
||||
* <p>
|
||||
* Note that <tt>getComponent</tt> should return a valid AWT, SWT or Swing
|
||||
* control in order to appear properly in the GUI.
|
||||
*
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public interface PluginComponent
|
||||
{
|
||||
/**
|
||||
* Returns the name of this plugin component. This name could be used as a
|
||||
* label when the component is added to a container, which requires a title.
|
||||
* A container that could request a name is for example a tabbed pane.
|
||||
*
|
||||
* @return the name of this plugin component
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* Returns the identifier of the container, where we would like to add
|
||||
* our control. All possible container identifiers are defined in the
|
||||
* <tt>Container</tt> class. If the <tt>Container</tt> returned by this
|
||||
* method is not supported by the current UI implementation the plugin won't
|
||||
* be added.
|
||||
*
|
||||
* @return the container, where we would like to add our control.
|
||||
*/
|
||||
public Container getContainer();
|
||||
|
||||
/**
|
||||
* Returns the constraints, which will indicate to the container, where this
|
||||
* component should be added. All constraints are defined in the Container
|
||||
* class and are as follows: START, END, TOP, BOTTOM, LEFT, RIGHT.
|
||||
*
|
||||
* @return the constraints, which will indicate to the container, where this
|
||||
* component should be added.
|
||||
*/
|
||||
public String getConstraints();
|
||||
|
||||
/**
|
||||
* Returns the component that should be added. This method should return a
|
||||
* valid AWT, SWT or Swing object in order to appear properly in the user
|
||||
* interface.
|
||||
*
|
||||
* @return the component that should be added.
|
||||
*/
|
||||
public Object getComponent();
|
||||
|
||||
/**
|
||||
* Sets the current meta contact. Meant to be used by plugin components that
|
||||
* are interested of the current contact. The current contact could be the
|
||||
* contact currently selected in the contact list or the contact for the
|
||||
* currently selected chat, etc. It depends on the container, where this
|
||||
* component is meant to be added.
|
||||
*
|
||||
* @param metaContact the current meta contact
|
||||
*/
|
||||
public void setCurrentContact(MetaContact metaContact);
|
||||
|
||||
/**
|
||||
* Sets the current meta group. Meant to be used by plugin components that
|
||||
* are interested of the current meta group. The current group is always
|
||||
* the currently selected group in the contact list. If the group passed
|
||||
* here is null, this means that no group is selected.
|
||||
*
|
||||
* @param metaGroup the current meta contact group
|
||||
*/
|
||||
public void setCurrentContactGroup(MetaContactGroup metaGroup);
|
||||
}
|
||||
Loading…
Reference in new issue