diff options
author | Yana Stamcheva <yana@jitsi.org> | 2006-10-03 20:58:27 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2006-10-03 20:58:27 +0000 |
commit | f6fdcf2377ce9abe7c6eef0701fb60626b25faf8 (patch) | |
tree | cdbdbed05ef5c405ea4420fb5a49b2de45e3333d /src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListCellRenderer.java | |
parent | 1d3f8bb9e16e46752babeeb03837bc118f6a53a4 (diff) | |
download | jitsi-f6fdcf2377ce9abe7c6eef0701fb60626b25faf8.zip jitsi-f6fdcf2377ce9abe7c6eef0701fb60626b25faf8.tar.gz jitsi-f6fdcf2377ce9abe7c6eef0701fb60626b25faf8.tar.bz2 |
add index to protocol status icons
Diffstat (limited to 'src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListCellRenderer.java')
-rw-r--r-- | src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListCellRenderer.java | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListCellRenderer.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListCellRenderer.java index bc26cc3..b4bef06 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListCellRenderer.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListCellRenderer.java @@ -10,10 +10,12 @@ package net.java.sip.communicator.impl.gui.main.contactlist; import java.util.*; import java.awt.*; +import java.awt.image.*; import javax.swing.*; import net.java.sip.communicator.impl.gui.customcontrols.*; +import net.java.sip.communicator.impl.gui.main.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.protocol.*; @@ -41,14 +43,17 @@ public class ContactListCellRenderer extends JPanel private boolean isSelected = false; private boolean isLeaf = true; + + private MainFrame mainFrame; /** * Initialize the panel containing the node. */ - public ContactListCellRenderer() { + public ContactListCellRenderer(MainFrame mainFrame) { super(new BorderLayout()); + this.mainFrame = mainFrame; this.setBackground(Color.WHITE); this.buttonsPanel.setOpaque(false); @@ -109,9 +114,18 @@ public class ContactListCellRenderer extends JPanel = ImageLoader.getBytesInImage( protocolContact.getPresenceStatus().getStatusIcon()); + int providerIndex = mainFrame.getProviderIndex( + protocolContact.getProtocolProvider()); + + Image img; + if(providerIndex > 0) { + img = createIndexedImage(protocolStatusIcon, providerIndex); + } + else { + img = protocolStatusIcon; + } ContactProtocolButton contactProtocolButton - = new ContactProtocolButton(protocolStatusIcon, - protocolStatusIcon); + = new ContactProtocolButton(img, img); contactProtocolButton.setProtocolContact(protocolContact); @@ -163,6 +177,31 @@ public class ContactListCellRenderer extends JPanel return this; } + + /** + * Adds the protocol provider index to the given source image. + * @param sourceImage + * @param index + * @return + */ + private Image createIndexedImage(Image sourceImage, int index) + { + BufferedImage buffImage = new BufferedImage( + 22, 16, BufferedImage.TYPE_INT_ARGB); + + Graphics2D g = (Graphics2D)buffImage.getGraphics(); + AlphaComposite ac = + AlphaComposite.getInstance(AlphaComposite.SRC_OVER); + + AntialiasingManager.activateAntialiasing(g); + g.setColor(Color.DARK_GRAY); + g.setFont(Constants.FONT.deriveFont(Font.BOLD, 9)); + g.drawImage(sourceImage, 0, 0, null); + g.setComposite(ac); + g.drawString(new Integer(index).toString(), 14, 8); + + return buffImage; + } /** * Paint a background for all groups and a round blue border and background |