diff options
author | Adam Wagner <wbadam@users.noreply.github.com> | 2017-09-27 10:02:29 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-09-27 10:02:29 +0300 |
commit | 697f770287bb786b6b5d4944a9202d145e4251f5 (patch) | |
tree | 2533cf5d0392129f8094f5d02df15c883f00f304 /compatibility-client/src | |
parent | 9776ea2e85468256c70b8618c0e1a2a7ccb8199b (diff) | |
download | vaadin-framework-697f770287bb786b6b5d4944a9202d145e4251f5.tar.gz vaadin-framework-697f770287bb786b6b5d4944a9202d145e4251f5.zip |
Implement error level on client side (#9817)
Add additional class names and style to components and error indicators to distinguish different error levels.
Vaadin 8 implementation of #9816. Cherry picked changes and added compatibility package component changes and tests.
Resolves #3139
Diffstat (limited to 'compatibility-client/src')
-rw-r--r-- | compatibility-client/src/main/java/com/vaadin/v7/client/ui/checkbox/CheckBoxConnector.java | 9 | ||||
-rw-r--r-- | compatibility-client/src/main/java/com/vaadin/v7/client/ui/form/FormConnector.java | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/checkbox/CheckBoxConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/checkbox/CheckBoxConnector.java index d2a761ba0a..714367b0ae 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/checkbox/CheckBoxConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/checkbox/CheckBoxConnector.java @@ -21,8 +21,10 @@ import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Event; import com.vaadin.client.MouseEventDetailsBuilder; +import com.vaadin.client.StyleConstants; import com.vaadin.client.VCaption; import com.vaadin.client.VTooltip; +import com.vaadin.client.WidgetUtil.ErrorUtil; import com.vaadin.client.annotations.OnStateChange; import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.ui.ConnectorFocusAndBlurHandler; @@ -67,7 +69,7 @@ public class CheckBoxConnector extends AbstractFieldConnector getWidget().errorIndicatorElement = DOM.createSpan(); getWidget().errorIndicatorElement.setInnerHTML(" "); DOM.setElementProperty(getWidget().errorIndicatorElement, - "className", "v-errorindicator"); + "className", StyleConstants.STYLE_NAME_ERROR_INDICATOR); DOM.appendChild(getWidget().getElement(), getWidget().errorIndicatorElement); DOM.sinkEvents(getWidget().errorIndicatorElement, @@ -75,6 +77,11 @@ public class CheckBoxConnector extends AbstractFieldConnector } else { getWidget().errorIndicatorElement.getStyle().clearDisplay(); } + + ErrorUtil.setErrorLevelStyle(getWidget().errorIndicatorElement, + StyleConstants.STYLE_NAME_ERROR_INDICATOR, + getState().errorLevel); + } else if (getWidget().errorIndicatorElement != null) { getWidget().errorIndicatorElement.getStyle() .setDisplay(Display.NONE); diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/form/FormConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/form/FormConnector.java index e904cd6803..ab28118c66 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/form/FormConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/form/FormConnector.java @@ -126,6 +126,7 @@ public class FormConnector extends AbstractComponentContainerConnector if (null != getState().errorMessage) { getWidget().errorMessage.updateMessage(getState().errorMessage); + getWidget().errorMessage.updateErrorLevel(getState().errorLevel); getWidget().errorMessage.setVisible(true); } else { getWidget().errorMessage.setVisible(false); |