diff options
author | Pekka Hyvönen <pekka@vaadin.com> | 2017-11-22 12:36:07 +0200 |
---|---|---|
committer | caalador <mikael.grankvist@gmail.com> | 2017-11-22 12:36:07 +0200 |
commit | ea7c4a93cfdff5b324dfe796ff6c7cf983052b35 (patch) | |
tree | a2ca85240132ccf5730429eb47b2bcf256d56eb7 /client | |
parent | ccf6f5c134a2f1d7238822c9943ff6bca796a473 (diff) | |
download | vaadin-framework-ea7c4a93cfdff5b324dfe796ff6c7cf983052b35.tar.gz vaadin-framework-ea7c4a93cfdff5b324dfe796ff6c7cf983052b35.zip |
Fix missing v-disabled for RadioButtonGroup and CheckBoxGroup options (#10332)
* Fix missing v-disabled for RadioButtonGroup
* Fix missing v-disabled for CheckBoxGroup
Resolves #9258
Diffstat (limited to 'client')
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/VCheckBoxGroup.java | 4 | ||||
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/VRadioButtonGroup.java | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VCheckBoxGroup.java b/client/src/main/java/com/vaadin/client/ui/VCheckBoxGroup.java index d393b1c3ce..b1132a487c 100644 --- a/client/src/main/java/com/vaadin/client/ui/VCheckBoxGroup.java +++ b/client/src/main/java/com/vaadin/client/ui/VCheckBoxGroup.java @@ -31,6 +31,7 @@ import com.google.gwt.user.client.ui.HasEnabled; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.BrowserInfo; +import com.vaadin.client.StyleConstants; import com.vaadin.client.WidgetUtil; import com.vaadin.client.widgets.FocusableFlowPanelComposite; import com.vaadin.shared.Registration; @@ -188,6 +189,9 @@ public class VCheckBoxGroup extends FocusableFlowPanelComposite .getBoolean(ListingJsonConstants.JSONKEY_ITEM_DISABLED); boolean enabled = optionEnabled && !isReadonly() && isEnabled(); checkBox.setEnabled(enabled); + // #9258 apply the v-disabled class when disabled for UX + checkBox.setStyleName(StyleConstants.DISABLED, + !isEnabled() || !optionEnabled); } public boolean isHtmlContentAllowed() { diff --git a/client/src/main/java/com/vaadin/client/ui/VRadioButtonGroup.java b/client/src/main/java/com/vaadin/client/ui/VRadioButtonGroup.java index a382758409..89f8eb16e3 100644 --- a/client/src/main/java/com/vaadin/client/ui/VRadioButtonGroup.java +++ b/client/src/main/java/com/vaadin/client/ui/VRadioButtonGroup.java @@ -34,6 +34,7 @@ import com.google.gwt.user.client.ui.RadioButton; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.BrowserInfo; +import com.vaadin.client.StyleConstants; import com.vaadin.client.WidgetUtil; import com.vaadin.client.widgets.FocusableFlowPanelComposite; import com.vaadin.shared.Registration; @@ -155,6 +156,10 @@ public class VRadioButtonGroup extends FocusableFlowPanelComposite .getBoolean(ListingJsonConstants.JSONKEY_ITEM_DISABLED); boolean enabled = optionEnabled && !isReadonly() && isEnabled(); button.setEnabled(enabled); + // #9258 apply the v-disabled class when disabled for UX + button.setStyleName(StyleConstants.DISABLED, + !isEnabled() || !optionEnabled); + String key = item.getString(DataCommunicatorConstants.KEY); if (requireInitialization) { @@ -205,9 +210,12 @@ public class VRadioButtonGroup extends FocusableFlowPanelComposite .entrySet()) { RadioButton radioButton = entry.getKey(); JsonObject value = entry.getValue(); - Boolean isOptionEnabled = !value + boolean optionEnabled = !value .getBoolean(ListingJsonConstants.JSONKEY_ITEM_DISABLED); - radioButton.setEnabled(radioButtonEnabled && isOptionEnabled); + radioButton.setEnabled(radioButtonEnabled && optionEnabled); + // #9258 apply the v-disabled class when disabled for UX + radioButton.setStyleName(StyleConstants.DISABLED, + !isEnabled() || !optionEnabled); } } |