diff options
author | Yana Stamcheva <yana@jitsi.org> | 2008-09-08 19:20:41 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2008-09-08 19:20:41 +0000 |
commit | 3070baaf1ca7bcf747c4683df5532a71aa73768c (patch) | |
tree | c10ab02081671e35933786b5a226a5bc49806662 /src/net/java/sip/communicator/plugin/pluginmanager | |
parent | bd1f93701c44cc4a1c9e5f95e62570a21ec55d1a (diff) | |
download | jitsi-3070baaf1ca7bcf747c4683df5532a71aa73768c.zip jitsi-3070baaf1ca7bcf747c4683df5532a71aa73768c.tar.gz jitsi-3070baaf1ca7bcf747c4683df5532a71aa73768c.tar.bz2 |
- Revised status panel interface.
- Revised contact list interface.
- New chat rooms interface.
- Main tabbed pane removed.
- Revised call management in the GUI.
- Some more gui modifications.
Diffstat (limited to 'src/net/java/sip/communicator/plugin/pluginmanager')
7 files changed, 464 insertions, 47 deletions
diff --git a/src/net/java/sip/communicator/plugin/pluginmanager/NewBundleDialog.java b/src/net/java/sip/communicator/plugin/pluginmanager/NewBundleDialog.java index 25b9d44..c57bc7d 100644 --- a/src/net/java/sip/communicator/plugin/pluginmanager/NewBundleDialog.java +++ b/src/net/java/sip/communicator/plugin/pluginmanager/NewBundleDialog.java @@ -41,25 +41,25 @@ public class NewBundleDialog public NewBundleDialog () { this.mainPanel.setPreferredSize(new Dimension(450, 150)); - + this.getContentPane().add(mainPanel); - + this.mainPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8)); this.mainPanel.add(dataPanel, BorderLayout.NORTH); - + this.mainPanel.add(buttonsPanel, BorderLayout.SOUTH); - + this.buttonsPanel.add(installButton); this.buttonsPanel.add(cancelButton); - + this.installButton.addActionListener(this); this.cancelButton.addActionListener(this); this.fileChooserButton.addActionListener(this); - + this.dataPanel.add(bundlePathLabel, BorderLayout.WEST); - + this.dataPanel.add(bundlePathField, BorderLayout.CENTER); - + this.dataPanel.add(fileChooserButton, BorderLayout.EAST); } @@ -74,7 +74,7 @@ public class NewBundleDialog try { PluginManagerActivator.bundleContext - .installBundle(bundlePathField.getText(), null); + .installBundle(bundlePathField.getText()); } catch (BundleException ex) { @@ -83,6 +83,10 @@ public class NewBundleDialog .showMessagePopupDialog(ex.getMessage(), "Error", PopupDialog.ERROR_MESSAGE); } + catch (Throwable ex) + { + ex.printStackTrace(); + } finally { dispose(); diff --git a/src/net/java/sip/communicator/plugin/pluginmanager/PluginListCellRenderer.java b/src/net/java/sip/communicator/plugin/pluginmanager/PluginListCellRenderer.java index b633664..795d8d2 100644 --- a/src/net/java/sip/communicator/plugin/pluginmanager/PluginListCellRenderer.java +++ b/src/net/java/sip/communicator/plugin/pluginmanager/PluginListCellRenderer.java @@ -101,39 +101,40 @@ public class PluginListCellRenderer extends JPanel */ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) - { + { Bundle bundle = (Bundle) value; - + Object bundleName = bundle.getHeaders().get(Constants.BUNDLE_NAME); Object bundleVersion = bundle.getHeaders().get(Constants.BUNDLE_VERSION); Object bundleDescription = bundle.getHeaders().get(Constants.BUNDLE_DESCRIPTION); + Object bundleIconPath = bundle.getHeaders().get("Bundle-Icon-Path"); Icon stateIcon = getStateIcon(bundle.getState()); - + if(bundleName != null) this.nameLabel.setText(bundleName.toString()); else this.nameLabel.setText("unknown"); - + if(bundleVersion != null) this.versionLabel.setText(bundleVersion.toString()); else this.versionLabel.setText(""); - + if(bundleDescription != null) this.descriptionLabel.setText(bundleDescription.toString()); else this.descriptionLabel.setText(""); - + if(stateIcon != null) this.stateLabel.setIcon(stateIcon); - + Object sysBundleProp = bundle.getHeaders().get("System-Bundle"); - + this.nameVersionPanel.remove(systemLabel); if(sysBundleProp != null && sysBundleProp.equals("yes")) diff --git a/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerActivator.java b/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerActivator.java index ab1ce55..8c02d12 100644 --- a/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerActivator.java +++ b/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerActivator.java @@ -1,8 +1,7 @@ /* * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. - * - * Distributable under LGPL license. - * See terms of license at gnu.org. + * + * Distributable under LGPL license. See terms of license at gnu.org. */ package net.java.sip.communicator.plugin.pluginmanager; @@ -17,17 +16,19 @@ import org.osgi.framework.*; * * @author Yana Stamcheva */ -public class PluginManagerActivator implements BundleActivator +public class PluginManagerActivator + implements BundleActivator { public static BundleContext bundleContext; - + private static UIService uiService; - + private static ConfigurationService configService; - + /** - * Starts this bundle and adds the <td>PluginManagerConfigForm</tt> contained - * in it to the configuration window obtained from the <tt>UIService</tt>. + * Starts this bundle and adds the + * <td>PluginManagerConfigForm</tt> contained in it to the configuration + * window obtained from the <tt>UIService</tt>. */ public void start(BundleContext bc) throws Exception { @@ -35,41 +36,55 @@ public class PluginManagerActivator implements BundleActivator PluginManagerConfigForm pluginManager = new PluginManagerConfigForm(); - bundleContext.registerService( ConfigurationForm.class.getName(), - pluginManager, - null); + bundleContext.registerService(ConfigurationForm.class.getName(), + pluginManager, null); } /** * Stops this bundles. */ public void stop(BundleContext arg0) throws Exception - { + { } - + /** * Returns the <tt>UIService</tt> obtained from the bundle context. + * * @return the <tt>UIService</tt> obtained from the bundle context */ public static UIService getUIService() { + if (uiService == null) + { + ServiceReference uiReference = + bundleContext.getServiceReference(UIService.class.getName()); + + uiService = + (UIService) bundleContext + .getService(uiReference); + } + return uiService; } - /** * Returns the <tt>ConfigurationService</tt> obtained from the bundle * context. + * * @return the <tt>ConfigurationService</tt> obtained from the bundle - * context + * context */ - public static ConfigurationService getConfigurationService() { - if(configService == null) { - ServiceReference configReference = bundleContext - .getServiceReference(ConfigurationService.class.getName()); + public static ConfigurationService getConfigurationService() + { + if (configService == null) + { + ServiceReference configReference = + bundleContext.getServiceReference(ConfigurationService.class + .getName()); - configService = (ConfigurationService) bundleContext - .getService(configReference); + configService = + (ConfigurationService) bundleContext + .getService(configReference); } return configService; diff --git a/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerConfigForm.java.mine b/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerConfigForm.java.mine new file mode 100644 index 0000000..16dd32e --- /dev/null +++ b/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerConfigForm.java.mine @@ -0,0 +1,171 @@ +/* + * 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.pluginmanager; + +import java.awt.*; + +import javax.swing.*; +import javax.swing.event.*; +import javax.swing.table.*; + +import net.java.sip.communicator.service.gui.*; + +import org.osgi.framework.*; + +/** + * The <tt>ConfigurationForm</tt> that would be added in the user interface + * configuration window. It contains a list of all installed plug-ins. Allows + * installing new plugins and manage the existing once. + * + * @author Yana Stamcheva + */ +public class PluginManagerConfigForm + extends JPanel + implements ConfigurationForm +{ + private JScrollPane pluginListScrollPane = new JScrollPane(); + + private JTable pluginTable = new JTable(); + + private PluginTableModel tableModel = new PluginTableModel(); + + private ManageButtonsPanel buttonsPanel; + + public PluginManagerConfigForm() + { + super(new BorderLayout()); + + pluginTable.setModel(tableModel); + + TableColumn col = pluginTable.getColumnModel().getColumn(0); + col.setCellRenderer(new PluginListCellRenderer()); + + PluginListSelectionListener selectionListener + = new PluginListSelectionListener(); + + pluginTable.getSelectionModel() + .addListSelectionListener(selectionListener); + pluginTable.getColumnModel().getSelectionModel() + .addListSelectionListener(selectionListener); + + pluginTable.setRowHeight(48); + + pluginTable.setBorder( + BorderFactory.createEmptyBorder(8, 8, 8, 8)); + + pluginTable.setTableHeader(null); + + buttonsPanel = new ManageButtonsPanel(pluginTable); + + this.add(pluginListScrollPane, BorderLayout.CENTER); + + this.add(buttonsPanel, BorderLayout.EAST); + + + pluginListScrollPane.getViewport().add(pluginTable); + + pluginListScrollPane.setHorizontalScrollBarPolicy( + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + + pluginListScrollPane.getVerticalScrollBar().setUnitIncrement(30); + + PluginManagerActivator.bundleContext + .addBundleListener(new PluginListBundleListener()); + } + + /** + * Listens for events triggered when a selection is made in the plugin list. + */ + private class PluginListSelectionListener implements ListSelectionListener + { + public void valueChanged(ListSelectionEvent e) + { + int selectedRow = pluginTable.getSelectedRow(); + + if(selectedRow == -1) + return; + + Bundle selectedBundle + = (Bundle) pluginTable.getValueAt(selectedRow, 0); + + Object sysBundleProp + = selectedBundle.getHeaders().get("System-Bundle"); + + if(sysBundleProp != null && sysBundleProp.equals("yes")) + buttonsPanel.enableUninstallButton(false); + else + buttonsPanel.enableUninstallButton(true); + + if(selectedBundle.getState() == Bundle.ACTIVE) + { + if(sysBundleProp != null && sysBundleProp.equals("yes")) + buttonsPanel.enableDeactivateButton(false); + else + buttonsPanel.enableDeactivateButton(true); + + buttonsPanel.enableActivateButton(false); + } + else + { + buttonsPanel.enableActivateButton(true); + buttonsPanel.enableDeactivateButton(false); + } + } + } + + /** + * Listens for <tt>BundleEvents</tt> triggered by the bundle context. + */ + private class PluginListBundleListener implements BundleListener + { + public void bundleChanged(BundleEvent event) + { + tableModel.update(); + + if(event.getType() == BundleEvent.INSTALLED) + { + pluginTable.scrollRectToVisible(new Rectangle( + 0, pluginTable.getHeight(), + 1, pluginTable.getHeight())); + } + } + } + + /** + * Implements the <tt>ConfigurationForm.getTitle()</tt> method. Returns the + * title of this configuration form. + */ + public String getTitle() + { + return Resources.getString("plugins"); + } + + /** + * Implements the <tt>ConfigurationForm.getIcon()</tt> method. Returns the + * icon of this configuration form. + */ + public byte[] getIcon() + { + return Resources.getResources() + .getImageInBytes("pluginIconPluginManager"); + } + + /** + * Implements the <tt>ConfigurationForm.getForm()</tt> method. Returns the + * component corresponding to this configuration form. + */ + public Object getForm() + { + return this; + } + + public int getIndex() + { + return -1; + } +} diff --git a/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerConfigForm.java.r4302 b/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerConfigForm.java.r4302 new file mode 100644 index 0000000..85f4e83 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerConfigForm.java.r4302 @@ -0,0 +1,171 @@ +/* + * 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.pluginmanager; + +import java.awt.*; + +import javax.swing.*; +import javax.swing.event.*; +import javax.swing.table.*; + +import net.java.sip.communicator.service.gui.*; + +import org.osgi.framework.*; + +/** + * The <tt>ConfigurationForm</tt> that would be added in the user interface + * configuration window. It contains a list of all installed plug-ins. Allows + * installing new plugins and manage the existing once. + * + * @author Yana Stamcheva + */ +public class PluginManagerConfigForm + extends JPanel + implements ConfigurationForm +{ + private JScrollPane pluginListScrollPane = new JScrollPane(); + + private JTable pluginTable = new JTable(); + + private PluginTableModel tableModel = new PluginTableModel(); + + private ManageButtonsPanel buttonsPanel; + + public PluginManagerConfigForm() + { + super(new BorderLayout()); + + pluginTable.setModel(tableModel); + + TableColumn col = pluginTable.getColumnModel().getColumn(0); + col.setCellRenderer(new PluginListCellRenderer()); + + PluginListSelectionListener selectionListener + = new PluginListSelectionListener(); + + pluginTable.getSelectionModel() + .addListSelectionListener(selectionListener); + pluginTable.getColumnModel().getSelectionModel() + .addListSelectionListener(selectionListener); + + pluginTable.setRowHeight(48); + + pluginTable.setBorder( + BorderFactory.createEmptyBorder(8, 8, 8, 8)); + + pluginTable.setTableHeader(null); + + buttonsPanel = new ManageButtonsPanel(pluginTable); + + this.add(pluginListScrollPane, BorderLayout.CENTER); + + this.add(buttonsPanel, BorderLayout.EAST); + + + pluginListScrollPane.getViewport().add(pluginTable); + + pluginListScrollPane.setHorizontalScrollBarPolicy( + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + + pluginListScrollPane.getVerticalScrollBar().setUnitIncrement(30); + + PluginManagerActivator.bundleContext + .addBundleListener(new PluginListBundleListener()); + } + + /** + * Listens for events triggered when a selection is made in the plugin list. + */ + private class PluginListSelectionListener implements ListSelectionListener + { + public void valueChanged(ListSelectionEvent e) + { + int selectedRow = pluginTable.getSelectedRow(); + + if(selectedRow == -1) + return; + + Bundle selectedBundle + = (Bundle) pluginTable.getValueAt(selectedRow, 0); + + Object sysBundleProp + = selectedBundle.getHeaders().get("System-Bundle"); + + if(sysBundleProp != null && sysBundleProp.equals("yes")) + buttonsPanel.enableUninstallButton(false); + else + buttonsPanel.enableUninstallButton(true); + + if(selectedBundle.getState() == Bundle.ACTIVE) + { + if(sysBundleProp != null && sysBundleProp.equals("yes")) + buttonsPanel.enableDeactivateButton(false); + else + buttonsPanel.enableDeactivateButton(true); + + buttonsPanel.enableActivateButton(false); + } + else + { + buttonsPanel.enableActivateButton(true); + buttonsPanel.enableDeactivateButton(false); + } + } + } + + /** + * Listens for <tt>BundleEvents</tt> triggered by the bundle context. + */ + private class PluginListBundleListener implements BundleListener + { + public void bundleChanged(BundleEvent event) + { + tableModel.update(); + + if(event.getType() == BundleEvent.INSTALLED) + { + pluginTable.scrollRectToVisible(new Rectangle( + 0, pluginTable.getHeight(), + 1, pluginTable.getHeight())); + } + } + } + + /** + * Implements the <tt>ConfigurationForm.getTitle()</tt> method. Returns the + * title of this configuration form. + */ + public String getTitle() + { + return Resources.getString("plugins"); + } + + /** + * Implements the <tt>ConfigurationForm.getIcon()</tt> method. Returns the + * icon of this configuration form. + */ + public byte[] getIcon() + { + return Resources.getResources() + .getImageInBytes("pluginIconPluginManager"); + } + + /** + * Implements the <tt>ConfigurationForm.getForm()</tt> method. Returns the + * component corresponding to this configuration form. + */ + public Object getForm() + { + return this; + } + + public int getIndex() + { + return -1; + } +} diff --git a/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerConfigForm.java.r4361 b/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerConfigForm.java.r4361 new file mode 100644 index 0000000..3c0fb88 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerConfigForm.java.r4361 @@ -0,0 +1,55 @@ +/* + * 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.pluginmanager; + +import net.java.sip.communicator.service.gui.*; + +/** + * The <tt>ConfigurationForm</tt> that would be added in the user interface + * configuration window. It contains a list of all installed plug-ins. Allows + * installing new plugins and managing the existing ones. + * + * @author Yana Stamcheva + * @author Lubomir Marinov + */ +public class PluginManagerConfigForm + implements ConfigurationForm +{ + + /** + * Implements the <tt>ConfigurationForm.getTitle()</tt> method. Returns the + * title of this configuration form. + */ + public String getTitle() + { + return Resources.getString("plugins"); + } + + /** + * Implements the <tt>ConfigurationForm.getIcon()</tt> method. Returns the + * icon of this configuration form. + */ + public byte[] getIcon() + { + return Resources.getResources().getImageInBytes( + "pluginIconPluginManager"); + } + + /** + * Implements the <tt>ConfigurationForm.getForm()</tt> method. Returns the + * component corresponding to this configuration form. + */ + public Object getForm() + { + return new PluginManagerPanel(); + } + + public int getIndex() + { + return -1; + } +} diff --git a/src/net/java/sip/communicator/plugin/pluginmanager/PluginTableModel.java b/src/net/java/sip/communicator/plugin/pluginmanager/PluginTableModel.java index ac5afa7..29b5443 100644 --- a/src/net/java/sip/communicator/plugin/pluginmanager/PluginTableModel.java +++ b/src/net/java/sip/communicator/plugin/pluginmanager/PluginTableModel.java @@ -141,21 +141,21 @@ public class PluginTableModel extends AbstractTableModel { showSystem = showSystemBundles; } - + if(showSystem) return bundles[row]; else { int bundleCounter = 0; - - for(int i = 0; i < bundles.length; i++) - { - if(bundleCounter == row) - return bundles[i]; - + + for(int i = 0; i < bundles.length; i++) + { + if(bundleCounter == row) + return bundles[i]; + Object sysBundleProp = bundles[i+1].getHeaders().get("System-Bundle"); - + if(sysBundleProp == null || !sysBundleProp.equals("yes")) bundleCounter++; } |