ContactItem newsData = null; while (contactsCursor.moveToNext()) { newsData = new ContactItem(); newsData.setName(contactsCursor.getString(0)); newsData.setPhone(contactsCursor.getString(1)); newsData.setMobile(contactsCursor.getString(2)); newsData.setEmail(contactsCursor.getString(3)); listMockData.add(newsData); }
@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; } }
/** * Update avatar icon. */ public void updateAvatarInSideIcon() { try { final URL url = getAvatarURL(); if (url != null) { if (!avatarsShowing) { setSideIcon(null); } else { ImageIcon icon = new ImageIcon(url); icon = GraphicUtils.scale(icon, iconSize, iconSize); setSideIcon(icon); } } } catch (MalformedURLException e) { Log.error(e); } }
/** * Sets the status label text based on the users status. * * @param status the users status. */ public void setStatusText(String status) { setStatus(status); if (ModelUtil.hasLength(status)) { getDescriptionLabel().setText(" - " + status); } else { getDescriptionLabel().setText(""); } }
if(contactItem.getContactName()!=null && contactItem.getContactName().length()>2){ contactNameInCapital = contactItem.getContactName().substring(0,1).toUpperCase(); latestPhoneContacts.add(new ContactItem(contactNameInCapital.substring(0,1))); latestPhoneContacts.add(contactItem);
Icon icon; if (contactItem != null) { icon = contactItem.getIcon(); if (icon == null) { icon = SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON); JLabel label = new JLabel(); label.setText(contactItem.getDisplayName()); label.setIcon(icon);
setLayout(new GridBagLayout()); presence = new Presence(Presence.Type.unavailable); displayNameLabel = new JLabel(); descriptionLabel = new JLabel(); imageLabel = new JLabel(); specialImageLabel = new JLabel(); sideIcon = new JLabel(); this.setOpaque(true); add(imageLabel, new GridBagConstraints(0, 0, 1, 2, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0)); add(displayNameLabel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 0), 0, 0)); add(descriptionLabel, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 2, 0), 0, 0)); add(specialImageLabel, new GridBagConstraints(3, 0, 1, 2, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 0), 0, 0)); add(sideIcon, new GridBagConstraints(4, 0, 1, 2, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 0), 0, 0)); setDisplayName();
nicknameLabel.setText(contactItem.getDisplayName()); String status = contactItem.getStatus(); if (!ModelUtil.hasLength(status)) { if (contactItem.getPresence() == null || contactItem.getPresence().getType() == Presence.Type.unavailable) { status = Res.getString("offline"); if (status.equals(Res.getString("offline")) || contactItem.getPresence().isAway()) { client = contactItem.getPresence().getFrom(); } else { client = contactItem.getJid(); } else if (contactItem.getPresence().isAway()) { status += "\n"; String time = ModelUtil.getTimeFromLong(idleTime); Log.warning( "Unable to get Last Activity from: " + contactItem.toString(), e1 ); Transport transport = TransportUtils.getTransport( XmppStringUtils.parseDomain(contactItem.getJID())); if (transport != null) { fullJIDLabel.setIcon(transport.getIcon()); String name = XmppStringUtils.parseLocalpart(contactItem.getJID()); name = XmppStringUtils.unescapeLocalpart(name); fullJIDLabel.setText(transport.getName() + " - " + name); String name = XmppStringUtils.unescapeLocalpart(contactItem.getJID()); fullJIDLabel.setText(name); fullJIDLabel.setIcon(null);
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()); if (!PresenceManager.isOnline(item.getJid().asBareJid())) { contactGroup.addOfflineContactItem(item.getAlias(), item.getNickname(), item.getJid(), null); final ContactGroup oldGroup = getContactGroup(item.getGroupName());
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); } }
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; } }
_showOffCheckbox.setVisible(false); ContactItem item = new ContactItem(group.getName(), null, null); _userList.add(item); Presence presence = PresenceManager.getPresence(entry.getJid()); if (presence.isAvailable()) { ContactItem item = new ContactItem(entry.getName(), null, entry.getJid()); item.setPresence(presence); _userList.add(item); } else if (_showOffCheckbox.isSelected()) { ContactItem item = new ContactItem(entry.getName(), null, entry.getJid()); item.setPresence(presence); _userList.add(item);
if (contact.getContactGroup()!=null) holder.contactIcon.setBackgroundResource(contact.getContactGroup().getIcon()); else holder.contactIcon.setBackgroundResource(contact.getIcon()); holder.contactName.setText(contact.getName()); holder.contactNumber.setText(contact.getNumber()); holder.contactDays.setText(Integer.toString(contact.getDays())); if (labels.get(position)!=null)
String contactName = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); if (Integer.parseInt(cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) { ContactItem contactItem = new ContactItem(); contactItem.setContactName(contactName); contactItem.setContactNumberMobile(phoneNo); Log.e(contactName + ": TYPE_MOBILE", " " + phoneNo); break; case ContactsContract.CommonDataKinds.Phone.TYPE_HOME: contactItem.setContactNumberMobile(phoneNo); Log.e(contactName + ": TYPE_HOME", " " + phoneNo); break; case ContactsContract.CommonDataKinds.Phone.TYPE_WORK: contactItem.setContactNumberMobile(phoneNo); Log.e(contactName + ": TYPE_WORK", " " + phoneNo); break; case ContactsContract.CommonDataKinds.Phone.TYPE_WORK_MOBILE: contactItem.setContactNumberMobile(phoneNo); Log.e(contactName + ": TYPE_WORK_MOBILE", " " + phoneNo); break; case Phone.TYPE_OTHER: contactItem.setContactNumberMobile(phoneNo); Log.e(contactName + ": TYPE_OTHER", " " + phoneNo); break; contactItem.setSelectedAddress(getContactPostalAddress(pCursor)); pCursor.close(); contactItems.add(contactItem);
SparkManager.getChatManager().activateChat(activeItem.getJid(), activeItem.getDisplayName()); String oldAlias = activeItem.getAlias(); String newAlias = JOptionPane.showInputDialog(this, Res.getString("label.rename.to") + ":", oldAlias); BareJid address = activeItem.getJid().asBareJid(); ContactGroup contactGroup = getContactGroup(activeItem.getGroupName()); ContactItem contactItem = contactGroup.getContactItemByDisplayName(activeItem.getDisplayName()); contactItem.setAlias(newAlias); ContactItem ci = cg.getContactItemByJID(user); if (ci != null) { ci.setAlias(newAlias);
for (ContactItem item : group.getContactItems()) if(item.isAvailable() && !onlineJIDs.contains(item.getJID())) CheckNode itemNode = new CheckNode(item.getDisplayName(), false, item.getIcon()); itemNode.setAssociatedObject(item.getJID()); groupNode.add(itemNode); nodes.add(itemNode); onlineJIDs.add(item.getJID()); CheckNode itemNode = new CheckNode(item.getDisplayName(), false, item.getIcon()); itemNode.setAssociatedObject(item.getJID()); groupNode.add(itemNode); nodes.add(itemNode); CheckNode itemNode = new CheckNode(item.getDisplayName(), false, item.getIcon()); itemNode.setAssociatedObject(item.getJID()); groupNode.add(itemNode); nodes.add(itemNode); if (node.getAssociatedObject().toString().equals(item.getJID())) { node.setSelected(true);
offlineGroup.addContactItem(contactItem); BareJid jid = contactItem.getJid().asBareJid(); Boolean isFiled = false; contactGroup.addOfflineContactItem(contactItem.getAlias(), contactItem.getNickname(), contactItem.getJid(), contactItem.getStatus()); getUnfiledGroup().addOfflineContactItem(contactItem.getAlias(), contactItem.getNickname(), contactItem.getJid(), contactItem.getStatus());
ContactItem c = new ContactItem(text); if (c.getIsValid()) {
ContactItem getContactByAddr(Context context, final SMSItem sms) { Uri personUri = Uri.withAppendedPath( ContactsContract.PhoneLookup.CONTENT_FILTER_URI, sms.mAddress); Cursor cur = context.getContentResolver().query(personUri, new String[] { PhoneLookup.DISPLAY_NAME }, null, null, null ); if( cur.moveToFirst() ) { int nameIdx = cur.getColumnIndex(PhoneLookup.DISPLAY_NAME); ContactItem item = new ContactItem(); item.mName = cur.getString(nameIdx); cur.close(); return item; } return null;
if (item != null) { try { avatarURL = item.getAvatarURL();