private void loadVCard() {
ConnectionManager man = ConnectionManager.getInstance();
VCard v;
try {
v = myself ? man.getVCard() : man.getVCard(JID);
}
catch(XMPPException xmp) {
JOptionPane.showMessageDialog(this.getRootPane(),
rb.getString("vCardLoadError"),
rb.getString("errorTitle"),
JOptionPane.ERROR_MESSAGE
);
xmp.printStackTrace(System.err);
this.dispose();
return;
}
textFirstName.setText(v.getFirstName());
textLastName.setText(v.getLastName());
textMiddleName.setText(v.getMiddleName());
textNickName.setText(v.getNickName());
textURL.setText(v.getField("URL"));
currentAvatarBytes = v.getAvatar();
if(currentAvatarBytes != null) {
ByteArrayInputStream bais = new ByteArrayInputStream(currentAvatarBytes);
try {
final Image image = ImageIO.read(bais);
avatar.setAvatar(image);
}
catch (IOException e) {
System.err.println("Nelze nacist avatar.");
e.printStackTrace(System.err);
}
} else {
avatar.setNoAvatar();
}
textTitle.setText(v.getField("TITLE"));
textDesc.setText(v.getField("DESC"));
textBDay.setText(v.getField("BDAY"));
textHomeEMail.setText(v.getEmailHome());
textHomePhone.setText(v.getPhoneHome("VOICE"));
textHomeStreet.setText(v.getAddressFieldHome("STREET"));
textHomeCity.setText(v.getAddressFieldHome("LOCALITY"));
textHomeState.setText(v.getAddressFieldHome("REGION"));
textHomeCountry.setText(v.getAddressFieldHome("CTRY"));
textHomeZipCode.setText(v.getAddressFieldHome("PCODE"));
textWorkOrganization.setText(v.getOrganization());
textWorkOrganizationUnit.setText(v.getOrganizationUnit());
textWorkEMail.setText(v.getEmailWork());
textWorkPhone.setText(v.getPhoneWork("VOICE"));
textWorkStreet.setText(v.getAddressFieldWork("STREET"));
textWorkCity.setText(v.getAddressFieldWork("LOCALITY"));
textWorkState.setText(v.getAddressFieldWork("REGION"));
textWorkCountry.setText(v.getAddressFieldWork("CTRY"));
textWorkZipCode.setText(v.getAddressFieldWork("PCODE"));
vCard = v;
}