aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2015-09-30 10:58:01 +0300
committerHenri Sara <hesara@vaadin.com>2015-09-30 11:00:10 +0300
commitd6a24d36a4c066879854fdda9ae86a3e32262ea5 (patch)
tree0b69a70c9dfd8346e6bb5242897b295c4532be52
parentdbafe62f05b01566a0f29b2e652d1a3876cba89a (diff)
downloadvaadin-framework-d6a24d36a4c066879854fdda9ae86a3e32262ea5.tar.gz
vaadin-framework-d6a24d36a4c066879854fdda9ae86a3e32262ea5.zip
Revert "Correctly round tr width in Escalator (#18820)"
This reverts commit 179a3c8c1c37976b6c14fe252a07b9a7e2f32dd0. Change-Id: Ia33a6704db4bad8a1a8ef0dc55719e2f8164c827
-rw-r--r--client/src/com/vaadin/client/widgets/Escalator.java8
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridThemeUI.java141
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridThemeUITest.java113
3 files changed, 1 insertions, 261 deletions
diff --git a/client/src/com/vaadin/client/widgets/Escalator.java b/client/src/com/vaadin/client/widgets/Escalator.java
index 9b9616f474..761edf1f11 100644
--- a/client/src/com/vaadin/client/widgets/Escalator.java
+++ b/client/src/com/vaadin/client/widgets/Escalator.java
@@ -1756,13 +1756,7 @@ public class Escalator extends Widget implements RequiresResize,
Element row = root.getFirstChildElement();
while (row != null) {
- // IF there is a rounding error when summing the columns, we
- // need to round the tr width up to ensure that columns fit and
- // do not wrap
- // E.g.122.95+123.25+103.75+209.25+83.52+88.57+263.45+131.21+126.85+113.13=1365.9299999999998
- // For this we must set 1365.93 or the last column will wrap
- row.getStyle().setWidth(WidgetUtil.roundSizeUp(rowWidth),
- Unit.PX);
+ row.getStyle().setWidth(rowWidth, Unit.PX);
row = row.getNextSiblingElement();
}
}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridThemeUI.java b/uitest/src/com/vaadin/tests/components/grid/GridThemeUI.java
deleted file mode 100644
index 09685d5b4c..0000000000
--- a/uitest/src/com/vaadin/tests/components/grid/GridThemeUI.java
+++ /dev/null
@@ -1,141 +0,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
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.tests.components.grid;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-import com.vaadin.annotations.Theme;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
-import com.vaadin.data.util.BeanItemContainer;
-import com.vaadin.data.validator.IntegerRangeValidator;
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.tests.components.AbstractTestUIWithLog;
-import com.vaadin.tests.fieldgroup.ComplexPerson;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.ComboBox;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.Grid;
-import com.vaadin.ui.NativeSelect;
-
-@Theme("valo")
-public class GridThemeUI extends AbstractTestUIWithLog {
-
- private Grid grid;
-
- protected static String[] columns = new String[] { "firstName", "lastName",
- "gender", "birthDate", "age", "alive", "address.streetAddress",
- "address.postalCode", "address.city", "address.country" };
-
- protected BeanItemContainer<ComplexPerson> container = ComplexPerson
- .createContainer(100);;
- {
- container.addNestedContainerBean("address");
- }
- protected ComboBox formType;
-
- private Component active = null;
-
- @Override
- protected void setup(VaadinRequest request) {
- setLocale(new Locale("en", "US"));
-
- final NativeSelect pageSelect = new NativeSelect("Page");
- pageSelect.setImmediate(true);
- pageSelect.setId("page");
- addComponent(pageSelect);
-
- pageSelect.addItem(new Editor());
- pageSelect.addItem(new HeaderFooter());
-
- pageSelect.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (active != null) {
- removeComponent(active);
- }
- active = (Component) pageSelect.getValue();
- addComponent(active);
- }
- });
- pageSelect.setNullSelectionAllowed(false);
- pageSelect.setValue(pageSelect.getItemIds().iterator().next());
-
- }
-
- public class Editor extends Grid {
- @Override
- public String toString() {
- return "Editor";
- };
-
- public Editor() {
- setContainerDataSource(container);
- setColumnOrder((Object[]) columns);
- removeColumn("salary");
- setEditorEnabled(true);
- getColumn("lastName").setEditable(false);
- setSizeFull();
- getColumn("age").getEditorField().addValidator(
- new IntegerRangeValidator("Must be between 0 and 100", 0,
- 100));
- }
- }
-
- public class HeaderFooter extends Grid {
- @Override
- public String toString() {
- return getClass().getSimpleName();
- };
-
- public HeaderFooter() {
- setContainerDataSource(container);
- setColumnOrder((Object[]) columns);
- HeaderRow row = addHeaderRowAt(0);
- row.join("firstName", "lastName").setHtml("<b>Name</b>");
- Button b = new Button("The address, yo");
- b.addClickListener(new ClickListener() {
-
- @Override
- public void buttonClick(ClickEvent event) {
- HeaderRow row = addHeaderRowAt(0);
- List<Object> pids = new ArrayList<Object>();
- for (Column c : getColumns()) {
- pids.add(c.getPropertyId());
- }
- row.join(pids.toArray()).setText("The big header");
- }
- });
- b.setSizeFull();
- row.join("address.streetAddress", "address.postalCode",
- "address.city", "address.country").setComponent(b);
- getColumn("age").setWidth(25);
- removeColumn("salary");
- setEditorEnabled(true);
- setSizeFull();
- getColumn("age").getEditorField().addValidator(
- new IntegerRangeValidator("Must be between 0 and 100", 0,
- 100));
-
- addFooterRowAt(0);
- }
- }
-
-}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridThemeUITest.java b/uitest/src/com/vaadin/tests/components/grid/GridThemeUITest.java
deleted file mode 100644
index 140e8a90d8..0000000000
--- a/uitest/src/com/vaadin/tests/components/grid/GridThemeUITest.java
+++ /dev/null
@@ -1,113 +0,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
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.tests.components.grid;
-
-import org.junit.Test;
-import org.openqa.selenium.By;
-import org.openqa.selenium.Keys;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.interactions.Actions;
-
-import com.vaadin.testbench.elements.ButtonElement;
-import com.vaadin.testbench.elements.DateFieldElement;
-import com.vaadin.testbench.elements.GridElement;
-import com.vaadin.testbench.elements.GridElement.GridCellElement;
-import com.vaadin.testbench.elements.GridElement.GridEditorElement;
-import com.vaadin.testbench.elements.NativeSelectElement;
-import com.vaadin.testbench.elements.TextFieldElement;
-import com.vaadin.testbench.parallel.TestCategory;
-import com.vaadin.tests.tb3.MultiBrowserThemeTest;
-
-@TestCategory("grid")
-public class GridThemeUITest extends MultiBrowserThemeTest {
-
- private GridElement grid;
-
- @Test
- public void grid() throws Exception {
- openTestURL();
- selectPage("Editor");
- compareScreen("basic");
- }
-
- @Test
- public void headerAndFooter() throws Exception {
- openTestURL();
- selectPage("HeaderFooter");
- compareScreen("basic");
- grid.getHeaderCell(0, 6).$(ButtonElement.class).first().click();
- compareScreen("additional-header");
- grid.getHeaderCell(2, 1).click();
- compareScreen("sorted-last-name");
- grid.getHeaderCell(2, 4).click();
- compareScreen("sorted-age");
- }
-
- @Test
- public void editor() throws Exception {
- openTestURL();
- selectPage("Editor");
- GridCellElement ritaBirthdate = grid.getCell(2, 3);
- // Open editor row
- openEditor(ritaBirthdate);
-
- compareScreen("initial");
-
- GridEditorElement editor = grid.getEditor();
-
- DateFieldElement dateField = editor.$(DateFieldElement.class).first();
- WebElement input = dateField.findElement(By.xpath("input"));
- input.sendKeys("Invalid", Keys.TAB);
- editor.save();
- compareScreen("one-invalid");
-
- TextFieldElement age = editor.$(TextFieldElement.class).caption("Age")
- .first();
- age.sendKeys("abc", Keys.TAB);
- if (age.getValue().equals("21")) {
- // Yes IE8, really type into the field
- age.sendKeys("abc", Keys.TAB);
- }
- editor.save();
-
- compareScreen("two-invalid");
- }
-
- private void openEditor(GridCellElement targetCell) {
- new Actions(getDriver()).doubleClick(targetCell).perform();
- try {
- if (grid.getEditor().isDisplayed()) {
- return;
- }
- } catch (Exception e) {
-
- }
-
- // Try again if IE happen to fail..
- new Actions(getDriver()).doubleClick(targetCell).perform();
- }
-
- /**
- * @since
- * @param string
- */
- private void selectPage(String string) {
- $(NativeSelectElement.class).id("page").selectByText(string);
- grid = $(GridElement.class).first();
-
- }
-
-}