From 456befbba13ba0e1fb19cb8353a7744e54a3e925 Mon Sep 17 00:00:00 2001 From: Jouni Koivuviita Date: Wed, 18 Apr 2012 16:01:43 +0300 Subject: [PATCH] Fixes to BoxLayout --- .../VAADIN/themes/runo/orderedlayout/orderedlayout.css | 6 ++++-- .../gwt/client/ui/AbstractBoxLayoutConnector.java | 10 +++++++++- src/com/vaadin/terminal/gwt/client/ui/VBoxLayout.java | 6 +++--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/WebContent/VAADIN/themes/runo/orderedlayout/orderedlayout.css b/WebContent/VAADIN/themes/runo/orderedlayout/orderedlayout.css index f70e285729..8738ac89d1 100644 --- a/WebContent/VAADIN/themes/runo/orderedlayout/orderedlayout.css +++ b/WebContent/VAADIN/themes/runo/orderedlayout/orderedlayout.css @@ -8,7 +8,8 @@ .v-orderedlayout-margin-right, .v-horizontallayout-margin-right, .v-verticallayout-margin-right, -.v-csslayout-margin-right { +.v-csslayout-margin-right, +.v-boxlayout.v-margin-right { padding-right: 18px; } .v-orderedlayout-margin-bottom, @@ -21,7 +22,8 @@ .v-orderedlayout-margin-left, .v-horizontallayout-margin-left, .v-verticallayout-margin-left, -.v-csslayout-margin-left { +.v-csslayout-margin-left, +.v-boxlayout.v-margin-left { padding-left: 18px; } .v-orderedlayout-spacing-on, diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbstractBoxLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbstractBoxLayoutConnector.java index b4df5215bd..087e1a5c15 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/AbstractBoxLayoutConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/AbstractBoxLayoutConnector.java @@ -11,6 +11,7 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.ui.Widget; +import com.vaadin.terminal.gwt.client.AbstractFieldState; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.ComponentConnector; import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent; @@ -186,6 +187,12 @@ public abstract class AbstractBoxLayoutConnector extends .getIcon().getURL() : null; List styles = child.getState().getStyles(); String error = child.getState().getErrorMessage(); + boolean showError = error != null; + if (child.getState() instanceof AbstractFieldState) { + AbstractFieldState abstractFieldState = (AbstractFieldState) child + .getState(); + showError = showError && !abstractFieldState.isHideErrors(); + } boolean required = false; if (child instanceof AbstractFieldConnector) { required = ((AbstractFieldConnector) child).isRequired(); @@ -193,7 +200,8 @@ public abstract class AbstractBoxLayoutConnector extends boolean enabled = child.getState().isEnabled(); // TODO Description is handled from somewhere else? - slot.setCaption(caption, iconUrl, styles, error, required, enabled); + slot.setCaption(caption, iconUrl, styles, error, showError, required, + enabled); slot.setRelativeWidth(child.isRelativeWidth()); slot.setRelativeHeight(child.isRelativeHeight()); diff --git a/src/com/vaadin/terminal/gwt/client/ui/VBoxLayout.java b/src/com/vaadin/terminal/gwt/client/ui/VBoxLayout.java index 29c619434f..1b06861b8a 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VBoxLayout.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VBoxLayout.java @@ -230,8 +230,8 @@ public class VBoxLayout extends FlowPanel { // TODO refactor VCaption and use that instead: creates a tight coupling // between this layout and Vaadin, but it's already coupled public void setCaption(String captionText, String iconUrl, - List styles, String error, boolean required, - boolean enabled) { + List styles, String error, boolean showError, + boolean required, boolean enabled) { // TODO place for optimization: check if any of these have changed // since last time, and only run those changes @@ -301,7 +301,7 @@ public class VBoxLayout extends FlowPanel { } // Error - if (error != null) { + if (error != null && showError) { if (errorIcon == null) { errorIcon = DOM.createSpan(); errorIcon.setClassName("v-errorindicator"); -- 2.39.5