@Override
public HtmlComponent createComponent(Object object, Class type) {
dismissalBean = (DismissalBean) object;
HtmlBlockContainer container = new HtmlBlockContainer();
if (dismissalBean == null
|| dismissalBean.getExecutionPeriod() == null
|| dismissalBean.getStudentCurricularPlan().getStartExecutionPeriod()
.isAfter(dismissalBean.getExecutionPeriod())) {
return new HtmlText();
}
DismissalType dismissalTypeValue =
getDismissalType() == null ? dismissalBean.getDismissalType() : DismissalType.valueOf(getDismissalType());
if (dismissalTypeValue == DismissalType.CURRICULUM_GROUP_CREDITS) {
radioButtonGroup = new HtmlRadioButtonGroup();
// slot refered by name
radioButtonGroup.bind(getInputContext().getMetaObject(), "courseGroup");
radioButtonGroup.setConverter(new DomainObjectKeyConverter());
container.addChild(radioButtonGroup);
generateCourseGroupCycles(container, dismissalBean.getStudentCurricularPlan(), dismissalBean.getExecutionPeriod());
} else if (dismissalTypeValue == DismissalType.CURRICULAR_COURSE_CREDITS) {
final HtmlMultipleHiddenField hiddenCurricularCourses = new HtmlMultipleHiddenField();
// slot refered by name
hiddenCurricularCourses.bind(getInputContext().getMetaObject(), "dismissals");
hiddenCurricularCourses.setConverter(new SelectedCurricularCoursesKeyConverter());
hiddenCurricularCourses.setController(curricularCoursesController);
container.addChild(hiddenCurricularCourses);
final HtmlMultipleHiddenField hiddenOptionalCurricularCourses = new HtmlMultipleHiddenField();
// slot refered by name
hiddenOptionalCurricularCourses.bind(getInputContext().getMetaObject(), "optionalDismissals");
hiddenOptionalCurricularCourses.setConverter(new SelectedOptionalCurricularCoursesKeyConverter());
hiddenOptionalCurricularCourses.setController(optionalCurricularCoursesController);
container.addChild(hiddenOptionalCurricularCourses);
generateCurricularCourses(container, dismissalBean.getStudentCurricularPlan(), dismissalBean.getExecutionPeriod());
} else {
radioButtonGroup = new HtmlRadioButtonGroup();
// slot refered by name
radioButtonGroup.bind(getInputContext().getMetaObject(), "curriculumGroup");
radioButtonGroup.setConverter(new DomainObjectKeyConverter());
container.addChild(radioButtonGroup);
generateNoCourseGroupCurriculumGroups(container, dismissalBean.getStudentCurricularPlan());
}
return container;
}