page.addElement(insertBoldText("Use as caixas (", posX+5, posY+3,100));
page.addElement(drawGrayRectangle(posX+95, posY+3, 18, 13, 2));
page.addElement(insertBoldText(") para marcar alunos contatados ou com certificados impressos", posX+117, posY+3,470));
for (int i = 0; i < registrationList.size(); i++) {
Registration registration = registrationList.get(i);
//if(registration.getEndDate() != null) {
List<RegistrationItem> registrationItems = registration.getRegistrationItems();
StringBuffer courses = new StringBuffer();
for(int j=0; j<registrationItems.size();j++){
if(registrationItems.get(j).isCourseCompleted()){
courses.append(registrationItems.get(j).getCourse().getDescription());
if ( courses.length() > 40 ){
courses.subSequence(0, (courses.length()<40 ? courses.length() : 40 ));
courses.append(".....");
break;
}
else{
courses.append(", ");
}
}
}
if (courses.length()>2){
if (posY > (convert(297) - 62)) {
jasperPrint.addPage(page);
page = new JRBasePrintPage();
posY = convert(10);
}
posY += 19;
page.addElement(drawGrayRectangle(posX, posY, 535, 22, 4));
page.addElement(insertBoldText("Aluno: ", posX+5, posY+3,50));
page.addElement(insertBoldText(registration.getStudent().getName(), posX+55, posY+3, 270));
page.addElement(divTitleLine(posX+358));
page.addElement(insertBoldText( ( !registration.getStudent().getPhone().equals("") ? "Telefone: " : ( !registration.getStudent().getCellPhone().equals("") ? "Celular: " : "Sem Contato") ), posX+365, posY+3,150));
page.addElement(insertBoldText( ( !registration.getStudent().getPhone().equals("") ? registration.getStudent().getPhone() : registration.getStudent().getCellPhone()) , posX+420, posY+3, 150));
if (!registration.getStudent().getPhone().equals("") || !registration.getStudent().getCellPhone().equals("")){
page.addElement(drawGrayRectangle(posX+512, posY+3, 18, 13, 2));
}
posY += 19;
if (posY > (convert(297) - 36)) {
jasperPrint.addPage(page);
page = new JRBasePrintPage();
posY = convert(10);
}
page.addElement(drawGrayRectangle(posX, posY, 535, 17, 0));
page.addElement(insertBoldText("Matr: ", posX+5, posY+2, 170));
page.addElement(insertText(bodyStyle,registration.getIdRegistration(), posX+35 ,35));
page.addElement(divTitleLine(posX+70,posY));
page.addElement(insertBoldText("Cursos: ", posX+73, posY+2, 170));
page.addElement(insertText(bodyStyle,courses.substring(0, (courses.length()>2 ? courses.length()-2 : courses.length())), posX+120, 340));
page.addElement(divTitleLine(posX+425,posY));
page.addElement(insertBoldText("T�rm: ", posX+427, posY+2, 170));
page.addElement(insertRightText(registration.getEndDate().getFormatedDate(), posX+360, posY+2, 165));
posY += 4;
total++;
}
}