From: Pekka Hyvönen Date: Wed, 22 Apr 2015 14:17:18 +0000 (+0300) Subject: Fixed theming issues with Grid's Sidebar (#17412) X-Git-Tag: 7.5.0.beta1~56^2^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ec4e470e401a1a8f55b427b04dee08c39ed63d8b;p=vaadin-framework.git Fixed theming issues with Grid's Sidebar (#17412) - if columns hidable when grid rendered, sidebar button had invalid height - removed border radius from grid sidebar - inherit font color for grid sidebar button Change-Id: Ib35d917b35e701bd736a28f19b34dbece7fcbe71 --- diff --git a/WebContent/VAADIN/themes/base/grid/grid.scss b/WebContent/VAADIN/themes/base/grid/grid.scss index 838c0de502..ee503822b9 100644 --- a/WebContent/VAADIN/themes/base/grid/grid.scss +++ b/WebContent/VAADIN/themes/base/grid/grid.scss @@ -90,6 +90,7 @@ $v-grid-details-border-bottom-stripe: 1px solid darken($v-grid-row-background-co .#{$primaryStyleName}-sidebar.v-contextmenu { @include box-shadow(none); + border-radius: 0; position: absolute; top: 0; right: 0; @@ -102,6 +103,7 @@ $v-grid-details-border-bottom-stripe: 1px solid darken($v-grid-row-background-co .#{$primaryStyleName}-sidebar-button { background: transparent; border: none; + color: inherit; cursor: pointer; outline: none; padding: 0 4px; @@ -133,7 +135,7 @@ $v-grid-details-border-bottom-stripe: 1px solid darken($v-grid-row-background-co line-height: 1; } } - } + } .v-ie &.opened .#{$primaryStyleName}-sidebar-button { vertical-align: middle; @@ -144,7 +146,6 @@ $v-grid-details-border-bottom-stripe: 1px solid darken($v-grid-row-background-co } .#{$primaryStyleName}-sidebar-content { - background: #fff; border-top: $v-grid-border; padding: 4px 0; diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index 0934d61eeb..65d1173ee4 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -3191,6 +3191,20 @@ public class Grid extends ResizeComposite implements private boolean isInDOM() { return getParent() != null; } + + @Override + protected void onAttach() { + super.onAttach(); + // make sure the button will get correct height if the button should + // be visible when the grid is rendered the first time. + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + + @Override + public void execute() { + setHeightToHeaderCellHeight(); + } + }); + } } /** diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java index 2abd603ae4..8c60deaf3c 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java @@ -291,7 +291,9 @@ public class GridBasicFeatures extends AbstractComponentTest { // Set varying column widths for (int col = 0; col < COLUMNS; col++) { - grid.getColumn(getColumnProperty(col)).setWidth(100 + col * 50); + Column column = grid.getColumn(getColumnProperty(col)); + column.setWidth(100 + col * 50); + column.setHidable(isColumnHidableByDefault(col)); } grid.addSortListener(new SortListener() { @@ -334,6 +336,14 @@ public class GridBasicFeatures extends AbstractComponentTest { return grid; } + protected boolean isColumnHidableByDefault(int col) { + return false; + } + + protected boolean isColumnHiddenByDefault(int col) { + return false; + } + private void addInternalActions() { createClickAction("Update column order without updating client", "Internals", new Command() { @@ -828,8 +838,8 @@ public class GridBasicFeatures extends AbstractComponentTest { } }, c); - createBooleanAction("Hidable", getColumnProperty(c), false, - new Command() { + createBooleanAction("Hidable", getColumnProperty(c), + isColumnHidableByDefault(c), new Command() { @Override public void execute(Grid c, Boolean hidable, Object propertyId) { @@ -837,8 +847,8 @@ public class GridBasicFeatures extends AbstractComponentTest { } }, getColumnProperty(c)); - createBooleanAction("Hidden", getColumnProperty(c), false, - new Command() { + createBooleanAction("Hidden", getColumnProperty(c), + isColumnHiddenByDefault(c), new Command() { @Override public void execute(Grid c, Boolean hidden, Object propertyId) { diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridSidebarFeatures.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridSidebarFeatures.java new file mode 100644 index 0000000000..9494988cf4 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridSidebarFeatures.java @@ -0,0 +1,24 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.grid.basicfeatures; + +public class GridSidebarFeatures extends GridBasicFeatures { + + @Override + protected boolean isColumnHidableByDefault(int col) { + return true; + } +} diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java index 79327993b0..5262156b41 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java @@ -19,13 +19,11 @@ import java.io.IOException; import java.util.List; import org.junit.Test; -import org.openqa.selenium.By; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.remote.DesiredCapabilities; -import org.openqa.selenium.support.ui.ExpectedConditions; -import com.vaadin.testbench.parallel.Browser; import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest; +import com.vaadin.tests.components.grid.basicfeatures.GridSidebarFeatures; public class GridSidebarThemeTest extends GridBasicFeaturesTest { @@ -34,18 +32,18 @@ public class GridSidebarThemeTest extends GridBasicFeaturesTest { runTestSequence("valo"); } + @Test + public void testValoDark() throws Exception { + runTestSequence("tests-valo-dark"); + } + + @Override + protected Class getUIClass() { + return GridSidebarFeatures.class; + } + private void runTestSequence(String theme) throws IOException { openTestURL("theme=" + theme); - if (getDesiredCapabilities().getBrowserName().equals( - Browser.CHROME.getDesiredCapabilities().getBrowserName())) { - waitUntil(ExpectedConditions.elementToBeClickable(By.id("menu")), 2); - getDriver().findElement(By.id("menu")).click(); - selectMenu("Columns"); - selectMenu("All columns hidable"); - waitUntilLoadingIndicatorNotVisible(); - } else { - selectMenuPath("Component", "Columns", "All columns hidable"); - } compareScreen(theme + "|SidebarClosed"); getSidebarOpenButton().click();