target.addComponent(periodChoice);
PeriodStudentSelectPanel.this.onPeriodUpdate(target); // Subclass defined actions
}
});
// make sure the label is linked to the period dropdown
FormComponentLabel periodChoiceLabel = (new FormComponentLabel("periodChoiceLabel", periodChoice));
periodStudentSelectForm.add(periodChoiceLabel);
periodStudentSelectForm.add(periodChoice);
// Student Chooser
IModel<User> studentModel = ISISession.get().getStudentModel();
if (studentModel == null) {
studentModel = new HibernateObjectModel<User>(User.class);
}
studentChoice = new UserChoice("studentChoice", studentModel, getUserListModel());
if (studentChoice.getModelObject() == null) { // If session did not have a student or student was not in the session's period, reset session's student
ISISession.get().setStudentModel(null);
}
studentChoice.setOutputMarkupId(true);
// Set Student onChange Behavior
studentChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
ISISession.get().setStudentModel(studentChoice.getModel()); // Save student change in session
target.addComponent(feedback);
target.addComponent(studentChoice);
PeriodStudentSelectPanel.this.onStudentUpdate(target); // Subclass defined actions
}
});
if(!showStudents) {
studentChoice.setVisible(false);
}
// make sure the label is linked to the student dropdown
FormComponentLabel studentChoiceLabel = (new FormComponentLabel("studentChoiceLabel", studentChoice));
periodStudentSelectForm.add(studentChoiceLabel);
periodStudentSelectForm.add(studentChoice);
feedback = new FeedbackPanel("feedback", new ContainerFeedbackMessageFilter(periodStudentSelectForm));
feedback.setOutputMarkupId(true);