.#{$primaryStyleName}-sidebar.v-contextmenu {
@include box-shadow(none);
+ border-radius: 0;
position: absolute;
top: 0;
right: 0;
.#{$primaryStyleName}-sidebar-button {
background: transparent;
border: none;
+ color: inherit;
cursor: pointer;
outline: none;
padding: 0 4px;
line-height: 1;
}
}
- }
+ }
.v-ie &.opened .#{$primaryStyleName}-sidebar-button {
vertical-align: middle;
}
.#{$primaryStyleName}-sidebar-content {
- background: #fff;
border-top: $v-grid-border;
padding: 4px 0;
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();
+ }
+ });
+ }
}
/**
// 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() {
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<Grid, Void>() {
}
}, c);
- createBooleanAction("Hidable", getColumnProperty(c), false,
- new Command<Grid, Boolean>() {
+ createBooleanAction("Hidable", getColumnProperty(c),
+ isColumnHidableByDefault(c), new Command<Grid, Boolean>() {
@Override
public void execute(Grid c, Boolean hidable,
Object propertyId) {
}
}, getColumnProperty(c));
- createBooleanAction("Hidden", getColumnProperty(c), false,
- new Command<Grid, Boolean>() {
+ createBooleanAction("Hidden", getColumnProperty(c),
+ isColumnHiddenByDefault(c), new Command<Grid, Boolean>() {
@Override
public void execute(Grid c, Boolean hidden,
Object propertyId) {
--- /dev/null
+/*
+ * 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;
+ }
+}
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 {
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();