diff options
author | Artur Signell <artur.signell@itmill.com> | 2010-04-08 07:43:19 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2010-04-08 07:43:19 +0000 |
commit | 6699834f741df04b2ca11d34852610de95609148 (patch) | |
tree | cbea3e9e7c0687bdbe58c085e38ca4db51de2e11 /src | |
parent | 0c8611307c6f5d7a0146ede14600dc6b87aaba07 (diff) | |
download | vaadin-framework-6699834f741df04b2ca11d34852610de95609148.tar.gz vaadin-framework-6699834f741df04b2ca11d34852610de95609148.zip |
Fix for #3846 - Empty string as a caption in VOrderedLayout uses space in IE6&7 but not in other browsers
svn changeset:12373/svn branch:6.3
Diffstat (limited to 'src')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/VCaption.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/VCaption.java b/src/com/vaadin/terminal/gwt/client/VCaption.java index 201e1aaf87..8018875137 100644 --- a/src/com/vaadin/terminal/gwt/client/VCaption.java +++ b/src/com/vaadin/terminal/gwt/client/VCaption.java @@ -73,6 +73,8 @@ public class VCaption extends HTML { boolean wasPlacedAfterComponent = placedAfterComponent; + // Caption is placed after component unless there is some part which + // moves it above. placedAfterComponent = true; String style = CLASSNAME; @@ -98,6 +100,7 @@ public class VCaption extends HTML { DOM.insertChild(getElement(), icon.getElement(), getInsertPosition(ATTRIBUTE_ICON)); } + // Icon forces the caption to be above the component placedAfterComponent = false; iconOnloadHandled = false; @@ -110,6 +113,10 @@ public class VCaption extends HTML { } if (uidl.hasAttribute(ATTRIBUTE_CAPTION)) { + // A caption text should be shown if the attribute is set + // If the caption is null the ATTRIBUTE_CAPTION should not be set to + // avoid ending up here. + if (captionText == null) { captionText = DOM.createDiv(); captionText.setClassName("v-captiontext"); @@ -120,12 +127,18 @@ public class VCaption extends HTML { // Update caption text String c = uidl.getStringAttribute(ATTRIBUTE_CAPTION); - if (c == null) { - c = ""; + // A text forces the caption to be above the component. + placedAfterComponent = false; + if (c == null || c.trim().equals("")) { + // Not sure if c even can be null. Should not. + + // This is required to ensure that the caption uses space in all + // browsers when it is set to the empty string. + captionText.setInnerHTML(" "); } else { - placedAfterComponent = false; + DOM.setInnerText(captionText, c); } - DOM.setInnerText(captionText, c); + } else if (captionText != null) { // Remove existing DOM.removeChild(getElement(), captionText); |