Browse Source

Don't set frozen column count before columns have been updated (#13334)

Change-Id: I63ab65dad6dacfb5dafe55147c18d3e4ec0e36a5
tags/7.4.0.beta1
Leif Åstrand 9 years ago
parent
commit
e4ba60c26a

+ 5
- 0
client/src/com/vaadin/client/connectors/GridConnector.java View File

@@ -471,6 +471,11 @@ public class GridConnector extends AbstractHasComponentsConnector implements
getState().editorRowEnabled);
}

if (stateChangeEvent.hasPropertyChanged("frozenColumnCount")) {
getWidget().setFrozenColumnCount(
getState().frozenColumnCount);
}

}
});


+ 0
- 1
shared/src/com/vaadin/shared/ui/grid/GridState.java View File

@@ -116,7 +116,6 @@ public class GridState extends AbstractComponentState {
public GridStaticSectionState footer = new GridStaticSectionState();

/** The number of frozen columns */
@DelegateToWidget
public int frozenColumnCount = 0;

/** The height of the Grid in terms of body rows. */

+ 41
- 0
uitest/src/com/vaadin/tests/components/grid/InitialFrozenColumns.java View File

@@ -0,0 +1,41 @@
/*
* 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;

import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.SelectionMode;

public class InitialFrozenColumns extends AbstractTestUI {

@Override
protected void setup(VaadinRequest request) {
Grid grid = new Grid();
grid.setSelectionMode(SelectionMode.NONE);

grid.addColumn("foo").setWidth(200);
grid.addColumn("bar").setWidth(200);
grid.addColumn("baz").setWidth(200);

grid.addRow("a", "b", "c");

grid.setFrozenColumnCount(2);

addComponent(grid);
}

}

+ 40
- 0
uitest/src/com/vaadin/tests/components/grid/InitialFrozenColumnsTest.java View File

@@ -0,0 +1,40 @@
/*
* 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;

import static org.junit.Assert.assertTrue;

import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.WebElement;

import com.vaadin.testbench.elements.GridElement;
import com.vaadin.testbench.elements.NotificationElement;
import com.vaadin.tests.tb3.MultiBrowserTest;

public class InitialFrozenColumnsTest extends MultiBrowserTest {
@Test
public void testInitialFrozenColumns() {
setDebug(true);
openTestURL();

Assert.assertFalse("Notification was present",
isElementPresent(NotificationElement.class));

WebElement cell = $(GridElement.class).first().getCell(0, 0);
assertTrue(cell.getAttribute("class").contains("frozen"));
}
}

Loading…
Cancel
Save