diff options
-rw-r--r-- | WebContent/VAADIN/themes/base/escalator/escalator.scss | 11 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/grid/Escalator.java | 38 |
2 files changed, 49 insertions, 0 deletions
diff --git a/WebContent/VAADIN/themes/base/escalator/escalator.scss b/WebContent/VAADIN/themes/base/escalator/escalator.scss index f410cafa17..c5b5d24fa4 100644 --- a/WebContent/VAADIN/themes/base/escalator/escalator.scss +++ b/WebContent/VAADIN/themes/base/escalator/escalator.scss @@ -41,6 +41,17 @@ $border-color: #aaa; width: inherit; /* a decent default fallback */ } +.#{$primaryStyleName}-headercorner, +.#{$primaryStyleName}-footercorner { + position: absolute; + right: 0; + border: 1px solid $border-color; + box-sizing: border-box; +} + +.#{$primaryStyleName}-headercorner { top: 0; } +.#{$primaryStyleName}-footercorner { bottom: 0; } + .#{$primaryStyleName}-horizontalscrollbarbackground { position: absolute; bottom: 0; diff --git a/client/src/com/vaadin/client/ui/grid/Escalator.java b/client/src/com/vaadin/client/ui/grid/Escalator.java index b140868469..a98daf456b 100644 --- a/client/src/com/vaadin/client/ui/grid/Escalator.java +++ b/client/src/com/vaadin/client/ui/grid/Escalator.java @@ -811,6 +811,27 @@ public class Escalator extends Widget implements RequiresResize, DeferredWorker horizontalScrollbarBackground.getStyle().setDisplay( Display.NONE); } + + /* + * only show corner background divs if the vertical scrollbar is + * visible. + */ + Style hCornerStyle = headerCorner.getStyle(); + Style fCornerStyle = footerCorner.getStyle(); + if (verticalScrollbar.showsScrollHandle()) { + hCornerStyle.clearDisplay(); + fCornerStyle.clearDisplay(); + + if (horizontalScrollbar.showsScrollHandle()) { + int offset = horizontalScrollbar.getScrollbarThickness(); + fCornerStyle.setBottom(offset, Unit.PX); + } else { + fCornerStyle.clearBottom(); + } + } else { + hCornerStyle.setDisplay(Display.NONE); + fCornerStyle.setDisplay(Display.NONE); + } } /** @@ -4088,6 +4109,8 @@ public class Escalator extends Widget implements RequiresResize, DeferredWorker private final DivElement horizontalScrollbarBackground = DivElement.as(DOM .createDiv()); + private final DivElement headerCorner = DivElement.as(DOM.createDiv()); + private final DivElement footerCorner = DivElement.as(DOM.createDiv()); private PositionFunction position; @@ -4188,6 +4211,16 @@ public class Escalator extends Widget implements RequiresResize, DeferredWorker table.appendChild(bodyElem); table.appendChild(footElem); + Style hCornerStyle = headerCorner.getStyle(); + hCornerStyle.setWidth(Util.getNativeScrollbarSize(), Unit.PX); + hCornerStyle.setDisplay(Display.NONE); + root.appendChild(headerCorner); + + Style fCornerStyle = footerCorner.getStyle(); + fCornerStyle.setWidth(Util.getNativeScrollbarSize(), Unit.PX); + fCornerStyle.setDisplay(Display.NONE); + root.appendChild(footerCorner); + Style hWrapperStyle = horizontalScrollbarBackground.getStyle(); hWrapperStyle.setDisplay(Display.NONE); hWrapperStyle.setHeight(Util.getNativeScrollbarSize(), Unit.PX); @@ -4556,6 +4589,9 @@ public class Escalator extends Widget implements RequiresResize, DeferredWorker body.recalculateSectionHeight(); footer.recalculateSectionHeight(); + headerCorner.getStyle().setHeight(header.heightOfSection, Unit.PX); + footerCorner.getStyle().setHeight(footer.heightOfSection, Unit.PX); + scroller.recalculateScrollbarsForVirtualViewport(); body.verifyEscalatorCount(); Profiler.leave("Escalator.recalculateElementSizes"); @@ -4710,6 +4746,8 @@ public class Escalator extends Widget implements RequiresResize, DeferredWorker horizontalScrollbar.setStylePrimaryName(style); UIObject.setStylePrimaryName(tableWrapper, style + "-tablewrapper"); + UIObject.setStylePrimaryName(headerCorner, style + "-headercorner"); + UIObject.setStylePrimaryName(footerCorner, style + "-footercorner"); UIObject.setStylePrimaryName(horizontalScrollbarBackground, style + "-horizontalscrollbarbackground"); |