private void fillSpreadSheet( final Collection<CerimonyInquiryPerson> requests, final StyledExcelSpreadsheet sheet) { setHeaders(sheet); for (CerimonyInquiryPerson inquiryPerson : requests) { final Person person = inquiryPerson.getPerson(); final CerimonyInquiryAnswer inquiryAnswer = inquiryPerson.getCerimonyInquiryAnswer(); sheet.newRow(); sheet.addCell(person.getUsername()); sheet.addCell(person.getName()); sheet.addCell(person.getEmail()); final StringBuilder contacts = new StringBuilder(); for (final PartyContact partyContact : person.getPartyContactsSet()) { if (partyContact instanceof Phone || partyContact instanceof MobilePhone) { if (contacts.length() > 0) { contacts.append(", "); } contacts.append(partyContact.getPresentationValue()); } } sheet.addCell(contacts.toString()); sheet.addCell((inquiryAnswer != null ? inquiryAnswer.getText() : new String("-"))); sheet.addCell(getDegrees(person)); sheet.addCell(inquiryPerson.getComment()); } }
@Override protected HtmlComponent createTextField(Object object, Class type) { Person person = (Person) object; String username = (person != null) ? person.getUsername() : null; final HtmlComponent container = super.createTextField(username, type); final HtmlFormComponent formComponent = (HtmlFormComponent) container.getChild( new Predicate<HtmlComponent>() { @Override public boolean apply(HtmlComponent input) { return input instanceof HtmlFormComponent; } }); formComponent.setConverter(new PersonUsernameConverter()); return formComponent; }