|
|
|
|
@ -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);
|
|
|
|
|
|