boolean optionGroupEnabled = isEnabled() && !isReadonly();
// sets options enabled according to the widget's enabled,
// readonly and each options own enabled
for (Widget w : panel) {
if (w instanceof HasEnabled) {
HasEnabled hasEnabled = (HasEnabled) w;
Boolean isOptionEnabled = optionsEnabled.get(w);
if (isOptionEnabled == null) {
hasEnabled.setEnabled(optionGroupEnabled);
setStyleName(w.getElement(),
ApplicationConnection.DISABLED_CLASSNAME,
!isEnabled());
} else {
hasEnabled
.setEnabled(isOptionEnabled && optionGroupEnabled);
setStyleName(w.getElement(),
ApplicationConnection.DISABLED_CLASSNAME,
!(isOptionEnabled && isEnabled()));
}