Asserts non-display of any bundle shipped with SIP Communicator when the show system bundles property is not set. This is part of issue #482 .

cusax-fix
Emil Ivov 17 years ago
parent 1a0f7be8dc
commit 89e81b89ec

@ -18,11 +18,11 @@
* The <tt>ContactListCellRenderer</tt> is the custom cell renderer used in the
* SIP-Communicator's <tt>ContactList</tt>. It extends JPanel instead of JLabel,
* which allows adding different buttons and icons to the contact cell.
* The cell border and background are repainted.
*
* The cell border and background are repainted.
*
* @author Yana Stamcheva
*/
public class PluginListCellRenderer extends JPanel
public class PluginListCellRenderer extends JPanel
implements TableCellRenderer
{
/**
@ -36,28 +36,28 @@ public class PluginListCellRenderer extends JPanel
*/
private static final Color SELECTED_END_COLOR
= new Color(Resources.getColor("service.gui.GRADIENT_LIGHT_COLOR"));
private JPanel mainPanel = new JPanel(new BorderLayout());
private JPanel nameVersionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
private JLabel nameLabel = new JLabel();
private JLabel versionLabel = new JLabel();
private JLabel descriptionLabel = new JLabel();
private JLabel stateLabel = new JLabel();
private JLabel iconLabel = new JLabel();
private JLabel systemLabel
= new JLabel("( " + Resources.getString("plugin.pluginmanager.SYSTEM") + " )");
private boolean isSelected = false;
private String direction;
private String direction;
/**
* Initialize the panel containing the node.
*/
@ -66,36 +66,36 @@ public PluginListCellRenderer()
super(new BorderLayout(8, 8));
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
this.setBackground(Color.WHITE);
this.setOpaque(true);
this.mainPanel.setOpaque(false);
this.nameVersionPanel.setOpaque(false);
this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
this.nameLabel.setIconTextGap(2);
this.nameLabel.setFont(this.getFont().deriveFont(Font.BOLD));
this.systemLabel.setFont(this.getFont().deriveFont(Font.BOLD));
this.nameVersionPanel.add(nameLabel);
this.nameVersionPanel.add(versionLabel);
this.mainPanel.add(nameVersionPanel, BorderLayout.NORTH);
this.mainPanel.add(descriptionLabel, BorderLayout.CENTER);
this.add(iconLabel, BorderLayout.WEST);
this.add(mainPanel, BorderLayout.CENTER);
this.add(stateLabel, BorderLayout.WEST);
}
/**
* Implements the <tt>ListCellRenderer</tt> method.
*
*
* Returns this panel that has been configured to display the meta contact
* and meta contact group cells.
*/
@ -132,14 +132,11 @@ public Component getTableCellRendererComponent(JTable table, Object value,
if(stateIcon != null)
this.stateLabel.setIcon(stateIcon);
Object sysBundleProp
= bundle.getHeaders().get("System-Bundle");
this.nameVersionPanel.remove(systemLabel);
if(sysBundleProp != null && sysBundleProp.equals("yes"))
if(PluginManagerActivator.isSystemBundle(bundle))
this.nameVersionPanel.add(systemLabel);
this.isSelected = isSelected;
return this;
@ -167,10 +164,10 @@ private ImageIcon getStateIcon(int state)
}
return null;
}
/**
* Paint a background for all groups and a round blue border and background
* when a cell is selected.
* when a cell is selected.
*/
public void paintComponent(Graphics g) {
super.paintComponent(g);
@ -188,10 +185,10 @@ public void paintComponent(Graphics g) {
this.getHeight(),
SELECTED_END_COLOR);
g2.setPaint(p);
g2.setPaint(p);
g2.fillRoundRect(1, 1, this.getWidth(), this.getHeight() - 1, 7, 7);
}
g2.setColor(SELECTED_START_COLOR);
g2.drawLine(0, this.getHeight() - 1,
this.getWidth(), this.getHeight() - 1);

@ -1,6 +1,6 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
*
* Distributable under LGPL license. See terms of license at gnu.org.
*/
@ -13,7 +13,7 @@
/**
* The <tt>BundleActivator</tt> of the PluginManager plugin.
*
*
* @author Yana Stamcheva
*/
public class PluginManagerActivator
@ -49,7 +49,7 @@ 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()
@ -70,7 +70,7 @@ public static UIService getUIService()
/**
* Returns the <tt>ConfigurationService</tt> obtained from the bundle
* context.
*
*
* @return the <tt>ConfigurationService</tt> obtained from the bundle
* context
*/
@ -89,4 +89,31 @@ public static ConfigurationService getConfigurationService()
return configService;
}
/**
* Determines whether <tt>bundle</tt> is system or not. We consider system
* bundles those that we have explicitly marked as such with the
* <tt>System-Bundle</tt> manifest property or those that belong to the
* Apache framework itself.
*
* @param bundle the bundle that we need to determine as system or not.
* @return true if <tt>bundle</tt> is a system bundle and <tt>false</tt>
* otherwise.
*/
public static boolean isSystemBundle(Bundle bundle)
{
if (bundle.getBundleId() <= 1)
{
//this is one of the felix bundles
return true;
}
Object sysBundleProp = bundle.getHeaders().get("System-Bundle");
//ignore if this is a system bundle
if(sysBundleProp != null && sysBundleProp.equals("yes"))
return true;
return false;
}
}

@ -64,10 +64,7 @@ public int getRowCount()
{
Bundle bundle = bundles[i];
Object sysBundleProp
= bundle.getHeaders().get("System-Bundle");
if(sysBundleProp == null || !sysBundleProp.equals("yes"))
if(!PluginManagerActivator.isSystemBundle(bundle))
bundlesSize++;
}
return bundlesSize;
@ -100,11 +97,7 @@ public boolean contains(Bundle bundle)
return true;
else
{
Object sysBundleProp
= bundle.getHeaders().get("System-Bundle");
return (sysBundleProp == null || !sysBundleProp
.equals("yes"));
return (!PluginManagerActivator.isSystemBundle(bundle));
}
}
}
@ -148,11 +141,8 @@ public Object getValueAt(int row, int column)
for(int i = 0; i < bundles.length; i++)
{
Object sysBundleProp
= bundles[i].getHeaders().get("System-Bundle");
//ignore if this is a system bundle
if(sysBundleProp != null && sysBundleProp.equals("yes"))
if(PluginManagerActivator.isSystemBundle(bundles[i]))
continue;
if(bundleCounter == row)

Loading…
Cancel
Save