Hello i am using Vaadin 8
I have a service, which holds the data
@RequestScoped
@Named("title")
public class TitleService {
@EJB
private TitleDAO titleDAO;
private Title title;
private boolean isEditing = false;
public boolean getEditing() {
return isEditing;
}
public void setEditing(boolean isEditing) {
this.isEditing = isEditing;
}
public void toggleEditing() {
this.isEditing = !this.isEditing;
}
...
}
In my Frontend i create a subWindow
private void showDetails(TitleService service) {
final Button save = new Button("Save");
service.setEditing(false);
// Create a sub-window and set the content
Window subWindow = new Window("Details");
VerticalLayout subContent = new VerticalLayout();
subWindow.setContent(subContent);
subWindow.center();
CheckBox ckbEdit = new CheckBox("Edit");
ckbEdit.addValueChangeListener(event -> {
service.toggleEditing();
save.setEnabled(service.getEditing());
});
subContent.addComponent(ckbEdit);
save.setEnabled(service.getEditing());
subContent.addComponent(save);
getUI().addWindow(subWindow);
}
When i activate the CheckBox “Edit”, then the Button “Save” is enabled, all works well.
When i deactivate the CheckBox “Edit”, then the Button “Save” is still enabled, he is not disabled.
Can you help why the Button “Save” is not disabled when i deactivate the CheckBox “Edit”?