Caption of grid within a grid not getting re-enabled

Hi all,

It seems the caption of a grid within an encompassing grid is not getting back to it’s enabled style again if you have its encompassing grid first disabled, then enable that encompassing grid.


Scenario:

1- Page opens with first radiobutton (optiongroup item) selected.
2- The second optiongroup item is not selected, so the grid (“encompassing grid”) below it is disabled via grid.setEnabled(false).
That grid below has a few grids inside itself added via addComponent().
3- User selects second radiobutton, which causes the encompassing grid to get enabled via grid.setEnabled(true).
4- Result: all items within the encompassing grid (like checkboxes, select dropdown) are now enabled as should be.
BUT: the captions of the grids inside it are still grayed out (looking disabled).
(Note: i have tested that if not initially disabling the encompassing grid, the captions are not grayed out, see screenshot as_it_should_be.jpg).


Code snippets:

// Encompassing grid


        final GridLayout gridEncompassing = new GridLayout(1, 5);
        gridEncompassing.addStyleName("indent-component"); // Adding custom style, that's why bigger font is shown
        gridEncompassing.setEnabled(false);
        layout.addComponent(gridEncompassing);

// Example code of adding each grid to that encompassing grid


        GridLayout gridCaption1 = new GridLayout(1, 2);
        gridCaption1.setCaption("Caption1");
        gridCaption1.addStyleName("grid-with-options-below"); // Adding some indenting via this custom style
        gridCaption1.addComponent(checkBox1, 0, 0);
        gridCaption1.addComponent(checkBox2, 0, 1);
        gridEncompassing.addComponent(gridCaption1, 0, 0);

// Value change listener on encompassing grid


	if (first radio button selected) {
		gridEncompassing.setEnabled(false);
                gridCaption.setEnabled(false); // This should not be necessary, was a try to see if this would fix it
	} else {
		gridEncompassing.setEnabled(true);
                gridCaption.setEnabled(false); // This should not be necessary, was a try to see if this would fix it
	}


Screenshots
, see attachments:

  • not_enabled.jpg: at page opening, so encompassing group is disabled. Result as in steps 1+2 from the scenario.
  • enabled_select_captions_disabled_selectable_radiobuttons.jpg: after selecting the second radiobutton. Note that all items are now selectable (enabled), but the grid captions are still disabled (grayed out). Steps 3+4 from the scenario.
  • as_it_should_be.jpg: the expected result. Notice the bold, enabled looking captions.

Is this a bug or am I doing something wrong?

Regards,
Marco
13110.jpg
13111.jpg
13112.jpg

Found a workaround!

If you modify the caption to something different after enabling the encompassing grid, it does get un-grayed, so looking enabled again.
It does not work if you just set it to the same text again!

So what I did was just append a space " " to the original text when setting it again and it works. So using the above example, in the ‘else’ part of the value change listener:

gridCaption.setCaption("Caption1" + " ");

(the gridCaption.setEnabled() calls can be removed)

Please
file a bug report
, if possible with a short program that permits reproducing the problem and information about which Vaadin version is affected.