Skip to content

Commit

Permalink
Add a behavior to control visibility based on selectedGradingMethodModel
Browse files Browse the repository at this point in the history
  • Loading branch information
ottenhoff committed Dec 29, 2024
1 parent 9cac395 commit 1af99fe
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ public class GradingRulesPanel extends BasePanel {
public GradingRulesPanel(String id, IModel<Integer> selectedGradingMethodModel, IModel<AttendanceSite> siteModel) {
super(id);
this.selectedGradingMethodModel = selectedGradingMethodModel;
setOutputMarkupPlaceholderTag(true);

// Add a behavior to control visibility based on selectedGradingMethodModel
add(new Behavior() {
@Override
public void onConfigure(Component component) {
super.onConfigure(component);
Integer selectedMethod = selectedGradingMethodModel.getObject();
component.setVisible(selectedMethod != null && selectedMethod != AttendanceConstants.GRADING_METHOD_NONE);
}
});

FeedbackPanel rulesFeedbackPanel = new FeedbackPanel("rules-feedback") {
@Override
Expand Down

0 comments on commit 1af99fe

Please sign in to comment.