public class VCardManager
extends java.lang.Object
Constructor and Description |
---|
VCardManager()
Initialize VCardManager.
|
Modifier and Type | Method and Description |
---|---|
void |
addToQueue(java.lang.String jid)
Adds a jid to lookup vCard.
|
void |
addVCard(java.lang.String jid,
org.jivesoftware.smackx.vcardtemp.packet.VCard vcard)
Adds a new vCard to the cache.
|
void |
addVCardListener(VCardListener listener)
Add
VCardListener . |
java.net.URL |
getAvatar(java.lang.String jid)
Returns the URL of the avatar image associated with the users JID.
|
static javax.swing.ImageIcon |
getAvatarIcon(org.jivesoftware.smackx.vcardtemp.packet.VCard vcard)
Returns the Avatar in the form of an
ImageIcon . |
java.net.URL |
getAvatarURL(java.lang.String jid) |
java.net.URL |
getAvatarURLIfAvailable(java.lang.String jid)
Get URL for avatar from vcard.
|
static java.lang.String |
getNumbersFromPhone(java.lang.String number)
Parses out the numbers only from a phone number.
|
org.jivesoftware.smackx.vcardtemp.packet.VCard |
getVCard()
Returns the VCard for this Spark user.
|
org.jivesoftware.smackx.vcardtemp.packet.VCard |
getVCard(java.lang.String jid)
Returns the VCard.
|
org.jivesoftware.smackx.vcardtemp.packet.VCard |
getVCard(java.lang.String jid,
boolean useCachedVCards)
Returns the VCard.
|
org.jivesoftware.smackx.vcardtemp.packet.VCard |
getVCardFromMemory(java.lang.String jid)
Loads the vCard from memory.
|
protected void |
notifyVCardListeners()
Notify all
VCardListener implementations. |
void |
reloadPersonalVCard()
Loads the vcard for this Spark user
|
org.jivesoftware.smackx.vcardtemp.packet.VCard |
reloadVCard(java.lang.String jid)
Forces a reload of a
VCard . |
void |
removeVCardListener(VCardListener listener)
Remove
VCardListener . |
static javax.swing.ImageIcon |
scale(javax.swing.ImageIcon icon)
Scales an image to the preferred avatar size.
|
org.jivesoftware.smackx.vcardtemp.packet.VCard |
searchPhoneNumber(java.lang.String phoneNumber)
Searches all vCards for a specified phone number.
|
void |
setPersonalVCard(org.jivesoftware.smackx.vcardtemp.packet.VCard vcard)
Sets the personal vcard of the user.
|
void |
viewFullProfile(java.lang.String jid,
javax.swing.JComponent parent)
Displays the full profile for a particular JID.
|
void |
viewProfile(java.lang.String jid,
javax.swing.JComponent parent)
Displays
VCardViewer for a particular JID. |
public void addToQueue(java.lang.String jid)
jid
- the jid to lookup.public void viewProfile(java.lang.String jid, javax.swing.JComponent parent)
VCardViewer
for a particular JID.jid
- the jid of the user to display.parent
- the parent component to use for displaying dialog.public void viewFullProfile(java.lang.String jid, javax.swing.JComponent parent)
jid
- the jid of the user to display.parent
- the parent component to use for displaying dialog.public org.jivesoftware.smackx.vcardtemp.packet.VCard getVCard()
public void reloadPersonalVCard()
public static javax.swing.ImageIcon getAvatarIcon(org.jivesoftware.smackx.vcardtemp.packet.VCard vcard)
ImageIcon
.vcard
- the vCard containing the avatar.public org.jivesoftware.smackx.vcardtemp.packet.VCard getVCard(java.lang.String jid)
jid
- the users jid.public org.jivesoftware.smackx.vcardtemp.packet.VCard getVCardFromMemory(java.lang.String jid)
jid
- the users jid.public org.jivesoftware.smackx.vcardtemp.packet.VCard getVCard(java.lang.String jid, boolean useCachedVCards)
jid
- the users jid.useCachedVCards
- true to check in cache and hdd, otherwise false will do a new
network vcard operation.public org.jivesoftware.smackx.vcardtemp.packet.VCard reloadVCard(java.lang.String jid)
VCard
. To load a VCard you should use
getVCard(String jid) instead. This method will perform a network lookup
which could take some time. If you're having problems with request
timeout you should also use getVCard(String jid). Use addToQueue(String
jid) if you want VCardManager to update the VCard by the given jid. The
method will block until the result is available or a timeout occurs.jid
- the jid of the user.public void addVCard(java.lang.String jid, org.jivesoftware.smackx.vcardtemp.packet.VCard vcard)
jid
- the jid of the user.vcard
- the users vcard to cache.public static javax.swing.ImageIcon scale(javax.swing.ImageIcon icon)
icon
- the icon to scale.public java.net.URL getAvatar(java.lang.String jid)
jid
- the jid of the user.public org.jivesoftware.smackx.vcardtemp.packet.VCard searchPhoneNumber(java.lang.String phoneNumber)
phoneNumber
- the phoneNumber.public static java.lang.String getNumbersFromPhone(java.lang.String number)
number
- the full phone number.public void setPersonalVCard(org.jivesoftware.smackx.vcardtemp.packet.VCard vcard)
vcard
- the users vCard.public java.net.URL getAvatarURL(java.lang.String jid)
public java.net.URL getAvatarURLIfAvailable(java.lang.String jid)
jid
- the users jidpublic void addVCardListener(VCardListener listener)
VCardListener
. Listens to the personalVCard.listener
- the listener to add.public void removeVCardListener(VCardListener listener)
VCardListener
.listener
- the listener to remove.protected void notifyVCardListeners()
VCardListener
implementations.