I have two combo boxes named Name and Project and a check box named Reject. when I select one element from Name and one from Project and when I click on reject, It should be stored in database and when I try to select same elements next time, I would like to generate a notification that this name has been rejected.
This is what I have so far. When I click on check box, Name and Project combo boxes are disabled or read only. How should I store the state of check box along with combo box's selected values in database ?
private void nameListener(ComboBox<Employee> employeeComboBox) {
employeeComboBox.addValueChangeListener(event -> {
event.getValue().getPerson();
});
}
private void projectListener(ComboBox<Project> projectComboBox) {
projectComboBox.addValueChangeListener(event -> {
event.getValue().getName();
});
}
private void checkboxListener(CheckBox rejectCheckBox) {
rejectCheckBox.addValueChangeListener(event ->{
if (event.getValue()== true) {
nameListener(employeeComboBox);
projectListener(projectComboBox);
employeeComboBox.setReadOnly(true);
projectComboBox.setReadOnly(true);
}
else {
employeeComboBox.setReadOnly(false);
projectComboBox.setReadOnly(false);
}
}) ;
}