frozenColumns += numberOfColumns;
}
+ // Add to DOM
+ header.paintInsertColumns(index, numberOfColumns, frozen);
+ body.paintInsertColumns(index, numberOfColumns, frozen);
+ footer.paintInsertColumns(index, numberOfColumns, frozen);
+
// this needs to be before the scrollbar adjustment.
boolean scrollbarWasNeeded = horizontalScrollbar.getOffsetSize() < horizontalScrollbar
.getScrollSize();
boolean scrollbarIsNowNeeded = horizontalScrollbar.getOffsetSize() < horizontalScrollbar
.getScrollSize();
if (!scrollbarWasNeeded && scrollbarIsNowNeeded) {
+ // This might as a side effect move rows around (when scrolled
+ // all the way down) and require the DOM to be up to date, i.e.
+ // the column to be added
body.verifyEscalatorCount();
}
- // Add to DOM
- header.paintInsertColumns(index, numberOfColumns, frozen);
- body.paintInsertColumns(index, numberOfColumns, frozen);
- footer.paintInsertColumns(index, numberOfColumns, frozen);
-
// fix initial width
if (header.getRowCount() > 0 || body.getRowCount() > 0
|| footer.getRowCount() > 0) {
/*
* 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
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import com.vaadin.testbench.elements.GridElement;
import com.vaadin.testbench.parallel.TestCategory;
import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest;
verifyColumnNotFrozen(2);
}
+ @Test
+ public void showColumnAndScrollbarWhenScrolledDownAndVisibleRowsChange() throws Exception {
+ // Set a (un)suitable height
+ selectMenuPath("Component", "Size", "HeightMode Row");
+ selectMenuPath("Component", "Size", "Height by Rows", "4.33 rows");
+
+ toggleAllColumnsHidable();
+
+ // Hide all but the first 3
+ getSidebarOpenButton().click();
+ for (int i=3; i < 12; i++) {
+ getColumnHidingToggle(i).click();
+ }
+
+ getSidebarOpenButton().click();
+
+ // Scroll all the way to the end
+ $(GridElement.class).first().scrollToRow(999);
+
+ // Show the fourth column
+ getSidebarOpenButton().click();
+ getColumnHidingToggle(3).click();
+
+ // Make sure that the new column contains the data it should
+ Assert.assertEquals("(999, 3)", getGridElement().getCell(999, 3).getText());
+ }
+
private void verifyColumnFrozen(int index) {
assertTrue(getGridElement().getHeaderCell(0, index).isFrozen());
}
private void toggleColumnHidable(int index) {
selectMenuPath("Component", "Columns", "Column " + index, "Hidable");
}
+ private void toggleAllColumnsHidable() {
+ selectMenuPath("Component", "Columns", "All columns hidable");
+ }
private void addRemoveColumn(int index) {
selectMenuPath("Component", "Columns", "Column " + index,