Cannot disable an item in checkbox group after a button click event.

We are using Vaadin 8 checkbox group. I have some checkboxes that i want to disable once a form is saved.

   //calling the method on page load if a condition is met works by calling the method on building the form
   disableChecks();
   

    protected void disableChecks()    {
            getViewComponent().checkboxGroup.setItemEnabledProvider(item -> false);
        }

    

		//Here is the click event code
        form.getSaveButton().addClickListener(event -> {
            if (validate()) {
                disableChecks();
				//This code to disable checkbox does not work from here.
				

How can i disable the two checkboxes in my group?