subwindow refresh

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”?

Seems to be ok… have you tried to explicit setup enabled true/false from checkbox value?

ckbEdit.addValueChangeListener(event → {
if(event.getValue()) {
save.setEnabled(true);
}
else {
save.setEnabled(false);
}
});

I have made it so:

	private void showDetails(TitleService service) {
		final Button save = new Button("Save");
		service.setEditing(false);
		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());
			if (event.getValue()) {
					save.setEnabled(true);
				} else {
					save.setEnabled(false);
			}
		});
			
		subContent.addComponent(ckbEdit);
		save.setEnabled(service.getEditing());
		subContent.addComponent(save);

		getUI().addWindow(subWindow);
	}

But it is still not working.
When i activate the CheckBox “Editing”, then the Button “Save” is enabled.
When i deactivate then the CheckBox “Editing”, then the Button “Save” stays enabled, he becomes not disabled.

Now it works
thanks.
It was in the cache, so i didn’t see that it works.