public HtmlComponent createComponent(Object object, Class type) {
if (object == null) {
return new HtmlText();
}
Shift shift = (Shift) object;
final StringBuilder lessonsLabel = new StringBuilder();
int index = 0;
Set<Lesson> shiftLessons = new TreeSet<Lesson>(Lesson.LESSON_COMPARATOR_BY_WEEKDAY_AND_STARTTIME);
shiftLessons.addAll(shift.getAssociatedLessonsSet());
for (Lesson lesson : shiftLessons) {
index++;
lessonsLabel.append(lesson.getDiaSemana().toString()).append(" (");
lessonsLabel.append(DateFormatUtil.format("HH:mm", lesson.getInicio().getTime())).append("-");
lessonsLabel.append(DateFormatUtil.format("HH:mm", lesson.getFim().getTime())).append(") ");
if (lesson.hasSala()) {
lessonsLabel.append(lesson.getSala().getName());
}
if (index < shift.getAssociatedLessonsSet().size()) {
lessonsLabel.append(" ; ");
} else {
lessonsLabel.append(" ");
}
}