/** * Adds the plugin component given by <tt>event</tt> to this panel if it's its container. * * @param event the <tt>PluginComponentEvent</tt> that notified us */ public void pluginComponentAdded(PluginComponentEvent event) { PluginComponentFactory factory = event.getPluginComponentFactory(); // If the container id doesn't correspond to the id of the plugin // container we're not interested. if (!factory.getContainer().equals(Container.CONTAINER_CONTACT_LIST)) return; Object constraints = UIServiceImpl.getBorderLayoutConstraintsFromContainer(factory.getConstraints()); if (constraints == null) constraints = BorderLayout.SOUTH; PluginComponent pluginComponent = factory.getPluginComponentInstance(this); this.add((Component) pluginComponent.getComponent(), constraints); Object selectedValue = getContactList().getSelectedValue(); if (selectedValue instanceof MetaContact) { pluginComponent.setCurrentContact((MetaContact) selectedValue); } else if (selectedValue instanceof MetaContactGroup) { pluginComponent.setCurrentContactGroup((MetaContactGroup) selectedValue); } this.revalidate(); this.repaint(); }
/** * Removes the plugin component given by <tt>event</tt> if previously added in this panel. * * @param event the <tt>PluginComponentEvent</tt> that notified us */ public void pluginComponentRemoved(PluginComponentEvent event) { PluginComponentFactory factory = event.getPluginComponentFactory(); // If the container id doesn't correspond to the id of the plugin // container we're not interested. if (!factory.getContainer().equals(Container.CONTAINER_CONTACT_LIST)) return; this.remove((Component) factory.getPluginComponentInstance(this).getComponent()); }
/** * Implements {@link PluginComponentListener#pluginComponentRemoved(PluginComponentEvent)}. * * @param event a <tt>PluginComponentEvent</tt> which specifies the <tt>PluginComponent</tt> which * has been added */ public void pluginComponentRemoved(PluginComponentEvent event) { PluginComponent c = event.getPluginComponent(); if (c.getContainer().equals(containerId)) removePluginComponent(c); }
/** * Implements {@link PluginComponentListener#pluginComponentAdded(PluginComponentEvent)}. * * @param event a <tt>PluginComponentEvent</tt> which specifies the <tt>PluginComponent</tt> which * has been added */ public void pluginComponentAdded(PluginComponentEvent event) { PluginComponent c = event.getPluginComponent(); if (c.getContainer().equals(containerId)) addPluginComponent(c); }