holder.contactIcon.setBackgroundResource(contact.getContactGroup().getIcon()); else holder.contactIcon.setBackgroundResource(contact.getIcon());
Icon icon; if (contactItem != null) { icon = contactItem.getIcon(); if (icon == null) { icon = SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON);
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } ContactItem contactItem = (ContactItem)value; setText(contactItem.getDisplayName()); if (contactItem.getIcon() == null) { setIcon(SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON)); } else { setIcon(contactItem.getIcon()); } setFont(contactItem.getNicknameLabel().getFont()); setForeground(contactItem.getForeground()); return this; } }
Icon icon; if (contactItem != null) { icon = contactItem.getIcon(); if (icon == null) { icon = SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON);
holder.contactIcon.setBackgroundResource(contact.getContactGroup().getIcon()); else holder.contactIcon.setBackgroundResource(contact.getIcon());
CheckNode itemNode = new CheckNode(item.getDisplayName(), false, item.getIcon()); itemNode.setAssociatedObject(item.getJID()); groupNode.add(itemNode); CheckNode itemNode = new CheckNode(item.getDisplayName(), false, item.getIcon()); itemNode.setAssociatedObject(item.getJID()); groupNode.add(itemNode); CheckNode itemNode = new CheckNode(item.getDisplayName(), false, item.getIcon()); itemNode.setAssociatedObject(item.getJID()); groupNode.add(itemNode);
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { basicPanelRenderer.getListCellRendererComponent(list, this, index, isSelected, cellHasFocus); ContactItem renderItem = (ContactItem)value; setFocusable(false); setNickname(renderItem.getNickname()); setAlias(renderItem.getAlias()); if (this.getDisplayName().trim().isEmpty()) { // Fallback hack to show something other than empty string. // JID can't be set after object creation, so alias is reset. setAlias(renderItem.getDisplayName()); } setIcon(renderItem.getIcon()); setStatus(renderItem.getStatus()); getNicknameLabel().setFont(renderItem.getNicknameLabel().getFont()); getNicknameLabel().setForeground(renderItem.getNicknameLabel().getForeground()); getDescriptionLabel().setFont(renderItem.getDescriptionLabel().getFont()); getDescriptionLabel().setText(renderItem.getDescriptionLabel().getText()); getSpecialImageLabel().setIcon(renderItem.getSpecialImageLabel().getIcon()); getSideIcon().setIcon(renderItem.getSideIcon().getIcon()); return this; } }
public void display(ContactGroup group, MouseEvent e) { int loc = group.getList().locationToIndex(e.getPoint()); ContactItem item = (ContactItem)group.getList().getModel().getElementAt(loc); if (item == null || item.getJID() == null) { return; } if (getContactItem() != null && getContactItem() == item) { return; } iconLabel.setIcon(item.getIcon()); Point point = group.getList().indexToLocation(loc); window.setFocusableWindowState(false); setContactItem(item); window.pack(); Point mainWindowLocation = SparkManager.getMainWindow().getLocationOnScreen(); Point listLocation = group.getList().getLocationOnScreen(); int x = (int)mainWindowLocation.getX() + SparkManager.getMainWindow().getWidth(); int y = (int) listLocation.getY() + (int) point.getY(); setWindowLocation(x, y); if (!window.isVisible()) { window.setVisible(true); } }
private void addContactItem(final ContactGroup contactGroup, final ContactItem item) { ContactItem newContact = UIComponentRegistry.createContactItem(Res.getString("group.empty"), null, null); newContact.setPresence(item.getPresence()); newContact.setIcon(item.getIcon()); newContact.getNicknameLabel().setFont(item.getNicknameLabel().getFont());
ContactItem newContact = UIComponentRegistry.createContactItem(item.getAlias(), item.getNickname(), item.getJid()); newContact.setPresence(item.getPresence()); newContact.setIcon(item.getIcon()); newContact.getNicknameLabel().setFont(item.getNicknameLabel().getFont()); boolean groupHadAvailableContacts = false;