diff options
author | Petter Holmström <petter.holmstrom@outlook.com> | 2017-09-04 14:56:41 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-09-04 14:56:41 +0300 |
commit | 212ec0a83d316258ef7aa1f006c9570f7ddaaa9f (patch) | |
tree | 92e9709c863719b8557f7eb90207a36e90232723 /client | |
parent | dae918ed2cd0db3fdcdc1ba8206ecb57dab4745a (diff) | |
download | vaadin-framework-212ec0a83d316258ef7aa1f006c9570f7ddaaa9f.tar.gz vaadin-framework-212ec0a83d316258ef7aa1f006c9570f7ddaaa9f.zip |
Position caption correctly in GridLayout (#9909)
Position caption correctly when using different vertical alignment than TOP in GridLayout.
Fixes #7895
Diffstat (limited to 'client')
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/layout/VLayoutSlot.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/layout/VLayoutSlot.java b/client/src/main/java/com/vaadin/client/ui/layout/VLayoutSlot.java index 1494900e62..4546d7c5d9 100644 --- a/client/src/main/java/com/vaadin/client/ui/layout/VLayoutSlot.java +++ b/client/src/main/java/com/vaadin/client/ui/layout/VLayoutSlot.java @@ -168,6 +168,7 @@ public abstract class VLayoutSlot { int captionHeight; VCaption caption = getCaption(); + Style captionStyle = caption == null ? null : caption.getElement().getStyle(); if (caption == null || caption.shouldBePlacedAfterComponent()) { style.clearPaddingTop(); captionHeight = 0; @@ -215,10 +216,15 @@ public abstract class VLayoutSlot { padding += captionHeight; widget.getElement().getStyle().setTop(padding, Unit.PX); + if (captionStyle != null) { + captionStyle.setTop(padding - captionHeight, Unit.PX); + } } else { // Reset top when changing back to align top widget.getElement().getStyle().clearTop(); - + if (captionStyle != null) { + captionStyle.setTop(0, Unit.PX); + } } } |