}
@Override
public HtmlComponent createComponent(Object object, Class type) {
Department department = (Department) object;
HtmlBlockContainer listContainer = new HtmlBlockContainer();
for (ScientificAreaUnit scientificArea : department.getDepartmentUnit().getScientificAreaUnits()) {
HtmlText areaName = new HtmlText(scientificArea.getNameI18n().getContent());
if (getScientificAreaNameClasses() != null) {
areaName.setClasses(getScientificAreaNameClasses());
}
HtmlList list = new HtmlList();
CurricularStage stage = null;
if (getFilterBy() != null) {
stage = CurricularStage.valueOf(getFilterBy());
}
for (CompetenceCourseGroupUnit group : scientificArea.getCompetenceCourseGroupUnits()) {
HtmlListItem item = list.createItem();
HtmlBlockContainer courseContainer = new HtmlBlockContainer();
HtmlText groupName = new HtmlText(group.getPresentationName());
if (getGroupNameClasses() != null) {
groupName.setClasses(getGroupNameClasses());
}
courseContainer.addChild(groupName);
HtmlTable table = new HtmlTable();
for (CompetenceCourse course : group.getCurrentOrFutureCompetenceCourses()) {
if (course.getCurricularStage().equals(stage)) {
HtmlTableRow courseRow = table.createRow();
HtmlComponent coursePresentation =
getCurrentOrFutureCoursePresentation(course, group, department.getDepartmentUnit());
if (getCourseNameClasses() != null) {
coursePresentation.setClasses(getCourseNameClasses());
}
courseRow.createCell().setBody(coursePresentation);
HtmlTableCell cell = courseRow.createCell();
cell.setBody(getLinks(course));
cell.setClasses("aright");
}
}
if (isShowOldCompetenceCourses()) {
for (CompetenceCourse course : group.getOldCompetenceCourses()) {
if (course.getCurricularStage().equals(stage)) {
HtmlTableRow courseRow = table.createRow();
HtmlComponent coursePresentation = getOldCoursePresentation(course);
if (getCourseNameClasses() != null) {
coursePresentation.setClasses(getCourseNameClasses());
}
courseRow.createCell().setBody(coursePresentation);
HtmlTableCell cell = courseRow.createCell();
cell.setBody(getLinks(course));
cell.setClasses("aright");
}
}
}
courseContainer.addChild(table);
if (getTableClasses() != null) {
table.setClasses(getTableClasses());
}
item.setBody(courseContainer);
}
listContainer.addChild(areaName);
listContainer.addChild(list);
}
HtmlBlockContainer container = new HtmlBlockContainer();
container.addChild(getCaptionPresentation());
container.addChild(listContainer);
return container;
}