JPanel valuesPanel = new TransparentPanel(new GridLayout(0, 1, 5, 5));
detailsPanel.add(valuesPanel, BorderLayout.CENTER);
Iterator<GenericDetail> contactDetails;
GenericDetail genericDetail;
// First name details.
contactDetails =
contactInfoOpSet.getDetails(contact, FirstNameDetail.class);
String firstNameDetail = "";
while (contactDetails.hasNext())
{
genericDetail = contactDetails.next();
firstNameDetail =
firstNameDetail + " " + genericDetail.getDetailValue();
}
if (firstNameDetail.equals(""))
firstNameDetail
= Resources.getString("plugin.contactinfo.NOT_SPECIFIED");
valuesPanel.add(new JLabel(firstNameDetail));
// Middle name details.
contactDetails =
contactInfoOpSet.getDetails(contact, MiddleNameDetail.class);
String middleNameDetail = "";
while (contactDetails.hasNext())
{
genericDetail = contactDetails.next();
middleNameDetail =
middleNameDetail + " " + genericDetail.getDetailValue();
}
if (middleNameDetail.trim().equals(""))
middleNameDetail
= Resources.getString("plugin.contactinfo.NOT_SPECIFIED");
valuesPanel.add(new JLabel(middleNameDetail));
// Last name details.
contactDetails =
contactInfoOpSet.getDetails(contact, LastNameDetail.class);
String lastNameDetail = "";
while (contactDetails.hasNext())
{
genericDetail = contactDetails.next();
lastNameDetail =
lastNameDetail + " " + genericDetail.getDetailValue();
}
if (lastNameDetail.trim().equals(""))
lastNameDetail
= Resources.getString("plugin.contactinfo.NOT_SPECIFIED");
valuesPanel.add(new JLabel(lastNameDetail));
// Gender details.
contactDetails =
contactInfoOpSet.getDetails(contact, GenderDetail.class);
String genderDetail = "";
while (contactDetails.hasNext())
{
genericDetail = contactDetails.next();
genderDetail = genderDetail + " " + genericDetail.getDetailValue();
}
if (genderDetail.trim().equals(""))
genderDetail
= Resources.getString("plugin.contactinfo.NOT_SPECIFIED");
valuesPanel.add(new JLabel(genderDetail));
// Birthday details.
contactDetails =
contactInfoOpSet.getDetails(contact, BirthDateDetail.class);
String birthDateDetail = "";
String ageDetail = "";
if (contactDetails.hasNext())
{
genericDetail = contactDetails.next();
Calendar calendarDetail =
(Calendar) genericDetail.getDetailValue();
Date birthDate = calendarDetail.getTime();
DateFormat dateFormat = DateFormat.getDateInstance();
birthDateDetail = dateFormat.format(birthDate).trim();
Calendar c = Calendar.getInstance();
int age = c.get(Calendar.YEAR) - calendarDetail.get(Calendar.YEAR);
if (c.get(Calendar.MONTH) < calendarDetail.get(Calendar.MONTH))
age--;
ageDetail = Integer.toString(age).trim();
}
if (birthDateDetail.equals(""))
birthDateDetail
= Resources.getString("plugin.contactinfo.NOT_SPECIFIED");
if (ageDetail.equals(""))
ageDetail = Resources.getString("plugin.contactinfo.NOT_SPECIFIED");
valuesPanel.add(new JLabel(birthDateDetail));
valuesPanel.add(new JLabel(ageDetail));
// Email details.
contactDetails =
contactInfoOpSet.getDetails(contact, EmailAddressDetail.class);
String emailDetail = "";
while (contactDetails.hasNext())
{
genericDetail = contactDetails.next();
emailDetail = emailDetail + " " + genericDetail.getDetailValue();
}
if (emailDetail.trim().equals(""))
emailDetail
= Resources.getString("plugin.contactinfo.NOT_SPECIFIED");
valuesPanel.add(new JLabel(emailDetail));
// Phone number details.
contactDetails =
contactInfoOpSet.getDetails(contact, PhoneNumberDetail.class);
String phoneNumberDetail = "";
while (contactDetails.hasNext())
{
genericDetail = contactDetails.next();
phoneNumberDetail =
phoneNumberDetail + " " + genericDetail.getDetailValue();
}
if (phoneNumberDetail.trim().equals(""))
phoneNumberDetail
= Resources.getString("plugin.contactinfo.NOT_SPECIFIED");